210#define LEX_MACRO_SYSTEM 1
216 const char *
const *keys,
255#define LXOPT_PARSE_FLOATS 0x0001
256#define LXOPT_REQ_SEPARATOR 0x0002
257#define LXOPT_NOCASE_FILES 0x0004
258#define LXOPT_C99_CONSTANTS 0x0008
261#define LXOPT_STR_INCLUDE_BACKSLASHES 0x0010
278 int idaapi cb(
const char *name,
const char *body,
int nargs,
bool isfunc,
void *ud),
297 void *macros=
nullptr);
317 const char **lineptr,
Reimplementation of stack class from STL.
Definition pro.h:2774
T pop(void)
Definition pro.h:2777
void push(const T &v)
Definition pro.h:2788
bool empty(void) const
Does the qvector have 0 elements?
Definition pro.h:2424
const lxtype lx_ident
ident
Definition lex.hpp:30
const lxtype lx_end
no more tokens
Definition lex.hpp:29
const lxtype lx_int64
int64 constant
Definition lex.hpp:36
const lxtype lx_number
long constant
Definition lex.hpp:31
const lxtype lx_string
string constant (token_t.chr != 0 => unicode string)
Definition lex.hpp:32
const lxtype lx_typename
user-defined type
Definition lex.hpp:34
const lxtype lx_key
keywords start.
Definition lex.hpp:38
const lxtype lx_callcnv
custom calling convention
Definition lex.hpp:37
const lxtype lx_char
char constant
Definition lex.hpp:33
const lxtype lx_float
IEEE floating point constant.
Definition lex.hpp:35
uint32 callcnv_t
Definition ida.hpp:74
IEEE floating point functions.
asize_t size
Definition kernwin.hpp:6339
idaman void ida_export lex_undefine_macro(lexer_t *lx, const char *macro)
Undefine a macro.
MSC_DIAG_ON(4826) typedef error_t lx_parse_cast_t(lexer_t *lx
Preprocessor callbacks for casts.
int idaapi lx_undef_cb(void *ud, const char *name)
Callback for undef directives.
Definition lex.hpp:208
cast_t token_t * ct
Definition lex.hpp:172
idaman const char *ida_export lex_print_token(qstring *buf, const token_t *t)
Debug: get text representation of token.
idaman void ida_export lex_term_file(lexer_t *lx, bool del_macros)
Termination: also see lex_init_file()
idaman bool ida_export is_c_keyword(const char *name)
is NAME a valid C keyword (exclude 'this')
idaman const char *ida_export lex_get_file_line(lexer_t *lx, int32 *linenum, const char **lineptr, int level=0)
Error handling.
idaman error_t ida_export lex_init_file(lexer_t *lx, const char *file)
Initialization: file may be nullptr.
error_t lx_resolver_t(lexer_t *lx, void *ud, token_t *curtok, sval_t *res)
Preprocessor callback for unknown tokens.
Definition lex.hpp:73
idaman void ida_export destroy_lexer(lexer_t *lx)
Destroy a lexical analyzer.
idaman error_t ida_export lex_define_macro(lexer_t *lx, const char *macro, const char *body, int nargs=0, bool isfunc=false)
Define a macro.
ushort lxtype
see Parser token types
Definition lex.hpp:21
int idaapi lx_macro_cb(void *ud, const char *name, const char *body, int nargs, bool isfunc, bool is_new_macro)
Callback for define directives.
Definition lex.hpp:196
int idaapi lx_warning_cb(void *ud, const char *line)
Callback for warning directives.
Definition lex.hpp:190
bool get_token(token_t *t, lexer_t *lx, tokenstack_t &buf)
Retrieve token from a stack or lexer.
Definition lex.hpp:337
idaman int ida_export lex_enum_macros(const lexer_t *lx, int idaapi cb(const char *name, const char *body, int nargs, bool isfunc, void *ud), void *ud=nullptr)
Enumerate all macros.
void unget_token(const token_t &t, tokenstack_t &buf)
Push a token back onto the token stack.
Definition lex.hpp:349
DECLARE_TYPE_AS_MOVABLE(token_t)
qstack< token_t > tokenstack_t
see get_token(), unget_token()
Definition lex.hpp:329
int idaapi lx_pragma_cb(void *ud, const char *line)
Callback for pragma directives.
Definition lex.hpp:184
idaman int ida_export lex_set_options(lexer_t *lx, int options)
Set lexer options.
idaman error_t ida_export lex_init_string(lexer_t *lx, const char *line, void *macros=nullptr)
Set the input line and the macro table.
idaman error_t ida_export lex_get_token(lexer_t *lx, token_t *t, int32 *p_lnnum=nullptr)
Get next token.
MSC_DIAG_OFF(4826) struct cast_t
Preprocessor cast.
Definition lex.hpp:78
cast_t * cast
Definition lex.hpp:172
idaman lexer_t *ida_export create_lexer(const char *const *keys, size_t size, void *ud=nullptr, uint32 macro_flags=0)
Create new lexical analyzer and set its keyword table.
int idaapi lx_preprocessor_cb(void *ud, const char *fname, int nl, const char *line)
Preprocessor callback.
Definition lex.hpp:178
unsigned __int64 uint64
Definition llong.hpp:13
__int64 int64
Definition llong.hpp:14
idaman size_t const char time_t t
Definition pro.h:602
unsigned int uint32
unsigned 32 bit value
Definition pro.h:348
adiff_t sval_t
signed value used by the processor.
Definition pro.h:446
int int32
signed 32 bit value
Definition pro.h:347
int error_t
Error code (errno)
Definition pro.h:458
unsigned short ushort
unsigned 16 bit value
Definition pro.h:338
_qstring< char > qstring
regular string
Definition pro.h:3694
Processor-independent representation of a floating point value.
Definition ieee.h:98
void reset(void)
Definition lex.hpp:114
int64 val
Definition lex.hpp:102
void bitwise_or(const lex_value_t &v)
void bitwise_and(const lex_value_t &v)
void cmple(const lex_value_t &v)
int64 get_val(void) const
Definition lex.hpp:128
void mod(const lex_value_t &v)
uint64 get_uval(void) const
Definition lex.hpp:124
void cmpge(const lex_value_t &v)
bool is_unsigned
Definition lex.hpp:99
void cmpgt(const lex_value_t &v)
void shift_left(const lex_value_t &v)
void bitwise_xor(const lex_value_t &v)
void logical_or(const lex_value_t &v)
void set_val(int64 v, bool _is_unsigned)
Definition lex.hpp:118
void cmplt(const lex_value_t &v)
void perform_cast(const cast_t &cast)
void set(const lex_value_t &v)
Definition lex.hpp:110
void logical_and(const lex_value_t &v)
void mul(const lex_value_t &v)
void cmpneq(const lex_value_t &v)
lex_value_t()
Definition lex.hpp:106
void bitwise_not(const lex_value_t &v)
void unary_plus(const lex_value_t &v)
void shift_right(const lex_value_t &v)
void unary_not(const lex_value_t &v)
bool is_zero(void) const
Definition lex.hpp:133
void cmpeq(const lex_value_t &v)
void add(const lex_value_t &v)
void unary_minus(const lex_value_t &v)
void div(const lex_value_t &v)
void sub(const lex_value_t &v)
uint64 uval
Definition lex.hpp:103
Parser token.
Definition lex.hpp:48
bool unicode
(lx_string: != 0 => unicode string)
Definition lex.hpp:54
callcnv_t callcnv
lx_callcnv
Definition lex.hpp:61
bool is_unsigned
(lx_number, lx_int64: != 0 => unsigned value)
Definition lex.hpp:55
int64 i64
lx_int64
Definition lex.hpp:60
sval_t num
long & char constants
Definition lex.hpp:51
lxtype type
see Parser token types
Definition lex.hpp:50
fpvalue_t fnum
floating point constant
Definition lex.hpp:59
token_t()
Definition lex.hpp:63
qstring str
idents & strings
Definition lex.hpp:49