summaryrefslogtreecommitdiff
path: root/grammar.peg
diff options
context:
space:
mode:
authorubq323 <ubq323@ubq323.website>2023-07-29 22:22:23 +0100
committerubq323 <ubq323@ubq323.website>2023-07-29 22:22:23 +0100
commitc83618999227adb5e745f92205bd48e076e2d124 (patch)
treeebd862d08180fb49bdec90b553b21c89c43467fb /grammar.peg
parentf9f7b92fdda17efe2dca455d6f641a424a97b2db (diff)
th
Diffstat (limited to 'grammar.peg')
-rw-r--r--grammar.peg12
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]*