grammar-well 1.3.3 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (261) hide show
  1. package/README.md +76 -560
  2. package/build/generator/artifacts/basic.d.ts +7 -0
  3. package/build/generator/artifacts/basic.js +24 -0
  4. package/build/generator/artifacts/basic.js.map +1 -0
  5. package/build/generator/artifacts/lexer.d.ts +13 -0
  6. package/build/generator/artifacts/lexer.js +204 -0
  7. package/build/generator/artifacts/lexer.js.map +1 -0
  8. package/build/{compiler/generator → generator}/artifacts/lr.d.ts +14 -14
  9. package/build/{compiler/generator → generator}/artifacts/lr.js +18 -22
  10. package/build/generator/artifacts/lr.js.map +1 -0
  11. package/build/generator/builtin/json.d.ts +183 -0
  12. package/build/generator/builtin/json.js +124 -0
  13. package/build/generator/builtin/json.js.map +1 -0
  14. package/build/generator/builtin/registry.json +1 -0
  15. package/build/generator/builtin/whitespace.d.ts +61 -0
  16. package/build/generator/builtin/whitespace.js +37 -0
  17. package/build/generator/builtin/whitespace.js.map +1 -0
  18. package/build/generator/generator.d.ts +38 -0
  19. package/build/generator/generator.js +368 -0
  20. package/build/generator/generator.js.map +1 -0
  21. package/build/generator/grammars/index.d.ts +2 -0
  22. package/build/generator/grammars/index.js +3 -0
  23. package/build/generator/grammars/index.js.map +1 -0
  24. package/build/generator/grammars/v1.d.ts +1190 -0
  25. package/build/generator/grammars/v1.js +614 -0
  26. package/build/generator/grammars/v1.js.map +1 -0
  27. package/build/generator/grammars/v2.d.ts +1367 -0
  28. package/build/generator/grammars/v2.js +695 -0
  29. package/build/generator/grammars/v2.js.map +1 -0
  30. package/build/generator/import-resolvers/auto.d.ts +2 -0
  31. package/build/generator/import-resolvers/auto.js +11 -0
  32. package/build/generator/import-resolvers/auto.js.map +1 -0
  33. package/build/generator/import-resolvers/browser.d.ts +7 -0
  34. package/build/generator/import-resolvers/browser.js +13 -0
  35. package/build/generator/import-resolvers/browser.js.map +1 -0
  36. package/build/generator/import-resolvers/default.d.ts +2 -0
  37. package/build/generator/import-resolvers/default.js +11 -0
  38. package/build/generator/import-resolvers/default.js.map +1 -0
  39. package/build/generator/import-resolvers/filesystem.d.ts +7 -0
  40. package/build/generator/import-resolvers/filesystem.js +15 -0
  41. package/build/generator/import-resolvers/filesystem.js.map +1 -0
  42. package/build/generator/index.d.ts +3 -0
  43. package/build/generator/index.js +4 -0
  44. package/build/generator/index.js.map +1 -0
  45. package/build/generator/state.d.ts +28 -0
  46. package/build/generator/state.js +73 -0
  47. package/build/generator/state.js.map +1 -0
  48. package/build/generator/stringify/common.d.ts +22 -0
  49. package/build/generator/stringify/common.js +83 -0
  50. package/build/generator/stringify/common.js.map +1 -0
  51. package/build/generator/stringify/exports/javascript.d.ts +3 -0
  52. package/build/generator/stringify/exports/javascript.js +26 -0
  53. package/build/generator/stringify/exports/javascript.js.map +1 -0
  54. package/build/generator/stringify/exports/json.d.ts +2 -0
  55. package/build/generator/stringify/exports/json.js +4 -0
  56. package/build/generator/stringify/exports/json.js.map +1 -0
  57. package/build/generator/stringify/exports/registry.d.ts +20 -0
  58. package/build/generator/stringify/exports/registry.js +17 -0
  59. package/build/generator/stringify/exports/registry.js.map +1 -0
  60. package/build/generator/stringify/exports/typescript.d.ts +2 -0
  61. package/build/generator/stringify/exports/typescript.js +16 -0
  62. package/build/generator/stringify/exports/typescript.js.map +1 -0
  63. package/build/generator/stringify/grammar/v2.d.ts +20 -0
  64. package/build/generator/stringify/grammar/v2.js +211 -0
  65. package/build/generator/stringify/grammar/v2.js.map +1 -0
  66. package/build/generator/stringify/javascript.d.ts +13 -0
  67. package/build/generator/stringify/javascript.js +83 -0
  68. package/build/generator/stringify/javascript.js.map +1 -0
  69. package/build/index.d.ts +7 -6
  70. package/build/index.js +7 -24
  71. package/build/index.js.map +1 -1
  72. package/build/lexers/character-lexer.d.ts +2 -2
  73. package/build/lexers/character-lexer.js +1 -5
  74. package/build/lexers/character-lexer.js.map +1 -1
  75. package/build/lexers/stateful-lexer.d.ts +12 -17
  76. package/build/lexers/stateful-lexer.js +38 -186
  77. package/build/lexers/stateful-lexer.js.map +1 -1
  78. package/build/lexers/token-buffer.d.ts +8 -8
  79. package/build/lexers/token-buffer.js +1 -5
  80. package/build/lexers/token-buffer.js.map +1 -1
  81. package/build/parser/algorithms/cyk.d.ts +6 -6
  82. package/build/parser/algorithms/cyk.js +10 -13
  83. package/build/parser/algorithms/cyk.js.map +1 -1
  84. package/build/parser/algorithms/earley.d.ts +7 -7
  85. package/build/parser/algorithms/earley.js +7 -11
  86. package/build/parser/algorithms/earley.js.map +1 -1
  87. package/build/parser/algorithms/lrk/algorithm.d.ts +3 -3
  88. package/build/parser/algorithms/lrk/algorithm.js +10 -13
  89. package/build/parser/algorithms/lrk/algorithm.js.map +1 -1
  90. package/build/parser/algorithms/lrk/bimap.js +1 -5
  91. package/build/parser/algorithms/lrk/bimap.js.map +1 -1
  92. package/build/parser/algorithms/lrk/canonical-collection.d.ts +7 -7
  93. package/build/parser/algorithms/lrk/canonical-collection.js +11 -15
  94. package/build/parser/algorithms/lrk/canonical-collection.js.map +1 -1
  95. package/build/parser/algorithms/lrk/closure.d.ts +3 -3
  96. package/build/parser/algorithms/lrk/closure.js +3 -7
  97. package/build/parser/algorithms/lrk/closure.js.map +1 -1
  98. package/build/parser/algorithms/lrk/stack.d.ts +6 -6
  99. package/build/parser/algorithms/lrk/stack.js +1 -5
  100. package/build/parser/algorithms/lrk/stack.js.map +1 -1
  101. package/build/parser/algorithms/lrk/state.d.ts +5 -5
  102. package/build/parser/algorithms/lrk/state.js +1 -2
  103. package/build/parser/parse.d.ts +10 -0
  104. package/build/parser/parse.js +34 -0
  105. package/build/parser/parse.js.map +1 -0
  106. package/build/parser/parser.d.ts +6 -17
  107. package/build/parser/parser.js +26 -42
  108. package/build/parser/parser.js.map +1 -1
  109. package/build/tsconfig.tsbuildinfo +1 -0
  110. package/build/typings/ast.d.ts +134 -0
  111. package/build/typings/ast.js +3 -0
  112. package/build/typings/ast.js.map +1 -0
  113. package/build/typings/common.d.ts +4 -0
  114. package/build/typings/common.js +2 -0
  115. package/build/typings/common.js.map +1 -0
  116. package/build/typings/generator.d.ts +58 -0
  117. package/build/typings/generator.js +3 -0
  118. package/build/typings/generator.js.map +1 -0
  119. package/build/typings/index.d.ts +43 -0
  120. package/build/typings/index.js +5 -0
  121. package/build/typings/index.js.map +1 -0
  122. package/build/typings/runtime.d.ts +70 -0
  123. package/build/typings/runtime.js +2 -0
  124. package/build/typings/runtime.js.map +1 -0
  125. package/build/utility/format.d.ts +1 -0
  126. package/build/utility/format.js +12 -0
  127. package/build/utility/format.js.map +1 -0
  128. package/build/utility/formatter.d.ts +1 -0
  129. package/build/utility/formatter.js +12 -0
  130. package/build/utility/formatter.js.map +1 -0
  131. package/build/utility/general.d.ts +1 -1
  132. package/build/utility/general.js +5 -13
  133. package/build/utility/general.js.map +1 -1
  134. package/build/utility/index.d.ts +4 -1
  135. package/build/utility/index.js +4 -17
  136. package/build/utility/index.js.map +1 -1
  137. package/build/utility/lint.d.ts +2 -2
  138. package/build/utility/lint.js +2 -6
  139. package/build/utility/lint.js.map +1 -1
  140. package/build/utility/migrate.d.ts +1 -0
  141. package/build/utility/migrate.js +10 -0
  142. package/build/utility/migrate.js.map +1 -0
  143. package/build/utility/monarch.d.ts +2 -2
  144. package/build/utility/monarch.js +33 -38
  145. package/build/utility/monarch.js.map +1 -1
  146. package/build/utility/parsing.d.ts +6 -0
  147. package/build/utility/parsing.js +26 -0
  148. package/build/utility/parsing.js.map +1 -0
  149. package/build/utility/text-format.d.ts +6 -6
  150. package/build/utility/text-format.js +2 -6
  151. package/build/utility/text-format.js.map +1 -1
  152. package/package.json +17 -24
  153. package/src/generator/artifacts/basic.ts +26 -0
  154. package/src/generator/artifacts/lexer.ts +228 -0
  155. package/src/{compiler/generator → generator}/artifacts/lr.ts +25 -24
  156. package/src/generator/builtin/character.well +7 -0
  157. package/src/generator/builtin/json.well +85 -0
  158. package/src/generator/builtin/number.well +21 -0
  159. package/src/generator/builtin/registry.json +1 -0
  160. package/src/generator/builtin/string.well +54 -0
  161. package/src/generator/builtin/whitespace.well +16 -0
  162. package/src/generator/generator.ts +401 -0
  163. package/src/generator/grammars/index.ts +2 -0
  164. package/src/generator/grammars/v1.ts +620 -0
  165. package/src/generator/grammars/v1.well +422 -0
  166. package/src/generator/grammars/v2.ts +701 -0
  167. package/src/generator/grammars/v2.well +413 -0
  168. package/src/generator/import-resolvers/auto.ts +12 -0
  169. package/src/generator/import-resolvers/browser.ts +13 -0
  170. package/src/generator/import-resolvers/filesystem.ts +18 -0
  171. package/src/generator/index.ts +3 -0
  172. package/src/generator/state.ts +89 -0
  173. package/src/generator/stringify/common.ts +90 -0
  174. package/src/generator/stringify/exports/javascript.ts +29 -0
  175. package/src/generator/stringify/exports/json.ts +5 -0
  176. package/src/generator/stringify/exports/registry.ts +20 -0
  177. package/src/generator/stringify/exports/typescript.ts +17 -0
  178. package/src/generator/stringify/grammar/v2.ts +223 -0
  179. package/src/generator/stringify/javascript.ts +94 -0
  180. package/src/index.ts +7 -6
  181. package/src/lexers/character-lexer.ts +2 -2
  182. package/src/lexers/stateful-lexer.ts +46 -203
  183. package/src/lexers/token-buffer.ts +3 -3
  184. package/src/parser/algorithms/cyk.ts +13 -12
  185. package/src/parser/algorithms/earley.ts +10 -10
  186. package/src/parser/algorithms/lrk/algorithm.ts +8 -7
  187. package/src/parser/algorithms/lrk/canonical-collection.ts +14 -14
  188. package/src/parser/algorithms/lrk/closure.ts +6 -6
  189. package/src/parser/algorithms/lrk/stack.ts +6 -6
  190. package/src/parser/algorithms/lrk/state.ts +5 -5
  191. package/src/parser/parse.ts +45 -0
  192. package/src/typings/ast.ts +148 -0
  193. package/src/typings/common.ts +2 -0
  194. package/src/typings/generator.ts +62 -0
  195. package/src/typings/index.ts +38 -0
  196. package/src/typings/runtime.ts +82 -0
  197. package/src/utility/format.ts +12 -0
  198. package/src/utility/general.ts +1 -2
  199. package/src/utility/index.ts +4 -1
  200. package/src/utility/lint.ts +5 -5
  201. package/src/utility/monarch.ts +34 -34
  202. package/src/utility/parsing.ts +30 -0
  203. package/src/utility/text-format.ts +7 -7
  204. package/.eslintrc.cjs +0 -14
  205. package/bootstrap.ts +0 -45
  206. package/build/compiler/builtin.json +0 -1
  207. package/build/compiler/compiler.d.ts +0 -50
  208. package/build/compiler/compiler.js +0 -249
  209. package/build/compiler/compiler.js.map +0 -1
  210. package/build/compiler/generator/artifacts/lr.js.map +0 -1
  211. package/build/compiler/generator/artifacts/standard.d.ts +0 -7
  212. package/build/compiler/generator/artifacts/standard.js +0 -28
  213. package/build/compiler/generator/artifacts/standard.js.map +0 -1
  214. package/build/compiler/generator/generator.d.ts +0 -24
  215. package/build/compiler/generator/generator.js +0 -217
  216. package/build/compiler/generator/generator.js.map +0 -1
  217. package/build/compiler/gwell.d.ts +0 -1112
  218. package/build/compiler/gwell.js +0 -576
  219. package/build/compiler/gwell.js.map +0 -1
  220. package/build/compiler/import-resolver.d.ts +0 -15
  221. package/build/compiler/import-resolver.js +0 -37
  222. package/build/compiler/import-resolver.js.map +0 -1
  223. package/build/compiler/index.d.ts +0 -2
  224. package/build/compiler/index.js +0 -19
  225. package/build/compiler/index.js.map +0 -1
  226. package/build/compiler/outputs/javascript.d.ts +0 -3
  227. package/build/compiler/outputs/javascript.js +0 -29
  228. package/build/compiler/outputs/javascript.js.map +0 -1
  229. package/build/compiler/outputs/json.d.ts +0 -2
  230. package/build/compiler/outputs/json.js +0 -8
  231. package/build/compiler/outputs/json.js.map +0 -1
  232. package/build/compiler/outputs/typescript.d.ts +0 -2
  233. package/build/compiler/outputs/typescript.js +0 -21
  234. package/build/compiler/outputs/typescript.js.map +0 -1
  235. package/build/parser/algorithms/lr.d.ts +0 -7
  236. package/build/parser/algorithms/lr.js +0 -108
  237. package/build/parser/algorithms/lr.js.map +0 -5
  238. package/build/parser/algorithms/lr0.d.ts +0 -7
  239. package/build/parser/algorithms/lr0.js +0 -156
  240. package/build/parser/algorithms/lr0.js.map +0 -1
  241. package/build/typings.d.ts +0 -226
  242. package/build/typings.js +0 -3
  243. package/build/typings.js.map +0 -1
  244. package/src/compiler/builtin/json.gwell +0 -74
  245. package/src/compiler/builtin/number.gwell +0 -20
  246. package/src/compiler/builtin/string.gwell +0 -48
  247. package/src/compiler/builtin/whitespace.gwell +0 -10
  248. package/src/compiler/builtin.json +0 -1
  249. package/src/compiler/compiler.ts +0 -265
  250. package/src/compiler/generator/artifacts/standard.ts +0 -26
  251. package/src/compiler/generator/generator.ts +0 -237
  252. package/src/compiler/gwell.gwell +0 -294
  253. package/src/compiler/gwell.js +0 -578
  254. package/src/compiler/import-resolver.ts +0 -36
  255. package/src/compiler/index.ts +0 -2
  256. package/src/compiler/outputs/javascript.ts +0 -27
  257. package/src/compiler/outputs/json.ts +0 -5
  258. package/src/compiler/outputs/typescript.ts +0 -18
  259. package/src/parser/parser.ts +0 -77
  260. package/src/typings.ts +0 -248
  261. package/testing.ts +0 -18
