-
-
Notifications
You must be signed in to change notification settings - Fork 589
/
grammar.pp
33 lines (27 loc) · 954 Bytes
/
grammar.pp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
%skip whitespace \s+
%token parenthesis_ <
%token _parenthesis >
%token empty_string ""|''
%token number (\+|\-)?(0|[1-9]\d*)(\.\d+)?
%token comma ,
%token name (?:[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*\\)*[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*
%token quote_ " -> quoted_string
%token quoted_string:quoted_string [^"]+
%token quoted_string:_quote " -> default
%token apostrophe_ ' -> apostrophed_string
%token apostrophed_string:apostrophed_string [^']+
%token apostrophed_string:_apostrophe ' -> default
type:
simple_type() | compound_type()
#simple_type:
<name>
| <number>
| <empty_string>
| ::quote_:: <quoted_string> ::_quote::
| ::apostrophe_:: <apostrophed_string> ::_apostrophe::
#compound_type:
<name>
::parenthesis_::
type()
( ::comma:: type() )*
::_parenthesis::