X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-psi;a=blobdiff_plain;f=src%2Fparser.re;h=08478bcd3659e63699904dddd3a1bc3ed8a2c557;hp=831b218757c108e571c646ee05a17e4682b9514d;hb=ea0162a1698563a49de50456cd3f2cc18b83a05e;hpb=469fe3395cb9696e32bcd64639f22113d8fb2ec6 diff --git a/src/parser.re b/src/parser.re index 831b218..08478bc 100644 --- a/src/parser.re +++ b/src/parser.re @@ -30,8 +30,8 @@ PSI_Parser *PSI_ParserInit(PSI_Parser *P, const char *filename, psi_error_cb err } memset(P, 0, sizeof(*P)); + P->psi.file.fn = strdup(filename); P->fp = fp; - P->fn = strdup(filename); P->line = 1; P->error = error; P->flags = flags; @@ -144,21 +144,6 @@ void PSI_ParserFree(PSI_Parser **P) return t; \ } while(1) -/* DIGIT = [0-9] - DIGITS = DIGIT+ - DECIMALS = (+|-)? DIGIT* "." - digits ::= digits DIGIT. - decimals ::= digits DOT digits. - decimals ::= DOT digits. - decimals ::= digits DOT. - number ::= digits. - number ::= PLUS digits. - number ::= MINUS digits. - number ::= decimals. - number ::= MINUS decimals. - number ::= PLUS decimals. - -*/ token_t PSI_ParserScan(PSI_Parser *P) { for (;;) { @@ -179,7 +164,7 @@ token_t PSI_ParserScan(PSI_Parser *P) QUOTED_STRING = "\"" ([^\"])+ "\""; NUMBER = [+-]? [0-9]* "."? [0-9]+ ([eE] [+-]? [0-9]+)?; - "#" .* "\n" { ++P->line; RETURN(PSI_T_COMMENT);} + ("#"|"//") .* "\n" { ++P->line; continue;} "(" {RETURN(PSI_T_LPAREN);} ")" {RETURN(PSI_T_RPAREN);} ";" {RETURN(PSI_T_EOS);} @@ -212,6 +197,7 @@ token_t PSI_ParserScan(PSI_Parser *P) 'UINT32_T' {RETURN(PSI_T_UINT32);} 'INT64_T' {RETURN(PSI_T_INT64);} 'UINT64_T' {RETURN(PSI_T_UINT64);} + 'UNSIGNED' {RETURN(PSI_T_UNSIGNED);} 'STRING' {RETURN(PSI_T_STRING);} 'ARRAY' {RETURN(PSI_T_ARRAY);} 'FUNCTION' {RETURN(PSI_T_FUNCTION);}