Pol  Revision:4b29d2b
Pol::Bscript::Token Class Reference

#include <token.h>

Public Member Functions

 Token ()
 
 Token (const Token &tok)
 
 Token (ModuleID module, BTokenId id, BTokenType type)
 
 Token (BTokenId id, BTokenType type)
 
 Token (ModuleID module, BTokenId id, BTokenType type, UserFunction *userfunc)
 
 ~Token ()
 
void copyStr (const char *s)
 
void copyStr (const char *s, int len)
 
void nulStr ()
 
Tokenoperator= (const Token &tok)
 
void printOn (std::ostream &outputStream) const
 
void setStr (const char *s)
 
const char * tokval () const
 

Static Public Member Functions

static unsigned int instances ()
 
static void show_instances ()
 

Public Attributes

union {
   int   precedence
 
   int   sourceFile
 
}; 
 
union {
   const unsigned char *   dataptr
 
   int   lval
 
}; 
 
int dbg_filenum
 
int dbg_linenum
 
bool deprecated
 
double dval
 
BTokenId id
 
unsigned char module
 
bool ownsStr
 
BTokenType type
 
UserFunctionuserfunc
 

Protected Member Functions

void register_instance ()
 
void unregister_instance ()
 

Protected Attributes

const char * token
 

Static Protected Attributes

static unsigned int _instances = 0
 

Detailed Description

Definition at line 36 of file token.h.

Constructor & Destructor Documentation

Pol::Bscript::Token::Token ( )

Initializes an empty token

Definition at line 65 of file token.cpp.

References register_instance().

Referenced by tokval().

Pol::Bscript::Token::Token ( const Token tok)

Initializes a token copying data from a given one

Definition at line 85 of file token.cpp.

References copyStr(), ownsStr, register_instance(), setStr(), and token.

Pol::Bscript::Token::Token ( ModuleID  module,
BTokenId  id,
BTokenType  type 
)

Definition at line 140 of file token.cpp.

References register_instance().

Pol::Bscript::Token::Token ( BTokenId  id,
BTokenType  type 
)

Definition at line 157 of file token.cpp.

References register_instance().

Pol::Bscript::Token::Token ( ModuleID  module,
BTokenId  id,
BTokenType  type,
UserFunction userfunc 
)

Definition at line 174 of file token.cpp.

References register_instance().

Pol::Bscript::Token::~Token ( )

Definition at line 249 of file token.cpp.

References nulStr(), and unregister_instance().

Referenced by tokval().

Member Function Documentation

void Pol::Bscript::Token::copyStr ( const char *  s)

Copies value form the given null terminated char array into the String (s)

Definition at line 214 of file token.cpp.

References nulStr(), ownsStr, and token.

Referenced by Pol::Bscript::SmartParser::IIP(), operator=(), Pol::Bscript::optimize_string_operation(), Pol::Bscript::Expression::optimize_token(), Token(), tokval(), and Pol::Bscript::Parser::tryLiteral().

void Pol::Bscript::Token::copyStr ( const char *  s,
int  len 
)

Definition at line 231 of file token.cpp.

References nulStr(), ownsStr, and token.

unsigned int Pol::Bscript::Token::instances ( )
static

Definition at line 22 of file token.cpp.

References _instances.

void Pol::Bscript::Token::nulStr ( )

Erases all the content from the String (s), that becomes empty

Definition at line 194 of file token.cpp.

References ownsStr, and token.

Referenced by Pol::Bscript::EScriptProgram::_readToken(), copyStr(), operator=(), setStr(), tokval(), Pol::Bscript::Parser::write_words(), and ~Token().

Token & Pol::Bscript::Token::operator= ( const Token tok)

Assigns the values from a given token to this one

Definition at line 112 of file token.cpp.

References copyStr(), dbg_filenum, dbg_linenum, deprecated, dval, id, lval, module, nulStr(), ownsStr, precedence, setStr(), token, type, and userfunc.

Referenced by tokval().

void Pol::Bscript::Token::printOn ( std::ostream &  outputStream) const

Definition at line 20 of file tkn_strm.cpp.

