polserver/pol-core/bscript/token.h
turleypol 1463b76c7c
Includes are now all relative to pol-core basefolder (#906)
* all except pol

* pol and includes under defines

* something weird has happened

* remove own folder from include searchpath

* fixed remaining, adapted include style for external headers

* missing include
2026-07-25 23:01:18 +02:00

67 lines
1 KiB
C++

/** @file
*
* @par History
*/
#ifndef __TOKEN_H
#define __TOKEN_H
#include "bscript/tokens.h"
#include <fmt/format.h>
namespace Pol::Bscript
{
struct DebugToken
{
unsigned sourceFile;
unsigned offset;
unsigned strOffset;
};
class Token
{
public:
BTokenId id;
BTokenType type;
double dval;
union
{
int precedence;
int sourceFile;
};
int dbg_filenum;
int dbg_linenum;
union
{
int lval;
const unsigned char* dataptr;
};
bool deprecated;
unsigned char module;
static unsigned int instances();
static void show_instances();
protected:
std::string token;
public:
const char* tokval() const { return token.c_str(); }
Token();
void nulStr();
void setStr( std::string str );
std::string tostring() const;
};
} // namespace Pol::Bscript
template <>
struct fmt::formatter<Pol::Bscript::Token> : fmt::formatter<std::string>
{
fmt::format_context::iterator format( const Pol::Bscript::Token& t,
fmt::format_context& ctx ) const;
};
#endif