Skip to content

Commit

Permalink
Minor LARK changes (#39)
Browse files Browse the repository at this point in the history
* Include punct in suffix_id

* Lark empty comment

* Escaped braces should be strings

---------

Co-authored-by: Amanda Tang <[email protected]>
  • Loading branch information
amanda849 and Amanda Tang authored Oct 1, 2024
1 parent 5dc2b35 commit 02ecdf3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions mlir/dialect.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ def make_rules(cls):
for fname, ftype in sfields:
syntax = syntax.replace('{%s.%s}' % (fname, ftype), ftype)
# Replace back braces
syntax = syntax.replace('{LBRACE}', '{')
syntax = syntax.replace('{RBRACE}', '}')
syntax = syntax.replace('{LBRACE}', '"{"')
syntax = syntax.replace('{RBRACE}', '"}"')
lark_exprs.append(syntax)

cls._fields_ = list(fields)
Expand Down
4 changes: 2 additions & 2 deletions mlir/lark/mlir.lark
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ constant_literal : bool_literal | integer_literal | float_literal | string_liter

// Identifier syntax
bare_id : (letter| underscore) (letter|digit|underscore|id_chars)*
suffix_id : digits | bare_id
suffix_id : digits | ((letter | id_punct) (letter | id_punct | digits)*)

// Dimensions
dimension : "?" | decimal_literal
Expand Down Expand Up @@ -335,5 +335,5 @@ mlir_file: definition_and_function_list* -> only_functions_and_definitions
// Things to ignore: whitespace, single-line comments
%ignore WS

COMMENT : "//" /(.)+/ NEWLINE
COMMENT : "//" /(.)*/ NEWLINE
%ignore COMMENT

0 comments on commit 02ecdf3

Please sign in to comment.