References Pol::Bscript::ObjMethod::code, Pol::Bscript::ObjMember::code, Pol::Bscript::CTRL_JSR_USERFUNC, Pol::Bscript::CTRL_LABEL, Pol::Bscript::CTRL_LEAVE_BLOCK, Pol::Bscript::CTRL_MAKELOCAL, Pol::Bscript::CTRL_PROGEND, Pol::Bscript::CTRL_STATEMENTBEGIN, dval, Pol::Bscript::getObjMember(), Pol::Bscript::getObjMethod(), Pol::Bscript::INS_ADDMEMBER2, Pol::Bscript::INS_ADDMEMBER_ASSIGN, Pol::Bscript::INS_ASSIGN_CONSUME, Pol::Bscript::INS_ASSIGN_GLOBALVAR, Pol::Bscript::INS_ASSIGN_LOCALVAR, Pol::Bscript::INS_CALL_METHOD, Pol::Bscript::INS_CALL_METHOD_ID, Pol::Bscript::INS_CASEJMP, Pol::Bscript::INS_DECLARE_ARRAY, Pol::Bscript::INS_DICTIONARY_ADDMEMBER, Pol::Bscript::INS_GET_ARG, Pol::Bscript::INS_GET_MEMBER, Pol::Bscript::INS_GET_MEMBER_ID, Pol::Bscript::INS_INITFOR, Pol::Bscript::INS_INITFOREACH, Pol::Bscript::INS_MULTISUBSCRIPT, Pol::Bscript::INS_MULTISUBSCRIPT_ASSIGN, Pol::Bscript::INS_NEXTFOR, Pol::Bscript::INS_POP_PARAM, Pol::Bscript::INS_POP_PARAM_BYREF, Pol::Bscript::INS_SET_MEMBER, Pol::Bscript::INS_SET_MEMBER_CONSUME, Pol::Bscript::INS_SET_MEMBER_ID, Pol::Bscript::INS_SET_MEMBER_ID_CONSUME, Pol::Bscript::INS_SET_MEMBER_ID_CONSUME_DIVIDEEQUAL, Pol::Bscript::INS_SET_MEMBER_ID_CONSUME_MINUSEQUAL, Pol::Bscript::INS_SET_MEMBER_ID_CONSUME_MODULUSEQUAL, Pol::Bscript::INS_SET_MEMBER_ID_CONSUME_PLUSEQUAL, Pol::Bscript::INS_SET_MEMBER_ID_CONSUME_TIMESEQUAL, Pol::Bscript::INS_STEPFOREACH, Pol::Bscript::INS_SUBSCRIPT_ASSIGN, Pol::Bscript::INS_SUBSCRIPT_ASSIGN_CONSUME, Pol::Bscript::INS_UNINIT, lval, module, Pol::Bscript::RSV_COLON, Pol::Bscript::RSV_CONST, Pol::Bscript::RSV_DECLARE, Pol::Bscript::RSV_DO, Pol::Bscript::RSV_DOWHILE, Pol::Bscript::RSV_ENDENUM, Pol::Bscript::RSV_ENDFOR, Pol::Bscript::RSV_ENDFOREACH, Pol::Bscript::RSV_ENDFUNCTION, Pol::Bscript::RSV_ENDPROGRAM, Pol::Bscript::RSV_ENDWHILE, Pol::Bscript::RSV_ENUM, Pol::Bscript::RSV_EXIT, Pol::Bscript::RSV_FOR, Pol::Bscript::RSV_FOREACH, Pol::Bscript::RSV_FUNCTION, Pol::Bscript::RSV_GLOBAL, Pol::Bscript::RSV_GOSUB, Pol::Bscript::RSV_GOTO, Pol::Bscript::RSV_INCLUDE_FILE, Pol::Bscript::RSV_JMPIFFALSE, Pol::Bscript::RSV_JMPIFTRUE, Pol::Bscript::RSV_LOCAL, Pol::Bscript::RSV_PROGRAM, Pol::Bscript::RSV_REPEAT, Pol::Bscript::RSV_RETURN, Pol::Bscript::RSV_ST_IF, Pol::Bscript::RSV_UNTIL, Pol::Bscript::RSV_USE_MODULE, Pol::Bscript::RSV_VAR, Pol::Bscript::RSV_WHILE, Pol::Bscript::TOK_ADD, Pol::Bscript::TOK_ADDMEMBER, Pol::Bscript::TOK_AND, Pol::Bscript::TOK_ARRAY, Pol::Bscript::TOK_ARRAY_SUBSCRIPT, Pol::Bscript::TOK_ASSIGN, Pol::Bscript::TOK_BITAND, Pol::Bscript::TOK_BITOR, Pol::Bscript::TOK_BITWISE_NOT, Pol::Bscript::TOK_BITXOR, Pol::Bscript::TOK_BSLEFT, Pol::Bscript::TOK_BSRIGHT, Pol::Bscript::TOK_CHKMEMBER, Pol::Bscript::TOK_COMMA, Pol::Bscript::TOK_CONSUMER, Pol::Bscript::TOK_DELMEMBER, Pol::Bscript::TOK_DICTIONARY, Pol::Bscript::TOK_DIV, Pol::Bscript::TOK_DIVIDEEQUAL, Pol::Bscript::TOK_DOUBLE, Pol::Bscript::TOK_EQUAL, Pol::Bscript::TOK_EQUAL1, Pol::Bscript::TOK_ERROR, Pol::Bscript::TOK_FUNC, Pol::Bscript::TOK_FUNCREF, Pol::Bscript::TOK_GLOBALVAR, Pol::Bscript::TOK_GREQ, Pol::Bscript::TOK_GRTHAN, Pol::Bscript::TOK_IDENT, Pol::Bscript::TOK_IN, Pol::Bscript::TOK_INSERTINTO, Pol::Bscript::TOK_LBRACE, Pol::Bscript::TOK_LBRACKET, Pol::Bscript::TOK_LESSEQ, Pol::Bscript::TOK_LESSTHAN, Pol::Bscript::TOK_LOCALVAR, Pol::Bscript::TOK_LOG_NOT, Pol::Bscript::TOK_LONG, Pol::Bscript::TOK_LPAREN, Pol::Bscript::TOK_MEMBER, Pol::Bscript::TOK_MINUSEQUAL, Pol::Bscript::TOK_MODULUS, Pol::Bscript::TOK_MODULUSEQUAL, Pol::Bscript::TOK_MULT, Pol::Bscript::TOK_NEQ, Pol::Bscript::TOK_OR, Pol::Bscript::TOK_PLUSEQUAL, Pol::Bscript::TOK_RBRACE, Pol::Bscript::TOK_RBRACKET, Pol::Bscript::TOK_REFTO, Pol::Bscript::TOK_RPAREN, Pol::Bscript::TOK_SEMICOLON, Pol::Bscript::TOK_STRING, Pol::Bscript::TOK_STRUCT, Pol::Bscript::TOK_SUBTRACT, Pol::Bscript::TOK_TERM, Pol::Bscript::TOK_TIMESEQUAL, Pol::Bscript::TOK_UNMINUS, Pol::Bscript::TOK_UNPLUS, Pol::Bscript::TOK_UNUSED, Pol::Bscript::TOK_USERFUNC, token, and type.

