From c83618999227adb5e745f92205bd48e076e2d124 Mon Sep 17 00:00:00 2001 From: ubq323 Date: Sat, 29 Jul 2023 22:22:23 +0100 Subject: th --- grammar.peg | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'grammar.peg') diff --git a/grammar.peg b/grammar.peg index 5d1dad8..c74c6f6 100644 --- a/grammar.peg +++ b/grammar.peg @@ -3,11 +3,21 @@ #include #include +/* +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]* -- cgit v1.2.3