X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=simgear%2Fnasal%2Fparse.h;h=39bfbe05df4001c1ea607b525c59cef3d40dc1b2;hb=9aa5c3b2ae9442a9f777088cae982aef9034183c;hp=e3db3e7a2bae037fe6d0af9dab5dc47cf3937f0c;hpb=b05e32fa8c11e6d66bb70850751e170dc472a1a3;p=simgear.git diff --git a/simgear/nasal/parse.h b/simgear/nasal/parse.h index e3db3e7a..39bfbe05 100644 --- a/simgear/nasal/parse.h +++ b/simgear/nasal/parse.h @@ -7,29 +7,29 @@ #include "data.h" #include "code.h" -enum { - TOK_TOP=1, TOK_AND, TOK_OR, TOK_NOT, TOK_LPAR, TOK_RPAR, TOK_LBRA, +enum tok { + TOK_TOP=1, TOK_AND, TOK_OR, TOK_NOT, TOK_BIT_AND, TOK_BIT_OR, TOK_BIT_XOR, + TOK_BIT_NEG, TOK_LPAR, TOK_RPAR, TOK_LBRA, TOK_RBRA, TOK_LCURL, TOK_RCURL, TOK_MUL, TOK_PLUS, TOK_MINUS, TOK_NEG, TOK_DIV, TOK_CAT, TOK_COLON, TOK_DOT, TOK_COMMA, TOK_SEMI, TOK_ASSIGN, TOK_LT, TOK_LTE, TOK_EQ, TOK_NEQ, TOK_GT, TOK_GTE, TOK_IF, TOK_ELSIF, TOK_ELSE, TOK_FOR, TOK_FOREACH, TOK_WHILE, TOK_RETURN, TOK_BREAK, TOK_CONTINUE, TOK_FUNC, TOK_SYMBOL, TOK_LITERAL, TOK_EMPTY, TOK_NIL, TOK_ELLIPSIS, TOK_QUESTION, TOK_VAR, - TOK_PLUSEQ, TOK_MINUSEQ, TOK_MULEQ, TOK_DIVEQ, TOK_CATEQ, - TOK_FORINDEX + TOK_PLUSEQ, TOK_MINUSEQ, TOK_MULEQ, TOK_DIVEQ, TOK_CATEQ, TOK_BIT_ANDEQ, + TOK_BIT_OREQ, TOK_BIT_XOREQ, TOK_FORINDEX }; // Precedence rules enum { PREC_BINARY=1, PREC_REVERSE, PREC_PREFIX, PREC_SUFFIX }; struct Token { - int type; + enum tok type; int line; char* str; int strlen; int rule; double num; - struct Token* parent; struct Token* next; struct Token* prev; struct Token* children; @@ -64,7 +64,7 @@ struct Parser { // Computed line number table for the lexer int* lines; int nLines; - + struct CodeGenerator* cg; }; @@ -81,6 +81,11 @@ struct CodeGenerator { int nLineIps; // number of pairs int nextLineIp; + int* argSyms; + int* optArgSyms; + int* optArgVals; + naRef restArgSym; + // Stack of "loop" frames for break/continue statements struct { int breakIP;