-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcpp.json
78 lines (77 loc) · 3.7 KB
/
cpp.json
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
73
74
75
76
77
78
{
"name": "C++",
"ext": "cpp",
"tokenable": "^(\"|#|[:;{}=;]|<<|>>|::|\\.|,|[()]|[<>+\\-*/]|\\+=|[0-9]+|[a-zA-Z_][a-zA-Z_0-9]*)$",
"syntax": {
"exp": [
[{ "name": "bracket_closed", "rule": "({{a-exp}})" }],
[{ "name": "method_call", "rule": "{{obj-exp}}.{{function-ident}}({{args-exp_multi}})" }],
[{ "name": "function_call", "rule": "{{function-ident}}({{args-exp_multi}})" }],
[
{ "name": "greater", "rule": "{{1-exp}} < {{2-exp}}" },
{ "name": "lesser", "rule": "{{1-exp}} > {{2-exp}}" }
],
[
{ "name": "left_shift", "rule": "{{1-exp}} << {{2-exp}}" },
{ "name": "right_shift", "rule": "{{1-exp}} >> {{2-exp}}" }
],
[
{ "name": "plus", "rule": "{{1-exp}} + {{2-exp}}" },
{ "name": "minus", "rule": "{{1-exp}} - {{2-exp}}" }
],
[
{ "name": "multiply", "rule": "{{1-exp}} * {{2-exp}}" },
{ "name": "divide", "rule": "{{1-exp}} / {{2-exp}}" }
],
[{ "name": "member", "rule": "{{obj-exp}}.{{member-ident}}" }],
[{ "name": "context_member", "rule": "{{context-ident}}::{{member-exp}}" }],
[{ "name": "ident", "rule": "{{a-ident}}" }]
],
"exp_multi": [
[{ "name": "single", "rule": "{{a-exp}}" }],
[{ "name": "recursive", "rule": "{{1-exp}}, {{2-exp_multi}}" }]
],
"type": [
[{ "name": "integer", "rule": "int" }],
[{ "name": "normal_type", "rule": "{{t-ident}}" }],
[{ "name": "const", "rule": "const {{t-type}}" }],
[{ "name": "const", "rule": "{{t-type}} const" }],
[{ "name": "context", "rule": "{{super-type}}::{{child-type}}" }],
[{ "name": "generics", "rule": "{{t-ident}}<{{args-type_multi}}>" }]
],
"type_multi": [
[{ "name": "single_type", "rule": "{{t-type}}"}],
[{ "name": "single_value", "rule": "{{a-exp}}"}],
[{ "name": "type_recursive", "rule": "{{1-type}}, {{rest-type_multi}}" }]
],
"statement": [
[{ "name": "block", "rule": "{{{a-block}}}" }],
[{ "name": "if", "rule": "if ({{condition-exp}}) { {{a-block}} }" }],
[{ "name": "while", "rule": "while ({{condition-exp}}) { {{a-block}} }" }],
[{ "name": "for", "rule": "for ({{t-type}} {{iterator-ident}} : {{range-exp}}) { {{a-block}} }" }],
[{ "name": "none", "rule": ";" }],
[{ "name": "expression", "rule": "{{a-exp}};"}],
[{ "name": "declaration_and_init", "rule": "{{t-type}} {{name-ident}} = {{a-exp}};" }],
[{ "name": "declaration", "rule": "{{t-type}} {{name-ident}};" }]
],
"block": [
[{ "name": "none", "rule": "" }],
[{ "name": "recursive", "rule": "{{1-statement}} {{rest-block}}" }],
[{ "name": "single", "rule": "{{1-statement}}" }]
],
"args": [
[{ "name": "none", "rule": "" }],
[{ "name": "single", "rule": "{{t-type}} {{name-ident}}" }],
[{ "name": "recursive", "rule": "{{t-type}} {{name-ident}}, {{rest-args}}" }]
],
"root_statement": [
[{ "name": "entry", "rule": "int main({{args-args}}) { {{a-block}} }" }],
[{ "name": "import", "rule": "#include \"{{name-ident}}.hpp\"", "lf": true, "str": true }]
],
"root": [
[{ "name": "none", "rule": "" }],
[{ "name": "single", "rule": "{{a-root_statement}}" }],
[{ "name": "recursive", "rule": "{{a-root_statement}}{{rest-root}}" }]
]
}
}