summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorubq323 <ubq323@ubq323.website>2023-07-11 02:06:59 +0100
committerubq323 <ubq323@ubq323.website>2023-07-11 02:06:59 +0100
commitd9eb793ad606fd47d17a17af24b78b46f2180f84 (patch)
tree14d943dc1a226a187b20285ea53828f72b251e42
parent1e19e4c6e052909bf76a30b26f63dcf32576e994 (diff)
allow more characters in symbols
-rw-r--r--ast.c1
-rw-r--r--grammar.peg6
2 files changed, 3 insertions, 4 deletions
diff --git a/ast.c b/ast.c
index 7474d45..ee2f0ab 100644
--- a/ast.c
+++ b/ast.c
@@ -74,5 +74,4 @@ void astnode_disp(AstNode *a) {
printf("s:%s ",a->as.str);
break;
}
-
}
diff --git a/grammar.peg b/grammar.peg
index 9b8e882..12847e5 100644
--- a/grammar.peg
+++ b/grammar.peg
@@ -22,10 +22,10 @@ list <- { $$ = astnode_new_list(); }
)*
')' _
-number <- < [0-9]+ > _ { $$ = astnode_new_num(atoi($1)); }
-symbol <- < [a-z]+ > _ { $$ = astnode_new_symbol(strdup($1)); }
-
+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]*
%%