@@ -0,0 +1,614 @@
1
+ class grammar {
2
+ artifacts = {
3
+ grammar: {
4
+ rules: {
5
+ K_ALL: [
6
+ { name: "K_ALL", symbols: [{ literal: "all" }] }
7
+ ],
8
+ K_BEFORE: [
9
+ { name: "K_BEFORE", symbols: [{ literal: "before" }] }
10
+ ],
11
+ K_BODY: [
12
+ { name: "K_BODY", symbols: [{ literal: "body" }] }
13
+ ],
14
+ K_CLOSE: [
15
+ { name: "K_CLOSE", symbols: [{ literal: "close" }] }
16
+ ],
17
+ K_CONFIG: [
18
+ { name: "K_CONFIG", symbols: [{ literal: "config" }] }
19
+ ],
20
+ K_EMBED: [
21
+ { name: "K_EMBED", symbols: [{ literal: "embed" }] }
22
+ ],
23
+ K_FROM: [
24
+ { name: "K_FROM", symbols: [{ literal: "from" }] }
25
+ ],
26
+ K_GOTO: [
27
+ { name: "K_GOTO", symbols: [{ literal: "goto" }] }
28
+ ],
29
+ K_GRAMMAR: [
30
+ { name: "K_GRAMMAR", symbols: [{ literal: "grammar" }] }
31
+ ],
32
+ K_HEAD: [
33
+ { name: "K_HEAD", symbols: [{ literal: "head" }] }
34
+ ],
35
+ K_HIGHLIGHT: [
36
+ { name: "K_HIGHLIGHT", symbols: [{ literal: "highlight" }] }
37
+ ],
38
+ K_IMPORT: [
39
+ { name: "K_IMPORT", symbols: [{ literal: "import" }] }
40
+ ],
41
+ K_INSET: [
42
+ { name: "K_INSET", symbols: [{ literal: "inset" }] }
43
+ ],
44
+ K_LEXER: [
45
+ { name: "K_LEXER", symbols: [{ literal: "lexer" }] }
46
+ ],
47
+ K_OPEN: [
48
+ { name: "K_OPEN", symbols: [{ literal: "open" }] }
49
+ ],
50
+ K_POP: [
51
+ { name: "K_POP", symbols: [{ literal: "pop" }] }
52
+ ],
53
+ K_SET: [
54
+ { name: "K_SET", symbols: [{ literal: "set" }] }
55
+ ],
56
+ K_TAG: [
57
+ { name: "K_TAG", symbols: [{ literal: "tag" }] }
58
+ ],
59
+ K_TYPE: [
60
+ { name: "K_TYPE", symbols: [{ literal: "type" }] }
61
+ ],
62
+ K_UNEMBED: [
63
+ { name: "K_UNEMBED", symbols: [{ literal: "unembed" }] }
64
+ ],
65
+ K_WHEN: [
66
+ { name: "K_WHEN", symbols: [{ literal: "when" }] }
67
+ ],
68
+ L_ARROW: [
69
+ { name: "L_ARROW", symbols: [{ token: "L_ARROW" }] }
70
+ ],
71
+ L_COLON: [
72
+ { name: "L_COLON", symbols: [{ token: "L_COLON" }] }
73
+ ],
74
+ L_COMMA: [
75
+ { name: "L_COMMA", symbols: [{ token: "L_COMMA" }] }
76
+ ],
77
+ L_DASH: [
78
+ { name: "L_DASH", symbols: [{ token: "L_DASH" }] }
79
+ ],
80
+ L_DSIGN: [
81
+ { name: "L_DSIGN", symbols: [{ token: "L_DSIGN" }] }
82
+ ],
83
+ L_PARENL: [
84
+ { name: "L_PARENL", symbols: [{ token: "L_PARENL" }] }
85
+ ],
86
+ L_PARENR: [
87
+ { name: "L_PARENR", symbols: [{ token: "L_PARENR" }] }
88
+ ],
89
+ L_PIPE: [
90
+ { name: "L_PIPE", symbols: [{ token: "L_PIPE" }] }
91
+ ],
92
+ L_PLUS: [
93
+ { name: "L_PLUS", symbols: [{ token: "L_PLUS" }] }
94
+ ],
95
+ L_QMARK: [
96
+ { name: "L_QMARK", symbols: [{ token: "L_QMARK" }] }
97
+ ],
98
+ L_SCOLON: [
99
+ { name: "L_SCOLON", symbols: [{ token: "L_SCOLON" }] }
100
+ ],
101
+ L_STAR: [
102
+ { name: "L_STAR", symbols: [{ token: "L_STAR" }] }
103
+ ],
104
+ L_TEMPLATEL: [
105
+ { name: "L_TEMPLATEL", symbols: [{ token: "L_TEMPLATEL" }] }
106
+ ],
107
+ L_TEMPLATER: [
108
+ { name: "L_TEMPLATER", symbols: [{ token: "L_TEMPLATER" }] }
109
+ ],
110
+ T_COMMENT: [
111
+ { name: "T_COMMENT", symbols: [{ token: "T_COMMENT" }] }
112
+ ],
113
+ T_GRAMMAR_TEMPLATE: [
114
+ { name: "T_GRAMMAR_TEMPLATE", postprocess: ({ data }) => { return ({ template: '(' + data[2].map(v => v.value).join('').trim() + ')' }); }, symbols: [{ token: "L_TEMPLATEL" }, "_", "T_GRAMMAR_TEMPLATE.RPT0Nx1", "_", { token: "L_TEMPLATER" }] }
115
+ ],
116
+ "T_GRAMMAR_TEMPLATE.RPT0Nx1": [
117
+ { name: "T_GRAMMAR_TEMPLATE.RPT0Nx1", symbols: [] },
118
+ { name: "T_GRAMMAR_TEMPLATE.RPT0Nx1", postprocess: ({ data }) => data[0].concat([data[1]]), symbols: ["T_GRAMMAR_TEMPLATE.RPT0Nx1", { token: "T_JSBODY" }] }
119
+ ],
120
+ T_INTEGER: [
121
+ { name: "T_INTEGER", postprocess: ({ data }) => { return (data[0].value); }, symbols: [{ token: "T_INTEGER" }] }
122
+ ],
123
+ T_JS: [
124
+ { name: "T_JS", postprocess: ({ data }) => { return ({ js: data[1].map(v => v.value).join('') }); }, symbols: [{ token: "L_JSL" }, "T_JS.RPT0Nx1", { token: "L_JSR" }] }
125
+ ],
126
+ "T_JS.RPT0Nx1": [
127
+ { name: "T_JS.RPT0Nx1", symbols: [] },
128
+ { name: "T_JS.RPT0Nx1", postprocess: ({ data }) => data[0].concat([data[1]]), symbols: ["T_JS.RPT0Nx1", { token: "T_JSBODY" }] }
129
+ ],
130
+ T_REGEX: [
131
+ { name: "T_REGEX", postprocess: ({ data }) => { return ({ regex: data[0].value.slice(1, -1), flags: data[1].map(v => v.value).join('').trim() }); }, symbols: [{ token: "T_REGEX" }, "T_REGEX.RPT0Nx1"] }
132
+ ],
133
+ "T_REGEX.RPT0Nx1": [
134
+ { name: "T_REGEX.RPT0Nx1", symbols: [] },
135
+ { name: "T_REGEX.RPT0Nx1", postprocess: ({ data }) => data[0].concat([data[1]]), symbols: ["T_REGEX.RPT0Nx1", /[gmiuy]/] }
136
+ ],
137
+ T_STRING: [
138
+ { name: "T_STRING", postprocess: ({ data }) => { return (JSON.parse(data[0].value)); }, symbols: [{ token: "T_STRING" }] }
139
+ ],
140
+ T_WORD: [
141
+ { name: "T_WORD", postprocess: ({ data }) => { return (data[0].value); }, symbols: [{ token: "T_WORD" }] }
142
+ ],
143
+ T_WS: [
144
+ { name: "T_WS", postprocess: ({ data }) => { return (null); }, symbols: [{ token: "T_WS" }] }
145
+ ],
146
+ _: [
147
+ { name: "_", postprocess: ({ data }) => { return (null); }, symbols: ["_.RPT0Nx1"] }
148
+ ],
149
+ "_.RPT0Nx1": [
150
+ { name: "_.RPT0Nx1", symbols: [] },
151
+ { name: "_.RPT0Nx1", postprocess: ({ data }) => data[0].concat([data[1]]), symbols: ["_.RPT0Nx1", "_.RPT0Nx1.SUBx1"] }
152
+ ],
153
+ "_.RPT0Nx1.SUBx1": [
154
+ { name: "_.RPT0Nx1.SUBx1", symbols: ["T_WS"] },
155
+ { name: "_.RPT0Nx1.SUBx1", symbols: ["T_COMMENT"] }
156
+ ],
157
+ __: [
158
+ { name: "__", postprocess: ({ data }) => { return (null); }, symbols: ["__.RPT1Nx1"] }
159
+ ],
160
+ "__.RPT1Nx1": [
161
+ { name: "__.RPT1Nx1", symbols: ["__.RPT1Nx1.SUBx1"] },
162
+ { name: "__.RPT1Nx1", postprocess: ({ data }) => data[0].concat([data[1]]), symbols: ["__.RPT1Nx1", "__.RPT1Nx1.SUBx2"] }
163
+ ],
164
+ "__.RPT1Nx1.SUBx1": [
165
+ { name: "__.RPT1Nx1.SUBx1", symbols: ["T_WS"] },
166
+ { name: "__.RPT1Nx1.SUBx1", symbols: ["T_COMMENT"] }
167
+ ],
168
+ "__.RPT1Nx1.SUBx2": [
169
+ { name: "__.RPT1Nx1.SUBx2", symbols: ["T_WS"] },
170
+ { name: "__.RPT1Nx1.SUBx2", symbols: ["T_COMMENT"] }
171
+ ],
172
+ expression: [
173
+ { name: "expression", postprocess: ({ data }) => { return ({ symbols: data[0] }); }, symbols: ["expression_symbol_list"] },
174
+ { name: "expression", postprocess: ({ data }) => { return ({ symbols: data[0], postprocess: data[4] }); }, symbols: ["expression_symbol_list", "__", "L_COLON", "_", "T_JS"] },
175
+ { name: "expression", postprocess: ({ data }) => { return ({ symbols: data[0], postprocess: data[4] }); }, symbols: ["expression_symbol_list", "__", "L_COLON", "_", "T_GRAMMAR_TEMPLATE"] }
176
+ ],
177
+ expression_list: [
178
+ { name: "expression_list", symbols: ["expression"] },
179
+ { name: "expression_list", postprocess: ({ data }) => { return (data[0].concat([data[4]])); }, symbols: ["expression_list", "_", "L_PIPE", "_", "expression"] }
180
+ ],
181
+ expression_repeater: [
182
+ { name: "expression_repeater", postprocess: ({ data }) => { return (data[0][0].value); }, symbols: ["L_QMARK"] },
183
+ { name: "expression_repeater", postprocess: ({ data }) => { return (data[0][0].value); }, symbols: ["L_PLUS"] },
184
+ { name: "expression_repeater", postprocess: ({ data }) => { return (data[0][0].value); }, symbols: ["L_STAR"] }
185
+ ],
186
+ expression_symbol: [
187
+ { name: "expression_symbol", postprocess: ({ data }) => { return (data[0]); }, symbols: ["expression_symbol_match"] },
188
+ { name: "expression_symbol", postprocess: ({ data }) => { return ({ ...data[0], alias: data[2] }); }, symbols: ["expression_symbol_match", "L_COLON", "T_WORD"] },
189
+ { name: "expression_symbol", postprocess: ({ data }) => { return ({ expression: data[0], repeat: data[1] }); }, symbols: ["expression_symbol_match", "expression_repeater"] },
190
+ { name: "expression_symbol", postprocess: ({ data }) => { return ({ expression: data[0], repeat: data[1], alias: data[4] }); }, symbols: ["expression_symbol_match", "expression_repeater", "L_COLON", "T_WORD"] }
191
+ ],
192
+ expression_symbol_list: [
193
+ { name: "expression_symbol_list", symbols: ["expression_symbol"] },
194
+ { name: "expression_symbol_list", postprocess: ({ data }) => { return (data[0].concat([data[2]])); }, symbols: ["expression_symbol_list", "T_WS", "expression_symbol"] }
195
+ ],
196
+ expression_symbol_match: [
197
+ { name: "expression_symbol_match", postprocess: ({ data }) => { return ({ rule: data[0] }); }, symbols: ["T_WORD"] },
198
+ { name: "expression_symbol_match", postprocess: ({ data }) => { return ({ literal: data[0], insensitive: !!data[1] }); }, symbols: ["T_STRING", "expression_symbol_match.RPT01x1"] },
199
+ { name: "expression_symbol_match", postprocess: ({ data }) => { return ({ token: data[1] }); }, symbols: ["L_DSIGN", "T_WORD"] },
200
+ { name: "expression_symbol_match", postprocess: ({ data }) => { return ({ token: data[1] }); }, symbols: ["L_DSIGN", "T_STRING"] },
201
+ { name: "expression_symbol_match", postprocess: ({ data }) => { return (data[0]); }, symbols: ["T_REGEX"] },
202
+ { name: "expression_symbol_match", postprocess: ({ data }) => { return ({ subexpression: data[2] }); }, symbols: ["L_PARENL", "_", "expression_list", "_", "L_PARENR"] },
203
+ { name: "expression_symbol_match", postprocess: ({ data }) => { return (data[0]); }, symbols: ["T_JS"] }
204
+ ],
205
+ "expression_symbol_match.RPT01x1": [
206
+ { name: "expression_symbol_match.RPT01x1", postprocess: ({ data }) => data[0], symbols: [{ literal: "i" }] },
207
+ { name: "expression_symbol_match.RPT01x1", postprocess: () => null, symbols: [] }
208
+ ],
209
+ grammar: [
210
+ { name: "grammar", postprocess: ({ data }) => { return ({ config: Object.assign(...data[0]), rules: data[2] }); }, symbols: ["kv_list", "_", "grammar_rule_list"] },
211
+ { name: "grammar", postprocess: ({ data }) => { return ({ rules: data[0] }); }, symbols: ["grammar_rule_list"] }
212
+ ],
213
+ grammar_rule: [
214
+ { name: "grammar_rule", postprocess: ({ data }) => { return ({ name: data[0], expressions: data[4] }); }, symbols: ["T_WORD", "_", "L_ARROW", "_", "expression_list"] },
215
+ { name: "grammar_rule", postprocess: ({ data }) => { return ({ name: data[0], expressions: data[8], postprocess: data[4] }); }, symbols: ["T_WORD", "__", "L_COLON", "_", "T_JS", "_", "L_ARROW", "_", "expression_list"] },
216
+ { name: "grammar_rule", postprocess: ({ data }) => { return ({ name: data[0], expressions: data[8], postprocess: data[4] }); }, symbols: ["T_WORD", "__", "L_COLON", "_", "T_GRAMMAR_TEMPLATE", "_", "L_ARROW", "_", "expression_list"] }
217
+ ],
218
+ grammar_rule_list: [
219
+ { name: "grammar_rule_list", postprocess: ({ data }) => { return ([data[0]]); }, symbols: ["grammar_rule"] },
220
+ { name: "grammar_rule_list", postprocess: ({ data }) => { return ([data[0]].concat(data[2])); }, symbols: ["grammar_rule", "_", "grammar_rule_list"] }
221
+ ],
222
+ kv: [
223
+ { name: "kv", postprocess: ({ data }) => { return ({ [data[0]]: data[4][0] }); }, symbols: ["T_WORD", "_", "L_COLON", "_", "kv.SUBx1"] }
224
+ ],
225
+ "kv.SUBx1": [
226
+ { name: "kv.SUBx1", symbols: ["T_WORD"] },
227
+ { name: "kv.SUBx1", symbols: ["T_STRING"] },
228
+ { name: "kv.SUBx1", symbols: ["T_INTEGER"] },
229
+ { name: "kv.SUBx1", symbols: ["T_JS"] },
230
+ { name: "kv.SUBx1", symbols: ["T_GRAMMAR_TEMPLATE"] }
231
+ ],
232
+ kv_list: [
233
+ { name: "kv_list", postprocess: ({ data }) => { return (data); }, symbols: ["kv"] },
234
+ { name: "kv_list", postprocess: ({ data }) => { return ([data[0]].concat(data[2])); }, symbols: ["kv", "_", "kv_list"] }
235
+ ],
236
+ lexer: [
237
+ { name: "lexer", postprocess: ({ data }) => { return (data[0].concat({ states: data[2] })); }, symbols: ["kv_list", "_", "state_list"] },
238
+ { name: "lexer", postprocess: ({ data }) => { return ([{ states: data[0] }]); }, symbols: ["state_list"] }
239
+ ],
240
+ main: [
241
+ { name: "main", postprocess: ({ data }) => { return (data[1]); }, symbols: ["_", "section_list", "_"] }
242
+ ],
243
+ section: [
244
+ { name: "section", postprocess: ({ data }) => { return ({ config: Object.assign(...data[6]) }); }, symbols: ["K_CONFIG", "_", "L_COLON", "_", "L_TEMPLATEL", "_", "kv_list", "_", "L_TEMPLATER"] },
245
+ { name: "section", postprocess: ({ data }) => { return ({ import: data[6] }); }, symbols: ["K_IMPORT", "_", "L_STAR", "_", "K_FROM", "__", "T_WORD", "_", "L_SCOLON"] },
246
+ { name: "section", postprocess: ({ data }) => { return ({ import: data[6], path: true }); }, symbols: ["K_IMPORT", "_", "L_STAR", "_", "K_FROM", "__", "T_STRING", "_", "L_SCOLON"] },
247
+ { name: "section", postprocess: ({ data }) => { return ({ import: data[10], alias: data[6] }); }, symbols: ["K_IMPORT", "_", "L_STAR", "_", { literal: "as" }, "_", "T_WORD", "_", "K_FROM", "__", "T_WORD", "_", "L_SCOLON"] },
248
+ { name: "section", postprocess: ({ data }) => { return ({ import: data[10], path: true, alias: data[6] }); }, symbols: ["K_IMPORT", "_", "L_STAR", "_", { literal: "as" }, "_", "T_WORD", "_", "K_FROM", "__", "T_STRING", "_", "L_SCOLON"] },
249
+ { name: "section", postprocess: ({ data }) => { return ({ lexer: Object.assign(...data[6]) }); }, symbols: ["K_LEXER", "_", "L_COLON", "_", "L_TEMPLATEL", "_", "lexer", "_", "L_TEMPLATER"] },
250
+ { name: "section", postprocess: ({ data }) => { return ({ grammar: data[6] }); }, symbols: ["K_GRAMMAR", "_", "L_COLON", "_", "L_TEMPLATEL", "_", "grammar", "_", "L_TEMPLATER"] },
251
+ { name: "section", postprocess: ({ data }) => { return ({ lifecycle: "new", js: data[4] }); }, symbols: ["K_BODY", "_", "L_COLON", "_", "T_JS"] },
252
+ { name: "section", postprocess: ({ data }) => { return ({ lifecycle: "new", js: data[4], path: true }); }, symbols: ["K_BODY", "_", "L_COLON", "_", "T_STRING"] },
253
+ { name: "section", postprocess: ({ data }) => { return ({ lifecycle: "import", "js": data[4] }); }, symbols: ["K_HEAD", "_", "L_COLON", "_", "T_JS"] },
254
+ { name: "section", postprocess: ({ data }) => { return ({ lifecycle: "import", "js": data[4], path: true }); }, symbols: ["K_HEAD", "_", "L_COLON", "_", "T_STRING"] }
255
+ ],
256
+ section_list: [
257
+ { name: "section_list", postprocess: ({ data }) => { return ([data[0]]); }, symbols: ["section"] },
258
+ { name: "section_list", postprocess: ({ data }) => { return ([data[0]].concat(data[2])); }, symbols: ["section", "T_WS", "section_list"] }
259
+ ],
260
+ state: [
261
+ { name: "state", postprocess: ({ data }) => { return ({ name: data[0], state: data[2] }); }, symbols: ["state_declare", "_", "state_definition"] }
262
+ ],
263
+ state_declare: [
264
+ { name: "state_declare", postprocess: ({ data }) => { return (data[0]); }, symbols: ["T_WORD", "_", "L_ARROW"] }
265
+ ],
266
+ state_definition: [
267
+ { name: "state_definition", postprocess: ({ data }) => { return (Object.assign(...data[0], { rules: data[2] })); }, symbols: ["state_definition_kv_list", "_", "token_list"] },
268
+ { name: "state_definition", postprocess: ({ data }) => { return ({ rules: data[0] }); }, symbols: ["token_list"] }
269
+ ],
270
+ state_definition_kv: [
271
+ { name: "state_definition_kv", postprocess: ({ data }) => { return ({ tag: data[4] }); }, symbols: [{ literal: "default" }, "_", { literal: ":" }, "_", "T_WORD"] },
272
+ { name: "state_definition_kv", postprocess: ({ data }) => { return ({ tag: data[4] }); }, symbols: [{ literal: "default" }, "_", { literal: ":" }, "_", "T_STRING"] },
273
+ { name: "state_definition_kv", postprocess: ({ data }) => { return ({ tag: data[4] }); }, symbols: [{ literal: "unmatched" }, "_", { literal: ":" }, "_", "T_WORD"] },
274
+ { name: "state_definition_kv", postprocess: ({ data }) => { return ({ tag: data[4] }); }, symbols: [{ literal: "unmatched" }, "_", { literal: ":" }, "_", "T_STRING"] }
275
+ ],
276
+ state_definition_kv_list: [
277
+ { name: "state_definition_kv_list", postprocess: ({ data }) => { return (data); }, symbols: ["state_definition_kv"] },
278
+ { name: "state_definition_kv_list", postprocess: ({ data }) => { return ([data[0]].concat(data[2])); }, symbols: ["state_definition_kv", "_", "state_definition_kv_list"] }
279
+ ],
280
+ state_list: [
281
+ { name: "state_list", postprocess: ({ data }) => { return ([data[0]]); }, symbols: ["state"] },
282
+ { name: "state_list", postprocess: ({ data }) => { return ([data[0]].concat(data[2])); }, symbols: ["state", "_", "state_list"] }
283
+ ],
284
+ string_list: [
285
+ { name: "string_list", postprocess: ({ data }) => { return ([data[0]]); }, symbols: ["T_STRING"] },
286
+ { name: "string_list", postprocess: ({ data }) => { return ([data[0]].concat(data[4])); }, symbols: ["T_STRING", "_", "L_COMMA", "_", "string_list"] }
287
+ ],
288
+ token: [
289
+ { name: "token", postprocess: ({ data }) => { return ({ import: data[6] }); }, symbols: ["L_DASH", "_", "K_IMPORT", "_", "L_COLON", "_", "word_list"] },
290
+ { name: "token", postprocess: ({ data }) => { return (Object.assign(...data[2])); }, symbols: ["L_DASH", "_", "token_definition_list"] }
291
+ ],
292
+ token_definition: [
293
+ { name: "token_definition", postprocess: ({ data }) => { return ({ tag: data[4] }); }, symbols: ["K_TAG", "_", "L_COLON", "_", "string_list"] },
294
+ { name: "token_definition", postprocess: ({ data }) => { return ({ when: data[4] }); }, symbols: ["K_WHEN", "_", "L_COLON", "_", "T_STRING"] },
295
+ { name: "token_definition", postprocess: ({ data }) => { return ({ when: data[4] }); }, symbols: ["K_WHEN", "_", "L_COLON", "_", "T_REGEX"] },
296
+ { name: "token_definition", postprocess: ({ data }) => { return ({ open: data[4] }); }, symbols: ["K_OPEN", "_", "L_COLON", "_", "T_STRING"] },
297
+ { name: "token_definition", postprocess: ({ data }) => { return ({ close: data[4] }); }, symbols: ["K_CLOSE", "_", "L_COLON", "_", "T_STRING"] },
298
+ { name: "token_definition", postprocess: ({ data }) => { return ({ when: data[4], before: true }); }, symbols: ["K_BEFORE", "_", "L_COLON", "_", "T_STRING"] },
299
+ { name: "token_definition", postprocess: ({ data }) => { return ({ when: data[4], before: true }); }, symbols: ["K_BEFORE", "_", "L_COLON", "_", "T_REGEX"] },
300
+ { name: "token_definition", postprocess: ({ data }) => { return ({ pop: 1 }); }, symbols: ["K_POP"] },
301
+ { name: "token_definition", postprocess: ({ data }) => { return ({ pop: parseInt(data[4]) }); }, symbols: ["K_POP", "_", "L_COLON", "_", "T_INTEGER"] },
302
+ { name: "token_definition", postprocess: ({ data }) => { return ({ pop: "all" }); }, symbols: ["K_POP", "_", "L_COLON", "_", "K_ALL"] },
303
+ { name: "token_definition", postprocess: ({ data }) => { return ({ highlight: data[4] }); }, symbols: ["K_HIGHLIGHT", "_", "L_COLON", "_", "T_STRING"] },
304
+ { name: "token_definition", postprocess: ({ data }) => { return ({ embed: data[4] }); }, symbols: ["K_EMBED", "_", "L_COLON", "_", "T_STRING"] },
305
+ { name: "token_definition", postprocess: ({ data }) => { return ({ unembed: true }); }, symbols: ["K_UNEMBED"] },
306
+ { name: "token_definition", postprocess: ({ data }) => { return ({ inset: 1 }); }, symbols: ["K_INSET"] },
307
+ { name: "token_definition", postprocess: ({ data }) => { return ({ inset: parseInt(data[4]) }); }, symbols: ["K_INSET", "_", "L_COLON", "_", "T_INTEGER"] },
308
+ { name: "token_definition", postprocess: ({ data }) => { return ({ set: data[4] }); }, symbols: ["K_SET", "_", "L_COLON", "_", "T_WORD"] },
309
+ { name: "token_definition", postprocess: ({ data }) => { return ({ goto: data[4] }); }, symbols: ["K_GOTO", "_", "L_COLON", "_", "T_WORD"] },
310
+ { name: "token_definition", postprocess: ({ data }) => { return ({ type: data[4] }); }, symbols: ["K_TYPE", "_", "L_COLON", "_", "T_STRING"] }
311
+ ],
312
+ token_definition_list: [
313
+ { name: "token_definition_list", postprocess: ({ data }) => { return (data); }, symbols: ["token_definition"] },
314
+ { name: "token_definition_list", postprocess: ({ data }) => { return ([data[0]].concat(data[2])); }, symbols: ["token_definition", "_", "token_definition_list"] }
315
+ ],
316
+ token_list: [
317
+ { name: "token_list", postprocess: ({ data }) => { return (data); }, symbols: ["token"] },
318
+ { name: "token_list", postprocess: ({ data }) => { return ([data[0]].concat(data[2])); }, symbols: ["token", "_", "token_list"] }
319
+ ],
320
+ word_list: [
321
+ { name: "word_list", postprocess: ({ data }) => { return ([data[0]]); }, symbols: ["T_WORD"] },
322
+ { name: "word_list", postprocess: ({ data }) => { return ([data[0]].concat(data[4])); }, symbols: ["T_WORD", "_", "L_COMMA", "_", "word_list"] }
323
+ ]
324
+ },
325
+ start: "main"
326
+ },
327
+ lexer: {
328
+ start: "start",
329
+ states: {
330
+ comment: {
331
+ regex: /(?:(?:(\/\/[^\n]*)))/ym,
332
+ rules: [
333
+ { highlight: "comment", tag: ["T_COMMENT"], when: /\/\/[^\n]*/ }
334
+ ]
335
+ },
336
+ config: {
337
+ regex: /(?:(?:(\s+))|(?:((?::)))|(?:((?:\{\{))))/ym,
338
+ rules: [
339
+ { tag: ["T_WS"], when: /\s+/ },
340
+ { highlight: "keyword", tag: ["L_COLON"], when: ":" },
341
+ { set: "config_inner", tag: ["L_TEMPLATEL"], when: "{{" }
342
+ ]
343
+ },
344
+ config_inner: {
345
+ regex: /(?:(?:(\/\/[^\n]*))|(?:("(?:[^"\\\r\n]|\\.)*"))|(?:(\s+))|(?:([a-zA-Z_][a-zA-Z_\d]*))|(?:((?::)))|(?:(\d+))|(?:((?:\}\}))))/ym,
346
+ rules: [
347
+ { highlight: "comment", tag: ["T_COMMENT"], when: /\/\/[^\n]*/ },
348
+ { highlight: "string", tag: ["T_STRING"], when: /"(?:[^"\\\r\n]|\\.)*"/ },
349
+ { tag: ["T_WS"], when: /\s+/ },
350
+ { tag: ["T_WORD"], when: /[a-zA-Z_][a-zA-Z_\d]*/ },
351
+ { highlight: "keyword", tag: ["L_COLON"], when: ":" },
352
+ { highlight: "number", tag: ["T_INTEGER"], when: /\d+/ },
353
+ { pop: 1, tag: ["L_TEMPLATER"], when: "}}" }
354
+ ]
355
+ },
356
+ grammar: {
357
+ regex: /(?:(?:(\s+))|(?:((?::)))|(?:((?:\{\{))))/ym,
358
+ rules: [
359
+ { tag: ["T_WS"], when: /\s+/ },
360
+ { highlight: "keyword", tag: ["L_COLON"], when: ":" },
361
+ { set: "grammar_inner", tag: ["L_TEMPLATEL"], when: "{{" }
362
+ ]
363
+ },
364
+ grammar_inner: {
365
+ regex: /(?:(?:(\/\/[^\n]*))|(?:((?:\$\{)))|(?:((?:\{\{)))|(?:(\s+))|(?:(\/(?:[^\/\\\r\n]|\\.)+\/))|(?:((?:\?)))|(?:((?:\+)))|(?:((?:\*)))|(?:("(?:[^"\\\r\n]|\\.)*"))|(?:([a-zA-Z_][a-zA-Z_\d]*))|(?:((?::)))|(?:(\d+))|(?:((?:,)))|(?:((?:\|)))|(?:((?:\()))|(?:((?:\))))|(?:((?:\->)))|(?:((?:\$)))|(?:((?:\-)))|(?:((?:\}\}))))/ym,
366
+ rules: [
367
+ { highlight: "comment", tag: ["T_COMMENT"], when: /\/\/[^\n]*/ },
368
+ { goto: "js_wrap", tag: ["L_JSL"], when: "${" },
369
+ { goto: "js_template_inner", tag: ["L_TEMPLATEL"], when: "{{" },
370
+ { tag: ["T_WS"], when: /\s+/ },
371
+ { highlight: "regexp", tag: ["T_REGEX"], when: /\/(?:[^\/\\\r\n]|\\.)+\// },
372
+ { tag: ["L_QMARK"], when: "?" },
373
+ { tag: ["L_PLUS"], when: "+" },
374
+ { tag: ["L_STAR"], when: "*" },
375
+ { highlight: "string", tag: ["T_STRING"], when: /"(?:[^"\\\r\n]|\\.)*"/ },
376
+ { tag: ["T_WORD"], when: /[a-zA-Z_][a-zA-Z_\d]*/ },
377
+ { highlight: "keyword", tag: ["L_COLON"], when: ":" },
378
+ { highlight: "number", tag: ["T_INTEGER"], when: /\d+/ },
379
+ { tag: ["L_COMMA"], when: "," },
380
+ { highlight: "keyword", tag: ["L_PIPE"], when: "|" },
381
+ { tag: ["L_PARENL"], when: "(" },
382
+ { tag: ["L_PARENR"], when: ")" },
383
+ { highlight: "keyword", tag: ["L_ARROW"], when: "->" },
384
+ { tag: ["L_DSIGN"], when: "$" },
385
+ { tag: ["L_DASH"], when: "-" },
386
+ { pop: 1, tag: ["L_TEMPLATER"], when: "}}" }
387
+ ]
388
+ },
389
+ integer: {
390
+ regex: /(?:(?:(\d+)))/ym,
391
+ rules: [
392
+ { highlight: "number", tag: ["T_INTEGER"], when: /\d+/ }
393
+ ]
394
+ },
395
+ js: {
396
+ regex: /(?:(?:((?:\$\{))))/ym,
397
+ rules: [
398
+ { goto: "js_wrap", tag: ["L_JSL"], when: "${" }
399
+ ]
400
+ },
401
+ js_literal: {
402
+ regex: /(?:(?:("(?:[^"\\\r\n]|\\.)*"))|(?:('(?:[^'\\\r\n]|\\.)*'))|(?:(`(?:[^`\\]|\\.)*`))|(?:(\/(?:[^/\\\r\n]|\\.)+\/[gmiyu]*))|(?:(\/\/[^\n]*))|(?:(\/\*.*\*\/))|(?:((?:\{)))|(?:((?:\}))))/gm,
403
+ rules: [
404
+ { tag: ["T_JSBODY"], when: /"(?:[^"\\\r\n]|\\.)*"/ },
405
+ { tag: ["T_JSBODY"], when: /'(?:[^'\\\r\n]|\\.)*'/ },
406
+ { tag: ["T_JSBODY"], when: /`(?:[^`\\]|\\.)*`/ },
407
+ { tag: ["T_JSBODY"], when: /\/(?:[^/\\\r\n]|\\.)+\/[gmiyu]*/ },
408
+ { tag: ["T_JSBODY"], when: /\/\/[^\n]*/ },
409
+ { tag: ["T_JSBODY"], when: /\/\*.*\*\// },
410
+ { goto: "js_literal", tag: ["T_JSBODY"], when: "{" },
411
+ { pop: 1, tag: ["T_JSBODY"], when: "}" }
412
+ ],
413
+ unmatched: { tag: ["T_JSBODY"] }
414
+ },
415
+ js_template: {
416
+ regex: /(?:(?:((?:\{\{))))/ym,
417
+ rules: [
418
+ { goto: "js_template_inner", tag: ["L_TEMPLATEL"], when: "{{" }
419
+ ]
420
+ },
421
+ js_template_inner: {
422
+ regex: /(?:(?:("(?:[^"\\\r\n]|\\.)*"))|(?:('(?:[^'\\\r\n]|\\.)*'))|(?:(`(?:[^`\\]|\\.)*`))|(?:(\/(?:[^/\\\r\n]|\\.)+\/[gmiyu]*))|(?:(\/\/[^\n]*))|(?:(\/\*.*\*\/))|(?:((?:\{)))|(?:((?:\}\}))))/gm,
423
+ rules: [
424
+ { tag: ["T_JSBODY"], when: /"(?:[^"\\\r\n]|\\.)*"/ },
425
+ { tag: ["T_JSBODY"], when: /'(?:[^'\\\r\n]|\\.)*'/ },
426
+ { tag: ["T_JSBODY"], when: /`(?:[^`\\]|\\.)*`/ },
427
+ { tag: ["T_JSBODY"], when: /\/(?:[^/\\\r\n]|\\.)+\/[gmiyu]*/ },
428
+ { tag: ["T_JSBODY"], when: /\/\/[^\n]*/ },
429
+ { tag: ["T_JSBODY"], when: /\/\*.*\*\// },
430
+ { goto: "js_literal", tag: ["T_JSBODY"], when: "{" },
431
+ { pop: 1, tag: ["L_TEMPLATER"], when: "}}" }
432
+ ],
433
+ unmatched: { tag: ["T_JSBODY"] }
434
+ },
435
+ js_wrap: {
436
+ regex: /(?:(?:("(?:[^"\\\r\n]|\\.)*"))|(?:('(?:[^'\\\r\n]|\\.)*'))|(?:(`(?:[^`\\]|\\.)*`))|(?:(\/(?:[^/\\\r\n]|\\.)+\/[gmiyu]*))|(?:(\/\/[^\n]*))|(?:(\/\*.*\*\/))|(?:((?:\{)))|(?:((?:\}))))/gm,
437
+ rules: [
438
+ { tag: ["T_JSBODY"], when: /"(?:[^"\\\r\n]|\\.)*"/ },
439
+ { tag: ["T_JSBODY"], when: /'(?:[^'\\\r\n]|\\.)*'/ },
440
+ { tag: ["T_JSBODY"], when: /`(?:[^`\\]|\\.)*`/ },
441
+ { tag: ["T_JSBODY"], when: /\/(?:[^/\\\r\n]|\\.)+\/[gmiyu]*/ },
442
+ { tag: ["T_JSBODY"], when: /\/\/[^\n]*/ },
443
+ { tag: ["T_JSBODY"], when: /\/\*.*\*\// },
444
+ { goto: "js_literal", tag: ["T_JSBODY"], when: "{" },
445
+ { pop: 1, tag: ["L_JSR"], when: "}" }
446
+ ],
447
+ unmatched: { tag: ["T_JSBODY"] }
448
+ },
449
+ jsignore: {
450
+ regex: /(?:(?:("(?:[^"\\\r\n]|\\.)*"))|(?:('(?:[^'\\\r\n]|\\.)*'))|(?:(`(?:[^`\\]|\\.)*`))|(?:(\/(?:[^/\\\r\n]|\\.)+\/[gmiyu]*))|(?:(\/\/[^\n]*))|(?:(\/\*.*\*\/)))/ym,
451
+ rules: [
452
+ { tag: ["T_JSBODY"], when: /"(?:[^"\\\r\n]|\\.)*"/ },
453
+ { tag: ["T_JSBODY"], when: /'(?:[^'\\\r\n]|\\.)*'/ },
454
+ { tag: ["T_JSBODY"], when: /`(?:[^`\\]|\\.)*`/ },
455
+ { tag: ["T_JSBODY"], when: /\/(?:[^/\\\r\n]|\\.)+\/[gmiyu]*/ },
456
+ { tag: ["T_JSBODY"], when: /\/\/[^\n]*/ },
457
+ { tag: ["T_JSBODY"], when: /\/\*.*\*\// }
458
+ ]
459
+ },
460
+ kv: {
461
+ regex: /(?:(?:("(?:[^"\\\r\n]|\\.)*"))|(?:(\s+))|(?:([a-zA-Z_][a-zA-Z_\d]*))|(?:((?::)))|(?:(\d+)))/ym,
462
+ rules: [
463
+ { highlight: "string", tag: ["T_STRING"], when: /"(?:[^"\\\r\n]|\\.)*"/ },
464
+ { tag: ["T_WS"], when: /\s+/ },
465
+ { tag: ["T_WORD"], when: /[a-zA-Z_][a-zA-Z_\d]*/ },
466
+ { highlight: "keyword", tag: ["L_COLON"], when: ":" },
467
+ { highlight: "number", tag: ["T_INTEGER"], when: /\d+/ }
468
+ ]
469
+ },
470
+ l_arrow: {
471
+ regex: /(?:(?:((?:\->))))/ym,
472
+ rules: [
473
+ { highlight: "keyword", tag: ["L_ARROW"], when: "->" }
474
+ ]
475
+ },
476
+ l_colon: {
477
+ regex: /(?:(?:((?::))))/ym,
478
+ rules: [
479
+ { highlight: "keyword", tag: ["L_COLON"], when: ":" }
480
+ ]
481
+ },
482
+ l_comma: {
483
+ regex: /(?:(?:((?:,))))/ym,
484
+ rules: [
485
+ { tag: ["L_COMMA"], when: "," }
486
+ ]
487
+ },
488
+ l_dash: {
489
+ regex: /(?:(?:((?:\-))))/ym,
490
+ rules: [
491
+ { tag: ["L_DASH"], when: "-" }
492
+ ]
493
+ },
494
+ l_dsign: {
495
+ regex: /(?:(?:((?:\$))))/ym,
496
+ rules: [
497
+ { tag: ["L_DSIGN"], when: "$" }
498
+ ]
499
+ },
500
+ l_parenl: {
501
+ regex: /(?:(?:((?:\())))/ym,
502
+ rules: [
503
+ { tag: ["L_PARENL"], when: "(" }
504
+ ]
505
+ },
506
+ l_parenr: {
507
+ regex: /(?:(?:((?:\)))))/ym,
508
+ rules: [
509
+ { tag: ["L_PARENR"], when: ")" }
510
+ ]
511
+ },
512
+ l_pipe: {
513
+ regex: /(?:(?:((?:\|))))/ym,
514
+ rules: [
515
+ { highlight: "keyword", tag: ["L_PIPE"], when: "|" }
516
+ ]
517
+ },
518
+ l_plus: {
519
+ regex: /(?:(?:((?:\+))))/ym,
520
+ rules: [
521
+ { tag: ["L_PLUS"], when: "+" }
522
+ ]
523
+ },
524
+ l_qmark: {
525
+ regex: /(?:(?:((?:\?))))/ym,
526
+ rules: [
527
+ { tag: ["L_QMARK"], when: "?" }
528
+ ]
529
+ },
530
+ l_scolon: {
531
+ regex: /(?:(?:((?:;))))/ym,
532
+ rules: [
533
+ { tag: ["L_SCOLON"], when: ";" }
534
+ ]
535
+ },
536
+ l_star: {
537
+ regex: /(?:(?:((?:\*))))/ym,
538
+ rules: [
539
+ { tag: ["L_STAR"], when: "*" }
540
+ ]
541
+ },
542
+ lexer: {
543
+ regex: /(?:(?:(\s+))|(?:((?::)))|(?:((?:\{\{))))/ym,
544
+ rules: [
545
+ { tag: ["T_WS"], when: /\s+/ },
546
+ { highlight: "keyword", tag: ["L_COLON"], when: ":" },
547
+ { set: "lexer_inner", tag: ["L_TEMPLATEL"], when: "{{" }
548
+ ]
549
+ },
550
+ lexer_inner: {
551
+ regex: /(?:(?:(\s+))|(?:(\/\/[^\n]*))|(?:(\/(?:[^\/\\\r\n]|\\.)+\/))|(?:((?:,)))|(?:((?:\->)))|(?:((?:\-)))|(?:("(?:[^"\\\r\n]|\\.)*"))|(?:([a-zA-Z_][a-zA-Z_\d]*))|(?:((?::)))|(?:(\d+))|(?:((?:\$\{)))|(?:((?:\}\}))))/ym,
552
+ rules: [
553
+ { tag: ["T_WS"], when: /\s+/ },
554
+ { highlight: "comment", tag: ["T_COMMENT"], when: /\/\/[^\n]*/ },
555
+ { highlight: "regexp", tag: ["T_REGEX"], when: /\/(?:[^\/\\\r\n]|\\.)+\// },
556
+ { tag: ["L_COMMA"], when: "," },
557
+ { highlight: "keyword", tag: ["L_ARROW"], when: "->" },
558
+ { tag: ["L_DASH"], when: "-" },
559
+ { highlight: "string", tag: ["T_STRING"], when: /"(?:[^"\\\r\n]|\\.)*"/ },
560
+ { tag: ["T_WORD"], when: /[a-zA-Z_][a-zA-Z_\d]*/ },
561
+ { highlight: "keyword", tag: ["L_COLON"], when: ":" },
562
+ { highlight: "number", tag: ["T_INTEGER"], when: /\d+/ },
563
+ { goto: "js_wrap", tag: ["L_JSL"], when: "${" },
564
+ { pop: 1, tag: ["L_TEMPLATER"], when: "}}" }
565
+ ]
566
+ },
567
+ regex: {
568
+ regex: /(?:(?:(\/(?:[^\/\\\r\n]|\\.)+\/)))/ym,
569
+ rules: [
570
+ { highlight: "regexp", tag: ["T_REGEX"], when: /\/(?:[^\/\\\r\n]|\\.)+\// }
571
+ ]
572
+ },
573
+ start: {
574
+ regex: /(?:(?:("(?:[^"\\\r\n]|\\.)*"))|(?:((?:\$\{)))|(?:(\s+))|(?:(\/\/[^\n]*))|(?:((?:;)))|(?:((?:\*)))|(?:(lexer(?![a-zA-Z\d_])))|(?:(grammar(?![a-zA-Z\d_])))|(?:(config(?![a-zA-Z\d_])))|(?:([a-zA-Z_][a-zA-Z_\d]*))|(?:((?::)))|(?:(\d+)))/ym,
575
+ rules: [
576
+ { highlight: "string", tag: ["T_STRING"], when: /"(?:[^"\\\r\n]|\\.)*"/ },
577
+ { goto: "js_wrap", tag: ["L_JSL"], when: "${" },
578
+ { tag: ["T_WS"], when: /\s+/ },
579
+ { highlight: "comment", tag: ["T_COMMENT"], when: /\/\/[^\n]*/ },
580
+ { tag: ["L_SCOLON"], when: ";" },
581
+ { tag: ["L_STAR"], when: "*" },
582
+ { goto: "lexer", highlight: "type", tag: ["T_WORD"], when: /lexer(?![a-zA-Z\d_])/ },
583
+ { goto: "grammar", highlight: "type", tag: ["T_WORD"], when: /grammar(?![a-zA-Z\d_])/ },
584
+ { goto: "config", highlight: "type", tag: ["T_WORD"], when: /config(?![a-zA-Z\d_])/ },
585
+ { tag: ["T_WORD"], when: /[a-zA-Z_][a-zA-Z_\d]*/ },
586
+ { highlight: "keyword", tag: ["L_COLON"], when: ":" },
587
+ { highlight: "number", tag: ["T_INTEGER"], when: /\d+/ }
588
+ ]
589
+ },
590
+ string: {
591
+ regex: /(?:(?:("(?:[^"\\\r\n]|\\.)*")))/ym,
592
+ rules: [
593
+ { highlight: "string", tag: ["T_STRING"], when: /"(?:[^"\\\r\n]|\\.)*"/ }
594
+ ]
595
+ },
596
+ word: {
597
+ regex: /(?:(?:([a-zA-Z_][a-zA-Z_\d]*)))/ym,
598
+ rules: [
599
+ { tag: ["T_WORD"], when: /[a-zA-Z_][a-zA-Z_\d]*/ }
600
+ ]
601
+ },
602
+ ws: {
603
+ regex: /(?:(?:(\s+)))/ym,
604
+ rules: [
605
+ { tag: ["T_WS"], when: /\s+/ }
606
+ ]
607
+ }
608
+ }
609
+ }
610
+ };
611
+ constructor() { }
612
+ }
613
+ export default grammar;
614
+ //# sourceMappingURL=v1.js.map