forked from scikit-hep/awkward
-
Notifications
You must be signed in to change notification settings - Fork 0
/
grammar.lark
73 lines (67 loc) · 2.07 KB
/
grammar.lark
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
start: input
input: record
| unknown
| primitive
| optiontype
| regular
| listtype
| uniontype
| predefined_typestr
| categories
record: record_tuple
| record_tuple_param
| record_dict
| record_struct
| record_highlevel
primitive: TYPE [options]
unknown: "unknown" [options]
optiontype: option_single
| option_parm
| option_highlevel
regular: regular_inparm
| regular_outparm
listtype: list_single
| list_parm
uniontype: union_single
| union_parm
categories: "categorical" "[" "type" "=" input "]"
predefined_typestr: HARDCODED
HARDCODED: "string"
| "char"
| "bytes"
| "byte"
option_single: "?" input [options]
option_parm: "option" "[" input "," def_option "]"
option_highlevel: "option" "[" input "]"
union_single: "union" "[" input [ "," input]* "]"
union_parm: "union" "[" input [ "," input]* "," def_option "]"
list_parm: "[" "var" "*" input "," def_option "]"
list_single: "var" "*" input
record_tuple: "(" input ["," input]* ")"
record_tuple_param: "tuple" "[" "[" input ["," input]* "]" "," def_option "]"
record_dict: "{" string ":" input ["," string ":" input]* "}"
record_struct: "struct" "[" "[" string ["," string]* "]" "," "[" input ["," input]* "]" "," def_option "]"
record_highlevel: UNQUOTED_STRING "[" string ":" input ["," string ":" input]* "]"
regular_inparm: number "*" input
regular_outparm: "[" number "*" input "," def_option "]"
options: "[" def_option "]"
def_option: "parameters" "=" dict_obj
TYPE: "int64"
| "int32"
| "float64"
?json: dict_obj
| list_obj
| string
| number
| "true" -> true
| "false" -> false
| "null" -> null
list_obj: "[" [json ("," json)*] "]"
dict_obj: "{" [pair ("," pair)*] "}"
pair: string ":" json
string: /((?:"(?:[^"\n\r\\]|(?:\\u[0-9a-fA-F]{4})|(?:\\["bfnrt]))*")|(?:\\\'(?:[^\\\'\n\r\\]|(?:\\u[0-9a-fA-F]{4})|(?:\\[\'bfnrt]))*")*\\\')/
UNQUOTED_STRING.-1: /[a-zA-Z]+/
number: SIGNED_NUMBER
%import common.SIGNED_NUMBER
%import common.WS
%ignore WS