Referenced by Pol::Bscript::operator<<(), tokval(), and unregister_instance().

void Pol::Bscript::Token::register_instance ( )
protected

Definition at line 38 of file token.cpp.

References _instances.

Referenced by Token().

void Pol::Bscript::Token::show_instances ( )
static

Definition at line 26 of file token.cpp.

const char* Pol::Bscript::Token::tokval ( ) const
inline

Definition at line 71 of file token.h.

References copyStr(), nulStr(), Pol::Bscript::operator<<(), operator=(), printOn(), setStr(), token, Token(), and ~Token().

Referenced by Pol::Bscript::Compiler::_getStatement(), Pol::Bscript::EScriptProgram::addToken(), Pol::Bscript::Parser::getToken(), Pol::Bscript::Compiler::getUserArgs(), Pol::Bscript::Compiler::handleBracketedFor_basic(), Pol::Bscript::Compiler::handleBracketedFunction2(), Pol::Bscript::Compiler::handleBreak(), Pol::Bscript::Compiler::handleConstDeclare(), Pol::Bscript::Compiler::handleContinue(), Pol::Bscript::Compiler::handleEnumDeclare(), Pol::Bscript::Compiler::handleForEach(), Pol::Bscript::Compiler::handleInclude(), Pol::Bscript::Compiler::handleProgram2(), Pol::Bscript::Compiler::handleSwitch(), Pol::Bscript::Compiler::handleUse(), Pol::Bscript::Compiler::handleVarDeclare(), Pol::Bscript::SmartParser::IIP(), Pol::Bscript::Compiler::inner_read_function_declarations(), Pol::Bscript::Executor::ins_addmember2(), Pol::Bscript::Executor::ins_addmember_assign(), Pol::Bscript::Executor::ins_call_method(), Pol::Bscript::Executor::ins_get_member(), Pol::Bscript::Executor::ins_set_member(), Pol::Bscript::Executor::ins_set_member_consume(), Pol::Bscript::Executor::ins_statementbegin(), Pol::Bscript::Executor::ins_string(), Pol::Bscript::Compiler::isFunc(), Pol::Bscript::Compiler::isUserFunc(), Pol::Bscript::Executor::makeObj(), Pol::Bscript::optimize_string_operation(), Pol::Bscript::Expression::optimize_token(), Pol::Bscript::Compiler::readFunctionDeclaration(), Pol::Bscript::Compiler::substitute_constant(), and Pol::Bscript::Compiler::validate().

