#include <tasm-scanner.h>
Inheritance diagram for TextAsmScanner:
Public Types | |
enum | TokID { T_EOF = 0, T_pop = 258, T_symbols, T_locations, T_program, T_info, TS_namespace, TS_class, TS_base, TS_baseent, TS_varent, TS_size, TS_virtual, TS_vtable, TS_symref, TS_vglobal, TS_pglobal, TS_symbols, TS_funcsym, TS_varsym, TS_globvar, TP_slabel, TP_mlabel, TP_rlabel, TI_abivers } |
Public Member Functions | |
TextAsmScanner () | |
Construct text assembly scanner. | |
~TextAsmScanner () | |
Destroy text assembly scanner and all (allocated and zombie) tokens. | |
int | NErrors () const |
Get the number of lexer errors. | |
VM::InstructionStorage * | InsnStorage () |
Used to get insn_storage. | |
Static Public Member Functions | |
const char * | TokID2String (TokID t) |
Return string representation of token ID. | |
Public Attributes | |
VM::ProgramStorage::Function * | insn_storage |
Private Member Functions | |
void | reset () |
Scanner reset [overriding virtual]. | |
TokenEntry * | AllocTokenEntry () |
Important: Override token entry allocation routine. | |
char * | _ParseNameStr (const char *str, const char *end) |
Parse name string. | |
template<typename T> const char * | _ParseInt (T *ret, const char *str, char prefix='\0') |
Overloaded integer parsing function. | |
template<typename T> const char * | _ParseInt0 (T *ret, const char *str) |
Special version which will return 0 if value is not present. | |
template<typename T> const char * | _ParseFloat (T *ret, const char *str) |
Overloaded float parsing function. | |
const char * | _ParseTypeSpec (Token::Type *ts, const char *str) |
Parse type spec. | |
void | _CheckInstAllowed_Failed () |
Internally used by _CheckInstAllowed(). | |
bool | _CheckInstAllowed () |
Check if an instruction may be specified now. Returns 0 if not. | |
TextAsmScanner (const TextAsmScanner &) | |
Do not use. | |
void | operator= (const TextAsmScanner &) |
Do not use. | |
Friends | |
int | TASM_lex (void *) |
NOTE: This class is not in a namespace as it makes big trouble to put a flex lexer into a namespace.
Definition at line 50 of file tasm-scanner.h.
|
This are the token identifiers. Do not forget to keep _TokID2String() in sync.
Definition at line 56 of file tasm-scanner.h. |
|
Do not use.
|
|
Construct text assembly scanner.
|
|
Destroy text assembly scanner and all (allocated and zombie) tokens.
|
|
Check if an instruction may be specified now. Returns 0 if not.
Definition at line 211 of file tasm-scanner.h. References _CheckInstAllowed_Failed(), and insn_storage. |
|
Internally used by _CheckInstAllowed().
Referenced by _CheckInstAllowed(). |
|
Overloaded float parsing function.
For internal use only. Same as _ParseInt() but for floats and without prefix skipping. |
|
Overloaded integer parsing function.
For internal use only. Parse integer by first skipping any number of whitespace before the integer. Additionally, the specified prefix (if not '\0') must be present before the ineger value. Input string (str) is NUL-terminated. The parsed integer is stored in *ret. Returns where the parsed integer string ended (i.e. where to resume parsing). |
|
Special version which will return 0 if value is not present.
|
|
Parse name string.
For internal use only. Parse name string by first skipping any number of whitespace before the name.
If end=NULL, the input string (str) must be NUL-terminated and strlen() is asked for the length.
|
|
Parse type spec.
For internal use only.
Parse type spec in the form Parsed type spec is stored in *ts.
|
|
Important: Override token entry allocation routine.
Definition at line 146 of file tasm-scanner.h. |
|
Used to get insn_storage.
Definition at line 237 of file tasm-scanner.h. References insn_storage. |
|
Get the number of lexer errors.
Definition at line 228 of file tasm-scanner.h. Referenced by VM::AssemblerFile_Plaintext::ParseFile(). |
|
Do not use.
|
|
Scanner reset [overriding virtual].
|
|
Return string representation of token ID.
Referenced by VM::AssemblerFile_Plaintext::_AlreadySetError(), and VM::AssemblerFile_Plaintext::_ExpectError(). |
|
|
|
This InstructionStorage-derived object is used to append all instructions as they come. If NULL, instructions in input will generate an error. Definition at line 234 of file tasm-scanner.h. Referenced by _CheckInstAllowed(), VM::AssemblerFile_Plaintext::_ParseProgram_FinishFunction(), VM::AssemblerFile_Plaintext::_ParseProgram_Label(), and InsnStorage(). |