diff options
Diffstat (limited to 'g.peg')
-rw-r--r-- | g.peg | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -10,7 +10,7 @@ static const char *dbg_str[] = { "Evaluating rule", "Matched rule", "Abandoning fprintf(stderr, "%*s%s %s @%zu [%.*s]\n", (int)((level) * 2), "", dbg_str[event], rule, pos, (int)(length), buffer) #endif - +#define PCC_GETCHAR(auxil) fgetc(auxil) } @@ -22,6 +22,7 @@ static const char *dbg_str[] = { "Evaluating rule", "Matched rule", "Abandoning } %value "AstNode" +%auxil "FILE *" expr <- l:list { $$ = l; } @@ -36,8 +37,8 @@ list <- { $$ = astnode_new_list(); } ')' _ number <- < [0-9]+ > (! ident_char) _ { $$ = astnode_new_num(atoi($1)); } -ident <- < ident_char+ > _ { $$ = astnode_new_ident(strdup($1)); } -string <- '"' < [^"]* > '"' _ { $$ = astnode_new_string(strdup($1)); } +ident <- < ident_char+ > _ { $$ = astnode_new_ident($1); } +string <- '"' < [^"]* > '"' _ { $$ = astnode_new_string($1); } ident_char <- [-_a-zA-Z'+*/\\%=0-9<>] _ <- [ \t\n]* |