void Pol::Bscript::Token::unregister_instance ( )
protected

Definition at line 46 of file token.cpp.

References _instances, Pol::Clib::exit_signalled, printOn(), and token.

Referenced by ~Token().

Member Data Documentation

union { ... }
union { ... }
unsigned int Pol::Bscript::Token::_instances = 0
staticprotected

Definition at line 66 of file token.h.

Referenced by instances(), register_instance(), and unregister_instance().

BTokenId Pol::Bscript::Token::id

Definition at line 39 of file token.h.

Referenced by Pol::Bscript::Compiler::_getStatement(), Pol::Bscript::EScriptProgram::_readToken(), Pol::Bscript::EScriptProgram::addToken(), Pol::Bscript::SmartParser::callingMethod(), Pol::Bscript::EScriptProgram::dump(), Pol::Bscript::Compiler::eatToken(), Pol::Bscript::Compiler::forward_read_function(), Pol::Bscript::Expression::get_num_tokens(), Pol::Bscript::SmartParser::getArgs(), Pol::Bscript::Compiler::getArrayElements(), Pol::Bscript::Compiler::getDictionaryMembers(), Pol::Bscript::Compiler::getExprInParens(), Pol::Bscript::Compiler::getFunctionPArgument(), Pol::Bscript::Executor::GetInstrFunc(), Pol::Bscript::Compiler::getMethodArguments(), Pol::Bscript::Compiler::getNewArrayElements(), Pol::Bscript::Compiler::getSimpleExpr(), Pol::Bscript::Compiler::getStructMembers(), Pol::Bscript::Parser::getToken(), Pol::Bscript::SmartParser::getToken(), Pol::Bscript::Compiler::getUserArgs(), Pol::Bscript::Compiler::handleBlock(), Pol::Bscript::Compiler::handleBracketedFor_basic(), Pol::Bscript::Compiler::handleBracketedFor_c(), Pol::Bscript::Compiler::handleBracketedFunction2(), Pol::Bscript::Compiler::handleBracketedIf(), Pol::Bscript::Compiler::handleBreak(), Pol::Bscript::Compiler::handleConstDeclare(), Pol::Bscript::Compiler::handleContinue(), Pol::Bscript::Compiler::handleDeclare(), Pol::Bscript::Compiler::handleEnumDeclare(), Pol::Bscript::Compiler::handleExit(), Pol::Bscript::Compiler::handleFor(), Pol::Bscript::Compiler::handleFor_c(), Pol::Bscript::Compiler::handleForEach(), Pol::Bscript::Compiler::handleFunction(), Pol::Bscript::Compiler::handleIf(), Pol::Bscript::Compiler::handleInclude(), Pol::Bscript::Compiler::handleProgram(), Pol::Bscript::Compiler::handleProgram2(), Pol::Bscript::Compiler::handleReturn(), Pol::Bscript::Compiler::handleSwitch(), Pol::Bscript::Compiler::handleUse(), Pol::Bscript::Compiler::handleVarDeclare(), Pol::Bscript::SmartParser::IIP(), Pol::Bscript::Compiler::inner_read_function_declarations(), Pol::Bscript::Compiler::isFunc(), Pol::Bscript::Compiler::isLegal(), Pol::Bscript::SmartParser::isOkay(), Pol::Bscript::Compiler::isUserFunc(), Pol::Bscript::Executor::makeObj(), Pol::Bscript::mismatched_end(), operator=(), Pol::Bscript::Expression::optimize_binary_operations(), Pol::Bscript::optimize_double_operation(), Pol::Bscript::optimize_long_operation(), Pol::Bscript::optimize_string_operation(), Pol::Bscript::Expression::optimize_token(), Pol::Bscript::Expression::optimize_unary_operations(), Pol::Bscript::SmartParser::parseToken(), Pol::Bscript::Compiler::readblock(), Pol::Bscript::Compiler::readFunctionDeclaration(), Pol::Bscript::Parser::recognize_binary(), Pol::Bscript::Parser::recognize_reserved_word(), Pol::Bscript::Parser::recognize_unary(), Pol::Bscript::Parser::tryLiteral(), Pol::Bscript::SmartParser::tryLiteral(), Pol::Bscript::Parser::tryNumeric(), Pol::Bscript::Parser::tryOperator(), Pol::Bscript::Compiler::useModule(), and Pol::Bscript::Compiler::validate().

