diff options
author | ubq323 <ubq323@ubq323.website> | 2023-07-29 22:22:23 +0100 |
---|---|---|
committer | ubq323 <ubq323@ubq323.website> | 2023-07-29 22:22:23 +0100 |
commit | c83618999227adb5e745f92205bd48e076e2d124 (patch) | |
tree | ebd862d08180fb49bdec90b553b21c89c43467fb /grammar.peg | |
parent | f9f7b92fdda17efe2dca455d6f641a424a97b2db (diff) |
th
Diffstat (limited to 'grammar.peg')
-rw-r--r-- | grammar.peg | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/grammar.peg b/grammar.peg index 5d1dad8..c74c6f6 100644 --- a/grammar.peg +++ b/grammar.peg @@ -3,11 +3,21 @@ #include <stdlib.h> #include <string.h> +/* +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) + + +*/ } + + %common { #include "ast.h" #include "run.h" + } %value "AstNode" @@ -27,6 +37,6 @@ number <- < [0-9]+ > (! ident_char) _ { $$ = astnode_new_num(atoi($1)); } symbol <- < ident_char+ > _ { $$ = astnode_new_symbol(strdup($1)); } ident_char <- [-_a-zA-Z'+*0-9] -_ <- [ \t]* +_ <- [ \t\n]* |