simplify parser
authorMichael Wallner <mike@php.net>
Thu, 5 Nov 2015 13:43:38 +0000 (14:43 +0100)
committerMichael Wallner <mike@php.net>
Thu, 5 Nov 2015 13:43:38 +0000 (14:43 +0100)
src/parser.re

index 13d6484fa3682fd9b0176b57d21ec96c6cc595e2..58deda2234e214c6bf4e02a04974edae8bb29b5a 100644 (file)
@@ -177,50 +177,6 @@ token_t PSI_ParserScan(PSI_Parser *P)
                NAME = [a-zA-Z_]W*;
                NSNAME = (NAME)? ("\\" NAME)+;
                QUOTED_STRING = "\"" ([^\"])+ "\"";
-               TRUE = 'TRUE';
-               FALSE = 'FALSE';
-               NULL = 'NULL';
-               MIXED = 'mixed';
-               VOID = 'void';
-               BOOL = 'bool';
-               CHAR = 'char';
-               SHORT = 'short';
-               INT = 'int';
-               LONG = 'long';
-               FLOAT = 'float';
-               DOUBLE = 'double';
-               SIZE_T = 'size_t';
-               SINT8 = 'sint8';
-               UINT8 = 'uint8';
-               SINT16 = 'sint16';
-               UINT16 = 'uint16';
-               SINT32 = 'sint32';
-               UINT32 = 'uint32';
-               SINT64 = 'sint64';
-               UINT64 = 'uint64';
-               STRING = 'string';
-               ARRAY = 'array';
-               FUNCTION = 'function';
-               TYPEDEF = 'typedef';
-               STRUCT = 'struct';
-               CONST = 'const';
-               LIB = 'lib';
-               LET = 'let';
-               SET = 'set';
-               RETURN = 'return';
-               FREE = 'free';
-               STRLEN = 'strlen';
-               STRVAL = 'strval';
-               INTVAL = 'intval';
-               FLOATVAL = 'floatval';
-               BOOLVAL = 'boolval';
-               ARRVAL = 'arrval';
-               CALLOC = 'calloc';
-               TO_ARRAY = 'to_array';
-               TO_STRING = 'to_string';
-               TO_INT = 'to_int';
-               TO_FLOAT = 'to_float';
-               TO_BOOL = 'to_bool';
                NUMBER = [+-]? [0-9]* "."? [0-9]+ ([eE] [+-]? [0-9]+)?;
 
                "#" .* "\n" { ++P->line; RETURN(PSI_T_COMMENT);}
@@ -239,50 +195,50 @@ token_t PSI_ParserScan(PSI_Parser *P)
                "&" {RETURN(PSI_T_REFERENCE);}
                [\r\n] { ++P->line; continue; }
                [\t ]+ { continue; }
-               TRUE {RETURN(PSI_T_TRUE);}
-               FALSE {RETURN(PSI_T_FALSE);}
-               NULL {RETURN(PSI_T_NULL);}
-               MIXED {RETURN(PSI_T_MIXED);}
-               VOID {RETURN(PSI_T_VOID);}
-               BOOL {RETURN(PSI_T_BOOL);}
-               CHAR {RETURN(PSI_T_CHAR);}
-               SHORT {RETURN(PSI_T_SHORT);}
-               INT {RETURN(PSI_T_INT);}
-               LONG {RETURN(PSI_T_LONG);}
-               FLOAT {RETURN(PSI_T_FLOAT);}
-               DOUBLE {RETURN(PSI_T_DOUBLE);}
-               SIZE_T {RETURN(PSI_T_SIZE_T);}
-               SINT8 {RETURN(PSI_T_SINT8);}
-               UINT8 {RETURN(PSI_T_UINT8);}
-               SINT16 {RETURN(PSI_T_SINT16);}
-               UINT16 {RETURN(PSI_T_UINT16);}
-               SINT32 {RETURN(PSI_T_SINT32);}
-               UINT32 {RETURN(PSI_T_UINT32);}
-               SINT64 {RETURN(PSI_T_SINT64);}
-               UINT64 {RETURN(PSI_T_UINT64);}
-               STRING {RETURN(PSI_T_STRING);}
-               ARRAY {RETURN(PSI_T_ARRAY);}
-               FUNCTION {RETURN(PSI_T_FUNCTION);}
-               TYPEDEF {RETURN(PSI_T_TYPEDEF);}
-               STRUCT {RETURN(PSI_T_STRUCT);}
-               CONST {RETURN(PSI_T_CONST);}
-               LIB {RETURN(PSI_T_LIB);}
-               LET {RETURN(PSI_T_LET);}
-               SET {RETURN(PSI_T_SET);}
-               RETURN {RETURN(PSI_T_RETURN);}
-               FREE {RETURN(PSI_T_FREE);}
-               STRLEN {RETURN(PSI_T_STRLEN);}
-               STRVAL {RETURN(PSI_T_STRVAL);}
-               INTVAL {RETURN(PSI_T_INTVAL);}
-               FLOATVAL {RETURN(PSI_T_FLOATVAL);}
-               BOOLVAL {RETURN(PSI_T_BOOLVAL);}
-               ARRVAL {RETURN(PSI_T_ARRVAL);}
-               CALLOC {RETURN(PSI_T_CALLOC);}
-               TO_ARRAY {RETURN(PSI_T_TO_ARRAY);}
-               TO_STRING {RETURN(PSI_T_TO_STRING);}
-               TO_INT {RETURN(PSI_T_TO_INT);}
-               TO_FLOAT {RETURN(PSI_T_TO_FLOAT);}
-               TO_BOOL {RETURN(PSI_T_TO_BOOL);}
+               'TRUE' {RETURN(PSI_T_TRUE);}
+               'FALSE' {RETURN(PSI_T_FALSE);}
+               'NULL' {RETURN(PSI_T_NULL);}
+               'MIXED' {RETURN(PSI_T_MIXED);}
+               'VOID' {RETURN(PSI_T_VOID);}
+               'BOOL' {RETURN(PSI_T_BOOL);}
+               'CHAR' {RETURN(PSI_T_CHAR);}
+               'SHORT' {RETURN(PSI_T_SHORT);}
+               'INT' {RETURN(PSI_T_INT);}
+               'LONG' {RETURN(PSI_T_LONG);}
+               'FLOAT' {RETURN(PSI_T_FLOAT);}
+               'DOUBLE' {RETURN(PSI_T_DOUBLE);}
+               'SIZE_T' {RETURN(PSI_T_SIZE_T);}
+               'SINT8' {RETURN(PSI_T_SINT8);}
+               'UINT8' {RETURN(PSI_T_UINT8);}
+               'SINT16' {RETURN(PSI_T_SINT16);}
+               'UINT16' {RETURN(PSI_T_UINT16);}
+               'SINT32' {RETURN(PSI_T_SINT32);}
+               'UINT32' {RETURN(PSI_T_UINT32);}
+               'SINT64' {RETURN(PSI_T_SINT64);}
+               'UINT64' {RETURN(PSI_T_UINT64);}
+               'STRING' {RETURN(PSI_T_STRING);}
+               'ARRAY' {RETURN(PSI_T_ARRAY);}
+               'FUNCTION' {RETURN(PSI_T_FUNCTION);}
+               'TYPEDEF' {RETURN(PSI_T_TYPEDEF);}
+               'STRUCT' {RETURN(PSI_T_STRUCT);}
+               'CONST' {RETURN(PSI_T_CONST);}
+               'LIB' {RETURN(PSI_T_LIB);}
+               'LET' {RETURN(PSI_T_LET);}
+               'SET' {RETURN(PSI_T_SET);}
+               'RETURN' {RETURN(PSI_T_RETURN);}
+               'FREE' {RETURN(PSI_T_FREE);}
+               'STRLEN' {RETURN(PSI_T_STRLEN);}
+               'STRVAL' {RETURN(PSI_T_STRVAL);}
+               'INTVAL' {RETURN(PSI_T_INTVAL);}
+               'FLOATVAL' {RETURN(PSI_T_FLOATVAL);}
+               'BOOLVAL' {RETURN(PSI_T_BOOLVAL);}
+               'ARRVAL' {RETURN(PSI_T_ARRVAL);}
+               'CALLOC' {RETURN(PSI_T_CALLOC);}
+               'TO_ARRAY' {RETURN(PSI_T_TO_ARRAY);}
+               'TO_STRING' {RETURN(PSI_T_TO_STRING);}
+               'TO_INT' {RETURN(PSI_T_TO_INT);}
+               'TO_FLOAT' {RETURN(PSI_T_TO_FLOAT);}
+               'TO_BOOL' {RETURN(PSI_T_TO_BOOL);}
                NUMBER {RETURN(PSI_T_NUMBER);}
                NAME {RETURN(PSI_T_NAME);}
                NSNAME {RETURN(PSI_T_NSNAME);}