Move file. Small fix.
This commit is contained in:
parent
9faa5770a8
commit
03cc568516
5 changed files with 41 additions and 6 deletions
28
concrete_syntax/textual_cd/parser.py
Normal file
28
concrete_syntax/textual_cd/parser.py
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
grammar = r"""
|
||||
%import common.WS_INLINE
|
||||
%ignore WS_INLINE
|
||||
%ignore COMMENT
|
||||
|
||||
%declare _INDENT _DEDENT
|
||||
|
||||
?start: (_NL | object )*
|
||||
|
||||
IDENTIFIER: /[A-Za-z_][A-Za-z_0-9]*/
|
||||
COMMENT: /#.*/
|
||||
|
||||
# newline
|
||||
_NL: /(\r?\n[\t ]*)+/
|
||||
|
||||
literal: INT
|
||||
| STR
|
||||
| BOOL
|
||||
|
||||
INT: /[0-9]+/
|
||||
STR: /"[^"]*"/
|
||||
| /'[^']*'/
|
||||
BOOL: "True" | "False"
|
||||
|
||||
object: [IDENTIFIER] ":" IDENTIFIER [link] _NL [_INDENT slot+ _DEDENT]
|
||||
link: "(" IDENTIFIER "->" IDENTIFIER ")"
|
||||
slot: IDENTIFIER "=" literal _NL
|
||||
"""
|
||||
Loading…
Add table
Add a link
Reference in a new issue