Skip to content

Commit 08ec2a8

Browse files
author
Killian Perlin
committed
fix parser errors
the new keywords 'add', 'del', and 'rewrite' caused some tests involving these identifiers to fail the solution was, similarly to the abstract keyword in libadalang, to use an exact identifier match in the nanopass parser and remove the keywords from the lexer
1 parent 9ee42c3 commit 08ec2a8

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

lkql/lkql.lkt

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,6 @@ lexer lkql_lexer {
6363
@symbol() New <- "new"
6464
@symbol() Class <- "class"
6565
@symbol() Pass <- "pass"
66-
@symbol() Del <- "del"
67-
@symbol() Add <- "add"
68-
@symbol() Rewrite <- "rewrite"
6966
@symbol() RunPass <- "run_pass"
7067
Integer <- p"[0-9]+"
7168
@symbol() Identifier <- p"[a-z][A-Za-z0-9_]*"
@@ -292,9 +289,9 @@ grammar lkql_grammar {
292289
))
293290
"}" )
294291
prefix_field <- DotAccess(upper_id "." id)
295-
pass_del_block <- DelBlock("del" "{" list*(or(prefix_field | Identifier(@UpperIdentifier))) "}")
296-
pass_add_block <- AddBlock("add" "{" list*(or(prefix_field_decl | class_decl)) "}")
297-
pass_rewrite_block <- RewriteBlock("rewrite" "{" list*(match_arm) "}")
292+
pass_del_block <- DelBlock(@Identifier("del") "{" list*(or(prefix_field | Identifier(@UpperIdentifier))) "}")
293+
pass_add_block <- AddBlock(@Identifier("add") "{" list*(or(prefix_field_decl | class_decl)) "}")
294+
pass_rewrite_block <- RewriteBlock(@Identifier("rewrite") "{" list*(match_arm) "}")
298295
prefix_field_decl <- PrefixField(upper_id "." id ":" upper_id)
299296
class_field <- ClassField(id ":" upper_id)
300297
class_decl <- ClassDecl(

0 commit comments

Comments
 (0)