X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Usermode%2FLibraries%2Flibspiderscript.so_src%2Flex.c;h=fd395e0f2d188f07a65473ceaea20184630c7555;hb=270e5fe88b0666021a7a6393334db7feeb8245f8;hp=88437aa6ceea88a7460830285799550a8443b630;hpb=86f49ede5038704ac4f12eab9794e9a8110a4985;p=tpg%2Facess2.git diff --git a/Usermode/Libraries/libspiderscript.so_src/lex.c b/Usermode/Libraries/libspiderscript.so_src/lex.c index 88437aa6..fd395e0f 100644 --- a/Usermode/Libraries/libspiderscript.so_src/lex.c +++ b/Usermode/Libraries/libspiderscript.so_src/lex.c @@ -7,6 +7,8 @@ #include #include +// Make the scope character ('.') be a symbol, otherwise it's just +// a ident character #define USE_SCOPE_CHAR 0 #define DEBUG 0 @@ -134,6 +136,33 @@ int GetToken(tParser *File) case '\0': ret = TOK_EOF; break; // Operations + case '^': + if( *File->CurPos == '^' ) { + File->CurPos ++; + ret = TOK_LOGICXOR; + break; + } + ret = TOK_XOR; + break; + + case '|': + if( *File->CurPos == '|' ) { + File->CurPos ++; + ret = TOK_LOGICOR; + break; + } + ret = TOK_OR; + break; + + case '&': + if( *File->CurPos == '&' ) { + File->CurPos ++; + ret = TOK_LOGICAND; + break; + } + ret = TOK_AND; + break; + case '/': ret = TOK_DIV; break; case '*': ret = TOK_MUL; break; case '+': ret = TOK_PLUS; break; @@ -200,11 +229,23 @@ int GetToken(tParser *File) // Default (Numbers and Identifiers) default: File->CurPos --; + // Numbers if( isdigit(*File->CurPos) ) { - while( isdigit(*File->CurPos) ) - File->CurPos ++; + if( *File->CurPos == '0' && File->CurPos[1] == 'x' ) { + File->CurPos += 2; + while(('0' <= *File->CurPos && *File->CurPos <= '9') + || ('A' <= *File->CurPos && *File->CurPos <= 'F') + || ('a' <= *File->CurPos && *File->CurPos <= 'f') ) + { + File->CurPos ++; + } + } + else { + while( isdigit(*File->CurPos) ) + File->CurPos ++; + } ret = TOK_INTEGER; break; }