int Pol::Bscript::Token::lval

Definition at line 49 of file token.h.

Referenced by Pol::Bscript::EScriptProgram::_readToken(), Pol::Bscript::EScriptProgram::addToken(), Pol::Bscript::Executor::execFunc(), Pol::Bscript::Expression::get_num_tokens(), Pol::Bscript::Compiler::handleEnumDeclare(), Pol::Bscript::Compiler::handleSwitch(), Pol::Bscript::SmartParser::IIP(), Pol::Bscript::Executor::ins_assign_globalvar(), Pol::Bscript::Executor::ins_assign_localvar(), Pol::Bscript::Executor::ins_call_method(), Pol::Bscript::Executor::ins_call_method_id(), Pol::Bscript::Executor::ins_func(), Pol::Bscript::Executor::ins_funcref(), Pol::Bscript::Executor::ins_get_member_id(), Pol::Bscript::Executor::ins_globalvar(), Pol::Bscript::Executor::ins_gosub(), Pol::Bscript::Executor::ins_goto(), Pol::Bscript::Executor::ins_initfor(), Pol::Bscript::Executor::ins_initforeach(), Pol::Bscript::Executor::ins_initforeach2(), Pol::Bscript::Executor::ins_jmpiffalse(), Pol::Bscript::Executor::ins_jmpiftrue(), Pol::Bscript::Executor::ins_jsr_userfunc(), Pol::Bscript::Executor::ins_leave_block(), Pol::Bscript::Executor::ins_localvar(), Pol::Bscript::Executor::ins_long(), Pol::Bscript::Executor::ins_multisubscript(), Pol::Bscript::Executor::ins_multisubscript_assign(), Pol::Bscript::Executor::ins_nextfor(), Pol::Bscript::Executor::ins_set_member_id(), Pol::Bscript::Executor::ins_set_member_id_consume(), Pol::Bscript::Executor::ins_set_member_id_consume_divideequal(), Pol::Bscript::Executor::ins_set_member_id_consume_minusequal(), Pol::Bscript::Executor::ins_set_member_id_consume_modulusequal(), Pol::Bscript::Executor::ins_set_member_id_consume_plusequal(), Pol::Bscript::Executor::ins_set_member_id_consume_timesequal(), Pol::Bscript::Executor::ins_stepforeach(), Pol::Bscript::Executor::ins_stepforeach2(), Pol::Bscript::Compiler::isFunc(), Pol::Bscript::Executor::makeObj(), operator=(), Pol::Bscript::optimize_long_operation(), Pol::Bscript::Expression::optimize_token(), Pol::Bscript::SmartParser::parseToken(), printOn(), Pol::Bscript::Parser::tryNumeric(), and Pol::Bscript::BFunctionRef::validCall().

bool Pol::Bscript::Token::ownsStr

Definition at line 54 of file token.h.

Referenced by copyStr(), nulStr(), operator=(), setStr(), and Token().

int Pol::Bscript::Token::sourceFile

Definition at line 44 of file token.h.

Referenced by Pol::Bscript::EScriptProgram::_readToken().

const char* Pol::Bscript::Token::token
protected

Definition at line 61 of file token.h.

Referenced by copyStr(), nulStr(), operator=(), printOn(), setStr(), Token(), tokval(), and unregister_instance().


The documentation for this class was generated from the following files: