From d8b50976ce7fd4a44ba9172d69e8ae4ca6cab596 Mon Sep 17 00:00:00 2001 From: ubq323 Date: Fri, 4 Aug 2023 00:06:05 +0100 Subject: add string object values. you can't do anything with them yet --- g.peg | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'g.peg') diff --git a/g.peg b/g.peg index 552d76f..c026e62 100644 --- a/g.peg +++ b/g.peg @@ -3,13 +3,15 @@ #include #include -/* + +#ifdef DO_PARSE_DEBUG static const char *dbg_str[] = { "Evaluating rule", "Matched rule", "Abandoning rule" }; #define PCC_DEBUG(auxil, event, rule, level, pos, buffer, length) \ fprintf(stderr, "%*s%s %s @%zu [%.*s]\n", (int)((level) * 2), "", dbg_str[event], rule, pos, (int)(length), buffer) +#endif + -*/ } @@ -35,7 +37,7 @@ 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)); } +string <- '"' < [^"]+ > '"' _ { $$ = astnode_new_string(strdup($1)); } ident_char <- [-_a-zA-Z'+*0-9] _ <- [ \t\n]* -- cgit v1.2.3