@actualwave/react-native-codeditor 1.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 (210) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +790 -0
  3. package/app.plugin.js +133 -0
  4. package/lib/module/BlockingView.js +25 -0
  5. package/lib/module/CodeEditor.js +239 -0
  6. package/lib/module/EditorAPI.js +2 -0
  7. package/lib/module/WebViewAPI.js +133 -0
  8. package/lib/module/index.js +6 -0
  9. package/lib/module/package.json +1 -0
  10. package/lib/typescript/app.plugin.d.ts +3 -0
  11. package/lib/typescript/babel.config.d.ts +10 -0
  12. package/lib/typescript/package.json +1 -0
  13. package/lib/typescript/react-native.config.d.ts +2 -0
  14. package/lib/typescript/scripts/copy-assets.d.ts +2 -0
  15. package/lib/typescript/src/BlockingView.d.ts +3 -0
  16. package/lib/typescript/src/CodeEditor.d.ts +33 -0
  17. package/lib/typescript/src/EditorAPI.d.ts +66 -0
  18. package/lib/typescript/src/WebViewAPI.d.ts +46 -0
  19. package/lib/typescript/src/index.d.ts +7 -0
  20. package/package.json +106 -0
  21. package/react-native.config.js +3 -0
  22. package/src/assets/codemirror/@actualwave_codemirror-lang-sksl.js +15 -0
  23. package/src/assets/codemirror/@babel_runtime_helpers_interopRequireDefault.js +1 -0
  24. package/src/assets/codemirror/@babel_runtime_helpers_objectSpread2.js +1 -0
  25. package/src/assets/codemirror/@babel_runtime_helpers_toConsumableArray.js +1 -0
  26. package/src/assets/codemirror/@codemirror_autocomplete.js +206 -0
  27. package/src/assets/codemirror/@codemirror_collab.js +31 -0
  28. package/src/assets/codemirror/@codemirror_commands.js +411 -0
  29. package/src/assets/codemirror/@codemirror_lang-angular.js +7 -0
  30. package/src/assets/codemirror/@codemirror_lang-cpp.js +7 -0
  31. package/src/assets/codemirror/@codemirror_lang-css.js +14 -0
  32. package/src/assets/codemirror/@codemirror_lang-go.js +13 -0
  33. package/src/assets/codemirror/@codemirror_lang-html.js +20 -0
  34. package/src/assets/codemirror/@codemirror_lang-java.js +7 -0
  35. package/src/assets/codemirror/@codemirror_lang-javascript.js +54 -0
  36. package/src/assets/codemirror/@codemirror_lang-jinja.js +15 -0
  37. package/src/assets/codemirror/@codemirror_lang-json.js +10 -0
  38. package/src/assets/codemirror/@codemirror_lang-less.js +10 -0
  39. package/src/assets/codemirror/@codemirror_lang-lezer.js +7 -0
  40. package/src/assets/codemirror/@codemirror_lang-liquid.js +15 -0
  41. package/src/assets/codemirror/@codemirror_lang-markdown.js +55 -0
  42. package/src/assets/codemirror/@codemirror_lang-php.js +7 -0
  43. package/src/assets/codemirror/@codemirror_lang-python.js +19 -0
  44. package/src/assets/codemirror/@codemirror_lang-rust.js +7 -0
  45. package/src/assets/codemirror/@codemirror_lang-sass.js +10 -0
  46. package/src/assets/codemirror/@codemirror_lang-sql.js +52 -0
  47. package/src/assets/codemirror/@codemirror_lang-vue.js +6 -0
  48. package/src/assets/codemirror/@codemirror_lang-wast.js +2 -0
  49. package/src/assets/codemirror/@codemirror_lang-xml.js +13 -0
  50. package/src/assets/codemirror/@codemirror_lang-yaml.js +13 -0
  51. package/src/assets/codemirror/@codemirror_language-data.js +5 -0
  52. package/src/assets/codemirror/@codemirror_language.js +524 -0
  53. package/src/assets/codemirror/@codemirror_legacy-modes_mode_apl.js +1 -0
  54. package/src/assets/codemirror/@codemirror_legacy-modes_mode_asciiarmor.js +1 -0
  55. package/src/assets/codemirror/@codemirror_legacy-modes_mode_asn1.js +3 -0
  56. package/src/assets/codemirror/@codemirror_legacy-modes_mode_asterisk.js +9 -0
  57. package/src/assets/codemirror/@codemirror_legacy-modes_mode_brainfuck.js +13 -0
  58. package/src/assets/codemirror/@codemirror_legacy-modes_mode_clike.js +31 -0
  59. package/src/assets/codemirror/@codemirror_legacy-modes_mode_clojure.js +5 -0
  60. package/src/assets/codemirror/@codemirror_legacy-modes_mode_cmake.js +6 -0
  61. package/src/assets/codemirror/@codemirror_legacy-modes_mode_cobol.js +7 -0
  62. package/src/assets/codemirror/@codemirror_legacy-modes_mode_coffeescript.js +14 -0
  63. package/src/assets/codemirror/@codemirror_legacy-modes_mode_commonlisp.js +1 -0
  64. package/src/assets/codemirror/@codemirror_legacy-modes_mode_crystal.js +18 -0
  65. package/src/assets/codemirror/@codemirror_legacy-modes_mode_css.js +5 -0
  66. package/src/assets/codemirror/@codemirror_legacy-modes_mode_cypher.js +1 -0
  67. package/src/assets/codemirror/@codemirror_legacy-modes_mode_d.js +2 -0
  68. package/src/assets/codemirror/@codemirror_legacy-modes_mode_diff.js +1 -0
  69. package/src/assets/codemirror/@codemirror_legacy-modes_mode_dockerfile.js +9 -0
  70. package/src/assets/codemirror/@codemirror_legacy-modes_mode_dtd.js +3 -0
  71. package/src/assets/codemirror/@codemirror_legacy-modes_mode_dylan.js +35 -0
  72. package/src/assets/codemirror/@codemirror_legacy-modes_mode_ebnf.js +9 -0
  73. package/src/assets/codemirror/@codemirror_legacy-modes_mode_ecl.js +3 -0
  74. package/src/assets/codemirror/@codemirror_legacy-modes_mode_eiffel.js +1 -0
  75. package/src/assets/codemirror/@codemirror_legacy-modes_mode_elm.js +3 -0
  76. package/src/assets/codemirror/@codemirror_legacy-modes_mode_erlang.js +52 -0
  77. package/src/assets/codemirror/@codemirror_legacy-modes_mode_factor.js +14 -0
  78. package/src/assets/codemirror/@codemirror_legacy-modes_mode_fcl.js +2 -0
  79. package/src/assets/codemirror/@codemirror_legacy-modes_mode_forth.js +5 -0
  80. package/src/assets/codemirror/@codemirror_legacy-modes_mode_fortran.js +2 -0
  81. package/src/assets/codemirror/@codemirror_legacy-modes_mode_gas.js +13 -0
  82. package/src/assets/codemirror/@codemirror_legacy-modes_mode_gherkin.js +5 -0
  83. package/src/assets/codemirror/@codemirror_legacy-modes_mode_go.js +2 -0
  84. package/src/assets/codemirror/@codemirror_legacy-modes_mode_groovy.js +3 -0
  85. package/src/assets/codemirror/@codemirror_legacy-modes_mode_haskell.js +5 -0
  86. package/src/assets/codemirror/@codemirror_legacy-modes_mode_haxe.js +12 -0
  87. package/src/assets/codemirror/@codemirror_legacy-modes_mode_http.js +1 -0
  88. package/src/assets/codemirror/@codemirror_legacy-modes_mode_idl.js +7 -0
  89. package/src/assets/codemirror/@codemirror_legacy-modes_mode_javascript.js +23 -0
  90. package/src/assets/codemirror/@codemirror_legacy-modes_mode_jinja2.js +8 -0
  91. package/src/assets/codemirror/@codemirror_legacy-modes_mode_julia.js +17 -0
  92. package/src/assets/codemirror/@codemirror_legacy-modes_mode_livescript.js +1 -0
  93. package/src/assets/codemirror/@codemirror_legacy-modes_mode_lua.js +2 -0
  94. package/src/assets/codemirror/@codemirror_legacy-modes_mode_mathematica.js +26 -0
  95. package/src/assets/codemirror/@codemirror_legacy-modes_mode_mbox.js +11 -0
  96. package/src/assets/codemirror/@codemirror_legacy-modes_mode_mirc.js +1 -0
  97. package/src/assets/codemirror/@codemirror_legacy-modes_mode_mllike.js +8 -0
  98. package/src/assets/codemirror/@codemirror_legacy-modes_mode_modelica.js +12 -0
  99. package/src/assets/codemirror/@codemirror_legacy-modes_mode_mscgen.js +3 -0
  100. package/src/assets/codemirror/@codemirror_legacy-modes_mode_mumps.js +16 -0
  101. package/src/assets/codemirror/@codemirror_legacy-modes_mode_nginx.js +1 -0
  102. package/src/assets/codemirror/@codemirror_legacy-modes_mode_nsis.js +20 -0
  103. package/src/assets/codemirror/@codemirror_legacy-modes_mode_ntriples.js +1 -0
  104. package/src/assets/codemirror/@codemirror_legacy-modes_mode_octave.js +8 -0
  105. package/src/assets/codemirror/@codemirror_legacy-modes_mode_oz.js +17 -0
  106. package/src/assets/codemirror/@codemirror_legacy-modes_mode_pascal.js +2 -0
  107. package/src/assets/codemirror/@codemirror_legacy-modes_mode_pegjs.js +25 -0
  108. package/src/assets/codemirror/@codemirror_legacy-modes_mode_perl.js +247 -0
  109. package/src/assets/codemirror/@codemirror_legacy-modes_mode_pig.js +6 -0
  110. package/src/assets/codemirror/@codemirror_legacy-modes_mode_powershell.js +7 -0
  111. package/src/assets/codemirror/@codemirror_legacy-modes_mode_properties.js +5 -0
  112. package/src/assets/codemirror/@codemirror_legacy-modes_mode_protobuf.js +7 -0
  113. package/src/assets/codemirror/@codemirror_legacy-modes_mode_pug.js +24 -0
  114. package/src/assets/codemirror/@codemirror_legacy-modes_mode_puppet.js +42 -0
  115. package/src/assets/codemirror/@codemirror_legacy-modes_mode_python.js +15 -0
  116. package/src/assets/codemirror/@codemirror_legacy-modes_mode_q.js +2 -0
  117. package/src/assets/codemirror/@codemirror_legacy-modes_mode_r.js +1 -0
  118. package/src/assets/codemirror/@codemirror_legacy-modes_mode_rpm.js +9 -0
  119. package/src/assets/codemirror/@codemirror_legacy-modes_mode_ruby.js +4 -0
  120. package/src/assets/codemirror/@codemirror_legacy-modes_mode_rust.js +5 -0
  121. package/src/assets/codemirror/@codemirror_legacy-modes_mode_sas.js +23 -0
  122. package/src/assets/codemirror/@codemirror_legacy-modes_mode_sass.js +26 -0
  123. package/src/assets/codemirror/@codemirror_legacy-modes_mode_scheme.js +14 -0
  124. package/src/assets/codemirror/@codemirror_legacy-modes_mode_shell.js +1 -0
  125. package/src/assets/codemirror/@codemirror_legacy-modes_mode_sieve.js +7 -0
  126. package/src/assets/codemirror/@codemirror_legacy-modes_mode_simple-mode.js +1 -0
  127. package/src/assets/codemirror/@codemirror_legacy-modes_mode_smalltalk.js +1 -0
  128. package/src/assets/codemirror/@codemirror_legacy-modes_mode_solr.js +1 -0
  129. package/src/assets/codemirror/@codemirror_legacy-modes_mode_sparql.js +1 -0
  130. package/src/assets/codemirror/@codemirror_legacy-modes_mode_spreadsheet.js +6 -0
  131. package/src/assets/codemirror/@codemirror_legacy-modes_mode_sql.js +84 -0
  132. package/src/assets/codemirror/@codemirror_legacy-modes_mode_stex.js +11 -0
  133. package/src/assets/codemirror/@codemirror_legacy-modes_mode_stylus.js +45 -0
  134. package/src/assets/codemirror/@codemirror_legacy-modes_mode_swift.js +2 -0
  135. package/src/assets/codemirror/@codemirror_legacy-modes_mode_tcl.js +1 -0
  136. package/src/assets/codemirror/@codemirror_legacy-modes_mode_textile.js +2 -0
  137. package/src/assets/codemirror/@codemirror_legacy-modes_mode_tiddlywiki.js +33 -0
  138. package/src/assets/codemirror/@codemirror_legacy-modes_mode_tiki.js +20 -0
  139. package/src/assets/codemirror/@codemirror_legacy-modes_mode_toml.js +4 -0
  140. package/src/assets/codemirror/@codemirror_legacy-modes_mode_troff.js +1 -0
  141. package/src/assets/codemirror/@codemirror_legacy-modes_mode_ttcn-cfg.js +3 -0
  142. package/src/assets/codemirror/@codemirror_legacy-modes_mode_ttcn.js +3 -0
  143. package/src/assets/codemirror/@codemirror_legacy-modes_mode_turtle.js +1 -0
  144. package/src/assets/codemirror/@codemirror_legacy-modes_mode_vb.js +11 -0
  145. package/src/assets/codemirror/@codemirror_legacy-modes_mode_vbscript.js +26 -0
  146. package/src/assets/codemirror/@codemirror_legacy-modes_mode_velocity.js +15 -0
  147. package/src/assets/codemirror/@codemirror_legacy-modes_mode_verilog.js +67 -0
  148. package/src/assets/codemirror/@codemirror_legacy-modes_mode_vhdl.js +2 -0
  149. package/src/assets/codemirror/@codemirror_legacy-modes_mode_wast.js +7 -0
  150. package/src/assets/codemirror/@codemirror_legacy-modes_mode_webidl.js +25 -0
  151. package/src/assets/codemirror/@codemirror_legacy-modes_mode_xml.js +6 -0
  152. package/src/assets/codemirror/@codemirror_legacy-modes_mode_xquery.js +51 -0
  153. package/src/assets/codemirror/@codemirror_legacy-modes_mode_yacas.js +16 -0
  154. package/src/assets/codemirror/@codemirror_legacy-modes_mode_yaml.js +1 -0
  155. package/src/assets/codemirror/@codemirror_legacy-modes_mode_z80.js +1 -0
  156. package/src/assets/codemirror/@codemirror_lint.js +46 -0
  157. package/src/assets/codemirror/@codemirror_merge.js +167 -0
  158. package/src/assets/codemirror/@codemirror_search.js +121 -0
  159. package/src/assets/codemirror/@codemirror_state.js +793 -0
  160. package/src/assets/codemirror/@codemirror_theme-one-dark.js +12 -0
  161. package/src/assets/codemirror/@codemirror_view.js +1210 -0
  162. package/src/assets/codemirror/@lezer_common.js +407 -0
  163. package/src/assets/codemirror/@lezer_cpp.js +4 -0
  164. package/src/assets/codemirror/@lezer_css.js +4 -0
  165. package/src/assets/codemirror/@lezer_go.js +3 -0
  166. package/src/assets/codemirror/@lezer_highlight.js +380 -0
  167. package/src/assets/codemirror/@lezer_html.js +20 -0
  168. package/src/assets/codemirror/@lezer_java.js +2 -0
  169. package/src/assets/codemirror/@lezer_javascript.js +7 -0
  170. package/src/assets/codemirror/@lezer_json.js +2 -0
  171. package/src/assets/codemirror/@lezer_lezer.js +2 -0
  172. package/src/assets/codemirror/@lezer_lr.js +325 -0
  173. package/src/assets/codemirror/@lezer_markdown.js +286 -0
  174. package/src/assets/codemirror/@lezer_php.js +3 -0
  175. package/src/assets/codemirror/@lezer_python.js +5 -0
  176. package/src/assets/codemirror/@lezer_rust.js +3 -0
  177. package/src/assets/codemirror/@lezer_sass.js +5 -0
  178. package/src/assets/codemirror/@lezer_xml.js +3 -0
  179. package/src/assets/codemirror/@lezer_yaml.js +12 -0
  180. package/src/assets/codemirror/@marijn_find-cluster-break.js +10 -0
  181. package/src/assets/codemirror/@uiw_codemirror-theme-androidstudio.js +3 -0
  182. package/src/assets/codemirror/@uiw_codemirror-theme-andromeda.js +1 -0
  183. package/src/assets/codemirror/@uiw_codemirror-theme-atomone.js +6 -0
  184. package/src/assets/codemirror/@uiw_codemirror-theme-aura.js +1 -0
  185. package/src/assets/codemirror/@uiw_codemirror-theme-basic.js +1 -0
  186. package/src/assets/codemirror/@uiw_codemirror-theme-bbedit.js +1 -0
  187. package/src/assets/codemirror/@uiw_codemirror-theme-copilot.js +1 -0
  188. package/src/assets/codemirror/@uiw_codemirror-theme-darcula.js +6 -0
  189. package/src/assets/codemirror/@uiw_codemirror-theme-dracula.js +6 -0
  190. package/src/assets/codemirror/@uiw_codemirror-theme-duotone.js +5 -0
  191. package/src/assets/codemirror/@uiw_codemirror-theme-eclipse.js +1 -0
  192. package/src/assets/codemirror/@uiw_codemirror-theme-github.js +3 -0
  193. package/src/assets/codemirror/@uiw_codemirror-theme-material.js +1 -0
  194. package/src/assets/codemirror/@uiw_codemirror-theme-monokai.js +1 -0
  195. package/src/assets/codemirror/@uiw_codemirror-theme-nord.js +2 -0
  196. package/src/assets/codemirror/@uiw_codemirror-theme-okaidia.js +2 -0
  197. package/src/assets/codemirror/@uiw_codemirror-theme-solarized.js +1 -0
  198. package/src/assets/codemirror/@uiw_codemirror-theme-sublime.js +2 -0
  199. package/src/assets/codemirror/@uiw_codemirror-theme-tokyo-night.js +1 -0
  200. package/src/assets/codemirror/@uiw_codemirror-theme-vscode.js +5 -0
  201. package/src/assets/codemirror/@uiw_codemirror-theme-xcode.js +3 -0
  202. package/src/assets/codemirror/@uiw_codemirror-themes.js +1 -0
  203. package/src/assets/codemirror/_core.js +4494 -0
  204. package/src/assets/codemirror/codemirror.js +46 -0
  205. package/src/assets/codemirror/crelt.js +1 -0
  206. package/src/assets/codemirror/style-mod.js +36 -0
  207. package/src/assets/codemirror/w3c-keyname.js +8 -0
  208. package/src/assets/codemirror-editor.umd.js +415 -0
  209. package/src/assets/editor.html +377 -0
  210. package/src/assets/webview-interface.umd.js +2 -0
@@ -0,0 +1,325 @@
1
+ async function moduleInitFunction(requireAsyncModule,exports={}){const module={exports:exports};var hasRequiredDist,require$$0=await requireAsyncModule("@lezer/common"),dist={},distExports=function requireDist(){// See lezer-generator/src/encode.ts for comments about the encoding
2
+ // used here
3
+ function decodeArray(input,Type=Uint16Array){if("string"!=typeof input)return input;let array=null;for(let value,pos=0,out=0;pos<input.length;){for(value=0;;){let next=input.charCodeAt(pos++),stop=!1;if(126==next/* Encode.BigValCode */){value=65535/* Encode.BigVal */;break}92<=next/* Encode.Gap2 */&&next--,34<=next/* Encode.Gap1 */&&next--;let digit=next-32/* Encode.Start */;if(46<=digit/* Encode.Base */&&(digit-=46/* Encode.Base */,stop=!0),value+=digit,stop)break;value*=46/* Encode.Base */}array?array[out++]=value:array=new Type(value)}return array}// Tokenizer data is stored a big uint16 array containing, for each
4
+ // state:
5
+ //
6
+ // - A group bitmask, indicating what token groups are reachable from
7
+ // this state, so that paths that can only lead to tokens not in
8
+ // any of the current groups can be cut off early.
9
+ //
10
+ // - The position of the end of the state's sequence of accepting
11
+ // tokens
12
+ //
13
+ // - The number of outgoing edges for the state
14
+ //
15
+ // - The accepting tokens, as (token id, group mask) pairs
16
+ //
17
+ // - The outgoing edges, as (start character, end character, state
18
+ // index) triples, with end character being exclusive
19
+ //
20
+ // This function interprets that data, running through a stream as
21
+ // long as new states with the a matching group mask can be reached,
22
+ // and updating `input.token` when it matches a token.
23
+ function readToken(data,input,stack,group,precTable,precOffset){let state=0,groupMask=1<<group,{dialect}=stack.p.parser;scan:for(;;){if(0==(groupMask&data[state]))break;let accEnd=data[state+1];// Check whether this state can lead to a token in the current group
24
+ // Accept tokens in this state, possibly overwriting
25
+ // lower-precedence / shorter tokens
26
+ for(let i=state+3;i<accEnd;i+=2)if(0<(data[i+1]&groupMask)){let term=data[i];if(dialect.allows(term)&&(-1==input.token.value||input.token.value==term||overrides(term,input.token.value,precTable,precOffset))){input.acceptToken(term);break}}let next=input.next,low=0,high=data[state+2];// Special case for EOF
27
+ if(0>input.next&&high>low&&65535==data[accEnd+3*high-3]/* Seq.End */){state=data[accEnd+3*high-1];continue scan}// Do a binary search on the state's edges
28
+ for(;low<high;){let mid=low+high>>1,index=accEnd+mid+(mid<<1),from=data[index],to=data[index+1]||65536;if(next<from)high=mid;else if(next>=to)low=mid+1;else{state=data[index+2],input.advance();continue scan}}break}}function findOffset(data,start,term){for(let next,i=start;65535!=(next=data[i])/* Seq.End */;i++)if(next==term)return i-start;return-1}function overrides(token,prev,tableData,tableOffset){let iPrev=findOffset(tableData,tableOffset,prev);return 0>iPrev||findOffset(tableData,tableOffset,token)<iPrev}// Environment variable used to control console output
29
+ function cutAt(tree,pos,side){let cursor=tree.cursor(common.IterMode.IncludeAnonymous);for(cursor.moveTo(pos);;)if(0>side?!cursor.childBefore(pos):!cursor.childAfter(pos))for(;;){if((0>side?cursor.to<pos:cursor.from>pos)&&!cursor.type.isError)return 0>side?Math.max(0,Math.min(cursor.to-1,pos-25/* Lookahead.Margin */)):Math.min(tree.length,Math.max(cursor.from+1,pos+25/* Lookahead.Margin */));if(0>side?cursor.prevSibling():cursor.nextSibling())break;if(!cursor.parent())return 0>side?0:tree.length}}function pushStackDedup(stack,newStacks){for(let other,i=0;i<newStacks.length;i++)if(other=newStacks[i],other.pos==stack.pos&&other.sameState(stack))return void(newStacks[i].score<stack.score&&(newStacks[i]=stack));newStacks.push(stack)}function pair(data,off){return data[off]|data[off+1]<<16}function findFinished(stacks){let best=null;for(let stack of stacks){let stopped=stack.p.stoppedAt;(stack.pos==stack.p.stream.end||null!=stopped&&stack.pos>stopped)&&stack.p.parser.stateFlag(stack.state,2/* StateFlag.Accepting */)&&(!best||best.score<stack.score)&&(best=stack)}return best}function getSpecializer(spec){if(spec.external){let mask=spec.extend?1/* Specialize.Extend */:0/* Specialize.Specialize */;return(value,stack)=>spec.external(value,stack)<<1|mask}return spec.get}if(hasRequiredDist)return dist;hasRequiredDist=1;var common=require$$0;/**
30
+ A parse stack. These are used internally by the parser to track
31
+ parsing progress. They also provide some properties and methods
32
+ that external code such as a tokenizer can use to get information
33
+ about the parse state.
34
+ */class Stack{/**
35
+ @internal
36
+ */constructor(/**
37
+ The parse that this stack is part of @internal
38
+ */p,/**
39
+ Holds state, input pos, buffer index triplets for all but the
40
+ top state @internal
41
+ */stack,/**
42
+ The current parse state @internal
43
+ */state,// The position at which the next reduce should take place. This
44
+ // can be less than `this.pos` when skipped expressions have been
45
+ // added to the stack (which should be moved outside of the next
46
+ // reduction)
47
+ /**
48
+ @internal
49
+ */reducePos,/**
50
+ The input position up to which this stack has parsed.
51
+ */pos,/**
52
+ The dynamic score of the stack, including dynamic precedence
53
+ and error-recovery penalties
54
+ @internal
55
+ */score,// The output buffer. Holds (type, start, end, size) quads
56
+ // representing nodes created by the parser, where `size` is
57
+ // amount of buffer array entries covered by this node.
58
+ /**
59
+ @internal
60
+ */buffer,// The base offset of the buffer. When stacks are split, the split
61
+ // instance shared the buffer history with its parent up to
62
+ // `bufferBase`, which is the absolute offset (including the
63
+ // offset of previous splits) into the buffer at which this stack
64
+ // starts writing.
65
+ /**
66
+ @internal
67
+ */bufferBase,/**
68
+ @internal
69
+ */curContext,/**
70
+ @internal
71
+ */lookAhead=0,// A parent stack from which this was split off, if any. This is
72
+ // set up so that it always points to a stack that has some
73
+ // additional buffer content, never to a stack with an equal
74
+ // `bufferBase`.
75
+ /**
76
+ @internal
77
+ */parent){this.p=p,this.stack=stack,this.state=state,this.reducePos=reducePos,this.pos=pos,this.score=score,this.buffer=buffer,this.bufferBase=bufferBase,this.curContext=curContext,this.lookAhead=lookAhead,this.parent=parent}/**
78
+ @internal
79
+ */toString(){return`[${this.stack.filter((_,i)=>0==i%3).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}// Start an empty stack
80
+ /**
81
+ @internal
82
+ */static start(p,state,pos=0){let cx=p.parser.context;return new Stack(p,[],state,pos,pos,0,[],0,cx?new StackContext(cx,cx.start):null,0,null)}/**
83
+ The stack's current [context](#lr.ContextTracker) value, if
84
+ any. Its type will depend on the context tracker's type
85
+ parameter, or it will be `null` if there is no context
86
+ tracker.
87
+ */get context(){return this.curContext?this.curContext.context:null}// Push a state onto the stack, tracking its start position as well
88
+ // as the buffer base at that point.
89
+ /**
90
+ @internal
91
+ */pushState(state,start){this.stack.push(this.state,start,this.bufferBase+this.buffer.length),this.state=state}// Apply a reduce action
92
+ /**
93
+ @internal
94
+ */reduce(action){var _a;let depth=action>>19/* Action.ReduceDepthShift */,type=65535&action/* Action.ValueMask */,{parser}=this.p,lookaheadRecord=this.reducePos<this.pos-25/* Lookahead.Margin */&&this.setLookAhead(this.pos),dPrec=parser.dynamicPrecedence(type);if(dPrec&&(this.score+=dPrec),0==depth)return type<parser.minRepeatTerm&&this.reducePos<this.pos&&(this.reducePos=this.pos),this.pushState(parser.getGoto(this.state,type,!0),this.reducePos),type<parser.minRepeatTerm&&this.storeNode(type,this.reducePos,this.reducePos,lookaheadRecord?8:4,!0),void this.reduceContext(type,this.reducePos);// Find the base index into `this.stack`, content after which will
95
+ // be dropped. Note that with `StayFlag` reductions we need to
96
+ // consume two extra frames (the dummy parent node for the skipped
97
+ // expression and the state that we'll be staying in, which should
98
+ // be moved to `this.state`).
99
+ let base=this.stack.length-3*(depth-1)-(262144&action/* Action.StayFlag */?6:0),start=base?this.stack[base-2]:this.p.ranges[0].from;type<parser.minRepeatTerm&&start==this.reducePos&&this.reducePos<this.pos&&(this.reducePos=this.pos);let size=this.reducePos-start;// This is a kludge to try and detect overly deep left-associative
100
+ // trees, which will not increase the parse stack depth and thus
101
+ // won't be caught by the regular stack-depth limit check.
102
+ !(2e3<=size/* Recover.MinBigReduction */)||null!==(_a=this.p.parser.nodeSet.types[type])&&void 0!==_a&&_a.isAnonymous||(start==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=size):this.p.lastBigReductionSize<size&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=start,this.p.lastBigReductionSize=size));let bufferBase=base?this.stack[base-1]:0,count=this.bufferBase+this.buffer.length-bufferBase;// Store normal terms or `R -> R R` repeat reductions
103
+ if(type<parser.minRepeatTerm||131072&action/* Action.RepeatFlag */){let pos=parser.stateFlag(this.state,1/* StateFlag.Skipped */)?this.pos:this.reducePos;this.storeNode(type,start,pos,count+4,!0)}if(262144&action/* Action.StayFlag */)this.state=this.stack[base];else{let baseStateID=this.stack[base-3];this.state=parser.getGoto(baseStateID,type,!0)}for(;this.stack.length>base;)this.stack.pop();this.reduceContext(type,start)}// Shift a value into the buffer
104
+ /**
105
+ @internal
106
+ */storeNode(term,start,end,size=4,mustSink=!1){if(0==term/* Term.Err */&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){// Try to omit/merge adjacent error nodes
107
+ let top=this.buffer.length;if(0<top&&0==this.buffer[top-4]/* Term.Err */&&-1<this.buffer[top-1]){if(start==end)return;if(this.buffer[top-2]>=start)return void(this.buffer[top-2]=end)}}if(!mustSink||this.pos==end)this.buffer.push(term,start,end,size);else{// There may be skipped nodes that have to be moved forward
108
+ let index=this.buffer.length;if(0<index&&(0!=this.buffer[index-4]/* Term.Err */||0>this.buffer[index-1])){let mustMove=!1;for(let scan=index;0<scan&&this.buffer[scan-2]>end;scan-=4)if(0<=this.buffer[scan-1]){mustMove=!0;break}if(mustMove)for(;0<index&&this.buffer[index-2]>end;)// Move this record forward
109
+ this.buffer[index]=this.buffer[index-4],this.buffer[index+1]=this.buffer[index-3],this.buffer[index+2]=this.buffer[index-2],this.buffer[index+3]=this.buffer[index-1],index-=4,4<size&&(size-=4)}this.buffer[index]=term,this.buffer[index+1]=start,this.buffer[index+2]=end,this.buffer[index+3]=size}}// Apply a shift action
110
+ /**
111
+ @internal
112
+ */shift(action,type,start,end){if(131072&action/* Action.GotoFlag */)this.pushState(65535&action/* Action.ValueMask */,this.pos);else if(0==(262144&action/* Action.StayFlag */)){// Regular shift
113
+ let nextState=action,{parser}=this.p;this.pos=end;let skipped=parser.stateFlag(nextState,1/* StateFlag.Skipped */);// Skipped or zero-length non-tree tokens don't move reducePos
114
+ !skipped&&(end>start||type<=parser.maxNode)&&(this.reducePos=end),this.pushState(nextState,skipped?start:Math.min(start,this.reducePos)),this.shiftContext(type,start),type<=parser.maxNode&&this.buffer.push(type,start,end,4)}else// Shift-and-stay, which means this is a skipped token
115
+ this.pos=end,this.shiftContext(type,start),type<=this.p.parser.maxNode&&this.buffer.push(type,start,end,4)}// Apply an action
116
+ /**
117
+ @internal
118
+ */apply(action,next,nextStart,nextEnd){65536&action/* Action.ReduceFlag */?this.reduce(action):this.shift(action,next,nextStart,nextEnd)}// Add a prebuilt (reused) node into the buffer.
119
+ /**
120
+ @internal
121
+ */useNode(value,next){let index=this.p.reused.length-1;(0>index||this.p.reused[index]!=value)&&(this.p.reused.push(value),index++);let start=this.pos;this.reducePos=this.pos=start+value.length,this.pushState(next,start),this.buffer.push(index,start,this.reducePos,-1/* size == -1 means this is a reused value */),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,value,this,this.p.stream.reset(this.pos-value.length)))}// Split the stack. Due to the buffer sharing and the fact
122
+ // that `this.stack` tends to stay quite shallow, this isn't very
123
+ // expensive.
124
+ /**
125
+ @internal
126
+ */split(){let parent=this,off=parent.buffer.length;// Leave off top error node, if there, because that might be
127
+ // merged with other nodes.
128
+ // Because the top of the buffer (after this.pos) may be mutated
129
+ // to reorder reductions and skipped tokens, and shared buffers
130
+ // should be immutable, this copies any outstanding skipped tokens
131
+ // to the new buffer, and puts the base pointer before them.
132
+ for(off&&0==parent.buffer[off-4]/* Term.Err */&&(off-=4);0<off&&parent.buffer[off-2]>parent.reducePos;)off-=4;let buffer=parent.buffer.slice(off),base=parent.bufferBase+off;// Make sure parent points to an actual parent with content, if there is such a parent.
133
+ for(;parent&&base==parent.bufferBase;)parent=parent.parent;return new Stack(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,buffer,base,this.curContext,this.lookAhead,parent)}// Try to recover from an error by 'deleting' (ignoring) one token.
134
+ /**
135
+ @internal
136
+ */recoverByDelete(next,nextEnd){let isNode=next<=this.p.parser.maxNode;isNode&&this.storeNode(next,this.pos,nextEnd,4),this.storeNode(0/* Term.Err */,this.pos,nextEnd,isNode?8:4),this.pos=this.reducePos=nextEnd,this.score-=190/* Recover.Delete */}/**
137
+ Check if the given term would be able to be shifted (optionally
138
+ after some reductions) on this stack. This can be useful for
139
+ external tokenizers that want to make sure they only provide a
140
+ given token when it applies.
141
+ */canShift(term){for(let action,sim=new SimulatedStack(this);;){if(action=this.p.parser.stateSlot(sim.state,4/* ParseState.DefaultReduce */)||this.p.parser.hasAction(sim.state,term),0==action)return!1;if(0==(65536&action/* Action.ReduceFlag */))return!0;sim.reduce(action)}}// Apply up to Recover.MaxNext recovery actions that conceptually
142
+ // inserts some missing token or rule.
143
+ /**
144
+ @internal
145
+ */recoverByInsert(next){if(300<=this.stack.length/* Recover.MaxInsertStackDepth */)return[];let nextStates=this.p.parser.nextStates(this.state);if(8<nextStates.length||120<=this.stack.length/* Recover.DampenInsertStackDepth */){let best=[];for(let s,i=0;i<nextStates.length;i+=2)(s=nextStates[i+1])!=this.state&&this.p.parser.hasAction(s,next)&&best.push(nextStates[i],s);if(120>this.stack.length/* Recover.DampenInsertStackDepth */)for(let s,i=0;8>best.length&&i<nextStates.length;i+=2)s=nextStates[i+1],best.some((v,i)=>1&i&&v==s)||best.push(nextStates[i],s);nextStates=best}let result=[];for(let s,i=0;i<nextStates.length&&4>result.length/* Recover.MaxNext */;i+=2){if(s=nextStates[i+1],s==this.state)continue;let stack=this.split();stack.pushState(s,this.pos),stack.storeNode(0/* Term.Err */,stack.pos,stack.pos,4,!0),stack.shiftContext(nextStates[i],this.pos),stack.reducePos=this.pos,stack.score-=200/* Recover.Insert */,result.push(stack)}return result}// Force a reduce, if possible. Return false if that can't
146
+ // be done.
147
+ /**
148
+ @internal
149
+ */forceReduce(){let{parser}=this.p,reduce=parser.stateSlot(this.state,5/* ParseState.ForcedReduce */);if(0==(65536&reduce/* Action.ReduceFlag */))return!1;if(!parser.validAction(this.state,reduce)){let depth=reduce>>19/* Action.ReduceDepthShift */,term=65535&reduce/* Action.ValueMask */,target=this.stack.length-3*depth;if(0>target||0>parser.getGoto(this.stack[target],term,!1)){let backup=this.findForcedReduction();if(null==backup)return!1;reduce=backup}this.storeNode(0/* Term.Err */,this.pos,this.pos,4,!0),this.score-=100/* Recover.Reduce */}return this.reducePos=this.pos,this.reduce(reduce),!0}/**
150
+ Try to scan through the automaton to find some kind of reduction
151
+ that can be applied. Used when the regular ForcedReduce field
152
+ isn't a valid action. @internal
153
+ */findForcedReduction(){let{parser}=this.p,seen=[],explore=(state,depth)=>{if(!seen.includes(state))return seen.push(state),parser.allActions(state,action=>{if(393216/* Action.GotoFlag */&action);else if(65536&action/* Action.ReduceFlag */){let rDepth=(action>>19/* Action.ReduceDepthShift */)-depth;if(1<rDepth){let term=65535&action/* Action.ValueMask */,target=this.stack.length-3*rDepth;if(0<=target&&0<=parser.getGoto(this.stack[target],term,!1))return 65536|rDepth<<19/* Action.ReduceDepthShift */ /* Action.ReduceFlag */|term}}else{let found=explore(action,depth+1);if(null!=found)return found}})};return explore(this.state,0)}/**
154
+ @internal
155
+ */forceAll(){for(;!this.p.parser.stateFlag(this.state,2/* StateFlag.Accepting */);)if(!this.forceReduce()){this.storeNode(0/* Term.Err */,this.pos,this.pos,4,!0);break}return this}/**
156
+ Check whether this state has no further actions (assumed to be a direct descendant of the
157
+ top state, since any other states must be able to continue
158
+ somehow). @internal
159
+ */get deadEnd(){if(3!=this.stack.length)return!1;let{parser}=this.p;return 65535==parser.data[parser.stateSlot(this.state,1/* ParseState.Actions */)]/* Seq.End */&&!parser.stateSlot(this.state,4/* ParseState.DefaultReduce */)}/**
160
+ Restart the stack (put it back in its start state). Only safe
161
+ when this.stack.length == 3 (state is directly below the top
162
+ state). @internal
163
+ */restart(){this.storeNode(0/* Term.Err */,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}/**
164
+ @internal
165
+ */sameState(other){if(this.state!=other.state||this.stack.length!=other.stack.length)return!1;for(let i=0;i<this.stack.length;i+=3)if(this.stack[i]!=other.stack[i])return!1;return!0}/**
166
+ Get the parser used by this stack.
167
+ */get parser(){return this.p.parser}/**
168
+ Test whether a given dialect (by numeric ID, as exported from
169
+ the terms file) is enabled.
170
+ */dialectEnabled(dialectID){return this.p.parser.dialect.flags[dialectID]}shiftContext(term,start){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,term,this,this.p.stream.reset(start)))}reduceContext(term,start){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,term,this,this.p.stream.reset(start)))}/**
171
+ @internal
172
+ */emitContext(){let last=this.buffer.length-1;(0>last||-3!=this.buffer[last])&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}/**
173
+ @internal
174
+ */emitLookAhead(){let last=this.buffer.length-1;(0>last||-4!=this.buffer[last])&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(context){if(context!=this.curContext.context){let newCx=new StackContext(this.curContext.tracker,context);newCx.hash!=this.curContext.hash&&this.emitContext(),this.curContext=newCx}}/**
175
+ @internal
176
+ */setLookAhead(lookAhead){return!(lookAhead<=this.lookAhead)&&(this.emitLookAhead(),this.lookAhead=lookAhead,!0)}/**
177
+ @internal
178
+ */close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),0<this.lookAhead&&this.emitLookAhead()}}class StackContext{constructor(tracker,context){this.tracker=tracker,this.context=context,this.hash=tracker.strict?tracker.hash(context):0}}// Used to cheaply run some reductions to scan ahead without mutating
179
+ // an entire stack
180
+ class SimulatedStack{constructor(start){this.start=start,this.state=start.state,this.stack=start.stack,this.base=this.stack.length}reduce(action){let term=65535&action/* Action.ValueMask */,depth=action>>19/* Action.ReduceDepthShift */;0==depth?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=3*(depth-1);let goto=this.start.p.parser.getGoto(this.stack[this.base-3],term,!0);this.state=goto}}// This is given to `Tree.build` to build a buffer, and encapsulates
181
+ // the parent-stack-walking necessary to read the nodes.
182
+ class StackBufferCursor{constructor(stack,pos,index){this.stack=stack,this.pos=pos,this.index=index,this.buffer=stack.buffer,0==this.index&&this.maybeNext()}static create(stack,pos=stack.bufferBase+stack.buffer.length){return new StackBufferCursor(stack,pos,pos-stack.bufferBase)}maybeNext(){let next=this.stack.parent;null!=next&&(this.index=this.stack.bufferBase-next.bufferBase,this.stack=next,this.buffer=next.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,0==this.index&&this.maybeNext()}fork(){return new StackBufferCursor(this.stack,this.pos,this.index)}}class CachedToken{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const nullToken=new CachedToken;/**
183
+ [Tokenizers](#lr.ExternalTokenizer) interact with the input
184
+ through this interface. It presents the input as a stream of
185
+ characters, tracking lookahead and hiding the complexity of
186
+ [ranges](#common.Parser.parse^ranges) from tokenizer code.
187
+ */class InputStream{/**
188
+ @internal
189
+ */constructor(/**
190
+ @internal
191
+ */input,/**
192
+ @internal
193
+ */ranges){this.input=input,this.ranges=ranges,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=nullToken,this.rangeIndex=0,this.pos=this.chunkPos=ranges[0].from,this.range=ranges[0],this.end=ranges[ranges.length-1].to,this.readNext()}/**
194
+ @internal
195
+ */resolveOffset(offset,assoc){let range=this.range,index=this.rangeIndex,pos=this.pos+offset;for(;pos<range.from;){if(!index)return null;let next=this.ranges[--index];pos-=range.from-next.to,range=next}for(;0>assoc?pos>range.to:pos>=range.to;){if(index==this.ranges.length-1)return null;let next=this.ranges[++index];pos+=next.from-range.to,range=next}return pos}/**
196
+ @internal
197
+ */clipPos(pos){if(pos>=this.range.from&&pos<this.range.to)return pos;for(let range of this.ranges)if(range.to>pos)return Math.max(pos,range.from);return this.end}/**
198
+ Look at a code unit near the stream position. `.peek(0)` equals
199
+ `.next`, `.peek(-1)` gives you the previous character, and so
200
+ on.
201
+
202
+ Note that looking around during tokenizing creates dependencies
203
+ on potentially far-away content, which may reduce the
204
+ effectiveness incremental parsing—when looking forward—or even
205
+ cause invalid reparses when looking backward more than 25 code
206
+ units, since the library does not track lookbehind.
207
+ */peek(offset){let pos,result,idx=this.chunkOff+offset;if(0<=idx&&idx<this.chunk.length)pos=this.pos+offset,result=this.chunk.charCodeAt(idx);else{let resolved=this.resolveOffset(offset,1);if(null==resolved)return-1;if(pos=resolved,pos>=this.chunk2Pos&&pos<this.chunk2Pos+this.chunk2.length)result=this.chunk2.charCodeAt(pos-this.chunk2Pos);else{let i=this.rangeIndex,range=this.range;for(;range.to<=pos;)range=this.ranges[++i];this.chunk2=this.input.chunk(this.chunk2Pos=pos),pos+this.chunk2.length>range.to&&(this.chunk2=this.chunk2.slice(0,range.to-pos)),result=this.chunk2.charCodeAt(0)}}return pos>=this.token.lookAhead&&(this.token.lookAhead=pos+1),result}/**
208
+ Accept a token. By default, the end of the token is set to the
209
+ current stream position, but you can pass an offset (relative to
210
+ the stream position) to change that.
211
+ */acceptToken(token,endOffset=0){let end=endOffset?this.resolveOffset(endOffset,-1):this.pos;if(null==end||end<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=token,this.token.end=end}/**
212
+ Accept a token ending at a specific given position.
213
+ */acceptTokenTo(token,endPos){this.token.value=token,this.token.end=endPos}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk,chunkPos}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=chunk,this.chunk2Pos=chunkPos,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let nextChunk=this.input.chunk(this.pos),end=this.pos+nextChunk.length;this.chunk=end>this.range.to?nextChunk.slice(0,this.range.to-this.pos):nextChunk,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}/**
214
+ Move the stream forward N (defaults to 1) code units. Returns
215
+ the new value of [`next`](#lr.InputStream.next).
216
+ */advance(n=1){for(this.chunkOff+=n;this.pos+n>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();n-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=n,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}/**
217
+ @internal
218
+ */reset(pos,token){if(token?(this.token=token,token.start=pos,token.lookAhead=pos+1,token.value=token.extended=-1):this.token=nullToken,this.pos!=pos){if(this.pos=pos,pos==this.end)return this.setDone(),this;for(;pos<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;pos>=this.range.to;)this.range=this.ranges[++this.rangeIndex];pos>=this.chunkPos&&pos<this.chunkPos+this.chunk.length?this.chunkOff=pos-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}/**
219
+ @internal
220
+ */read(from,to){if(from>=this.chunkPos&&to<=this.chunkPos+this.chunk.length)return this.chunk.slice(from-this.chunkPos,to-this.chunkPos);if(from>=this.chunk2Pos&&to<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(from-this.chunk2Pos,to-this.chunk2Pos);if(from>=this.range.from&&to<=this.range.to)return this.input.read(from,to);let result="";for(let r of this.ranges){if(r.from>=to)break;r.to>from&&(result+=this.input.read(Math.max(r.from,from),Math.min(r.to,to)))}return result}}/**
221
+ @internal
222
+ */class TokenGroup{constructor(data,id){this.data=data,this.id=id}token(input,stack){let{parser}=stack.p;readToken(this.data,input,stack,this.id,parser.data,parser.tokenPrecTable)}}TokenGroup.prototype.contextual=TokenGroup.prototype.fallback=TokenGroup.prototype.extend=!1;/**
223
+ @hide
224
+ */class LocalTokenGroup{constructor(data,precTable,elseToken){this.precTable=precTable,this.elseToken=elseToken,this.data="string"==typeof data?decodeArray(data):data}token(input,stack){let start=input.pos,skipped=0;for(;;){let atEof=0>input.next,nextPos=input.resolveOffset(1,1);if(readToken(this.data,input,stack,0,this.data,this.precTable),-1<input.token.value)break;if(null==this.elseToken)return;if(atEof||skipped++,null==nextPos)break;input.reset(nextPos,input.token)}skipped&&(input.reset(start,input.token),input.acceptToken(this.elseToken,skipped))}}LocalTokenGroup.prototype.contextual=TokenGroup.prototype.fallback=TokenGroup.prototype.extend=!1;/**
225
+ `@external tokens` declarations in the grammar should resolve to
226
+ an instance of this class.
227
+ */class ExternalTokenizer{/**
228
+ Create a tokenizer. The first argument is the function that,
229
+ given an input stream, scans for the types of tokens it
230
+ recognizes at the stream's position, and calls
231
+ [`acceptToken`](#lr.InputStream.acceptToken) when it finds
232
+ one.
233
+ */constructor(/**
234
+ @internal
235
+ */token,options={}){this.token=token,this.contextual=!!options.contextual,this.fallback=!!options.fallback,this.extend=!!options.extend}}const verbose="undefined"!=typeof process&&process.env&&/\bparse\b/.test(process.env.LOG);let stackIDs=null;class FragmentCursor{constructor(fragments,nodeSet){this.fragments=fragments,this.nodeSet=nodeSet,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let fr=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(fr){for(this.safeFrom=fr.openStart?cutAt(fr.tree,fr.from+fr.offset,1)-fr.offset:fr.from,this.safeTo=fr.openEnd?cutAt(fr.tree,fr.to+fr.offset,-1)-fr.offset:fr.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(fr.tree),this.start.push(-fr.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}// `pos` must be >= any previously given `pos` for this cursor
236
+ nodeAt(pos){if(pos<this.nextStart)return null;for(;this.fragment&&this.safeTo<=pos;)this.nextFragment();if(!this.fragment)return null;for(;;){let last=this.trees.length-1;if(0>last)return this.nextFragment(),null;let top=this.trees[last],index=this.index[last];if(index==top.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let next=top.children[index],start=this.start[last]+top.positions[index];if(start>pos)return this.nextStart=start,null;if(next instanceof common.Tree){if(start==pos){if(start<this.safeFrom)return null;let end=start+next.length;if(end<=this.safeTo){let lookAhead=next.prop(common.NodeProp.lookAhead);if(!lookAhead||end+lookAhead<this.fragment.to)return next}}this.index[last]++,start+next.length>=Math.max(this.safeFrom,pos)&&(this.trees.push(next),this.start.push(start),this.index.push(0))}else this.index[last]++,this.nextStart=start+next.length}}}class TokenCache{constructor(parser,stream){this.stream=stream,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=parser.tokenizers.map(_=>new CachedToken)}getActions(stack){let actionIndex=0,main=null,{parser}=stack.p,{tokenizers}=parser,mask=parser.stateSlot(stack.state,3/* ParseState.TokenizerMask */),context=stack.curContext?stack.curContext.hash:0,lookAhead=0;for(let i=0;i<tokenizers.length;i++){if(0==(1<<i&mask))continue;let tokenizer=tokenizers[i],token=this.tokens[i];if((!main||tokenizer.fallback)&&((tokenizer.contextual||token.start!=stack.pos||token.mask!=mask||token.context!=context)&&(this.updateCachedToken(token,tokenizer,stack),token.mask=mask,token.context=context),token.lookAhead>token.end+25/* Lookahead.Margin */&&(lookAhead=Math.max(token.lookAhead,lookAhead)),0!=token.value/* Term.Err */)){let startIndex=actionIndex;if(-1<token.extended&&(actionIndex=this.addActions(stack,token.extended,token.end,actionIndex)),actionIndex=this.addActions(stack,token.value,token.end,actionIndex),!tokenizer.extend&&(main=token,actionIndex>startIndex))break}}for(;this.actions.length>actionIndex;)this.actions.pop();return lookAhead&&stack.setLookAhead(lookAhead),main||stack.pos!=this.stream.end||(main=new CachedToken,main.value=stack.p.parser.eofTerm,main.start=main.end=stack.pos,actionIndex=this.addActions(stack,main.value,main.end,actionIndex)),this.mainToken=main,this.actions}getMainToken(stack){if(this.mainToken)return this.mainToken;let main=new CachedToken,{pos,p}=stack;return main.start=pos,main.end=Math.min(pos+1,p.stream.end),main.value=pos==p.stream.end?p.parser.eofTerm:0/* Term.Err */,main}updateCachedToken(token,tokenizer,stack){let start=this.stream.clipPos(stack.pos);if(tokenizer.token(this.stream.reset(start,token),stack),-1<token.value){let{parser}=stack.p;for(let i=0;i<parser.specialized.length;i++)if(parser.specialized[i]==token.value){let result=parser.specializers[i](this.stream.read(token.start,token.end),stack);if(0<=result&&stack.p.parser.dialect.allows(result>>1)){0==(1&result)/* Specialize.Specialize */?token.value=result>>1:token.extended=result>>1;break}}}else token.value=0/* Term.Err */,token.end=this.stream.clipPos(start+1)}putAction(action,token,end,index){// Don't add duplicate actions
237
+ for(let i=0;i<index;i+=3)if(this.actions[i]==action)return index;return this.actions[index++]=action,this.actions[index++]=token,this.actions[index++]=end,index}addActions(stack,token,end,index){let{state}=stack,{parser}=stack.p,{data}=parser;for(let set=0;2>set;set++)for(let i=parser.stateSlot(state,set?2/* ParseState.Skip */:1/* ParseState.Actions */);;i+=3){if(65535==data[i]/* Seq.End */)if(1==data[i+1]/* Seq.Next */)i=pair(data,i+2);else{0==index&&2==data[i+1]/* Seq.Other */&&(index=this.putAction(pair(data,i+2),token,end,index));break}data[i]==token&&(index=this.putAction(pair(data,i+1),token,end,index))}return index}}class Parse{constructor(parser,input,fragments,ranges){this.parser=parser,this.input=input,this.ranges=ranges,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new InputStream(input,ranges),this.tokens=new TokenCache(parser,this.stream),this.topTerm=parser.top[1];let{from}=ranges[0];this.stacks=[Stack.start(this,parser.top[0],from)],this.fragments=fragments.length&&this.stream.end-from>4*parser.bufferLength?new FragmentCursor(fragments,parser.nodeSet):null}get parsedPos(){return this.minStackPos}// Move the parser forward. This will process all parse stacks at
238
+ // `this.pos` and try to advance them to a further position. If no
239
+ // stack for such a position is found, it'll start error-recovery.
240
+ //
241
+ // When the parse is finished, this will return a syntax tree. When
242
+ // not, it returns `null`.
243
+ advance(){let stopped,stoppedTokens,stacks=this.stacks,pos=this.minStackPos,newStacks=this.stacks=[];// This will hold stacks beyond `pos`.
244
+ // If a large amount of reductions happened with the same start
245
+ // position, force the stack out of that production in order to
246
+ // avoid creating a tree too deep to recurse through.
247
+ // (This is an ugly kludge, because unfortunately there is no
248
+ // straightforward, cheap way to check for this happening, due to
249
+ // the history of reductions only being available in an
250
+ // expensive-to-access format in the stack buffers.)
251
+ if(300<this.bigReductionCount/* Rec.MaxLeftAssociativeReductionCount */&&1==stacks.length){for(let[s]=stacks;s.forceReduce()&&s.stack.length&&s.stack[s.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}// Keep advancing any stacks at `pos` until they either move
252
+ // forward or can't be advanced. Gather stacks that can't be
253
+ // advanced further in `stopped`.
254
+ for(let stack,i=0;i<stacks.length;i++)for(stack=stacks[i];;){if(this.tokens.mainToken=null,stack.pos>pos)newStacks.push(stack);else if(this.advanceStack(stack,newStacks,stacks))continue;else{stopped||(stopped=[],stoppedTokens=[]),stopped.push(stack);let tok=this.tokens.getMainToken(stack);stoppedTokens.push(tok.value,tok.end)}break}if(!newStacks.length){let finished=stopped&&findFinished(stopped);if(finished)return verbose&&console.log("Finish with "+this.stackID(finished)),this.stackToTree(finished);if(this.parser.strict)throw verbose&&stopped&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+pos);this.recovering||(this.recovering=5/* Rec.Distance */)}if(this.recovering&&stopped){let finished=null!=this.stoppedAt&&stopped[0].pos>this.stoppedAt?stopped[0]:this.runRecovery(stopped,stoppedTokens,newStacks);if(finished)return verbose&&console.log("Force-finish "+this.stackID(finished)),this.stackToTree(finished.forceAll())}if(this.recovering){let maxRemaining=1==this.recovering?1:3*this.recovering/* Rec.MaxRemainingPerStep */;if(newStacks.length>maxRemaining)for(newStacks.sort((a,b)=>b.score-a.score);newStacks.length>maxRemaining;)newStacks.pop();newStacks.some(s=>s.reducePos>pos)&&this.recovering--}else if(1<newStacks.length){// Prune stacks that are in the same state, or that have been
255
+ // running without splitting for a while, to avoid getting stuck
256
+ // with multiple successful stacks running endlessly on.
257
+ outer:for(let stack,i=0;i<newStacks.length-1;i++){stack=newStacks[i];for(let other,j=i+1;j<newStacks.length;j++)if(other=newStacks[j],stack.sameState(other)||500<stack.buffer.length/* Rec.MinBufferLengthPrune */&&500<other.buffer.length/* Rec.MinBufferLengthPrune */)if(0<(stack.score-other.score||stack.buffer.length-other.buffer.length))newStacks.splice(j--,1);else{newStacks.splice(i--,1);continue outer}}12<newStacks.length/* Rec.MaxStackCount */&&(newStacks.sort((a,b)=>b.score-a.score),newStacks.splice(12/* Rec.MaxStackCount */,newStacks.length-12/* Rec.MaxStackCount */))}this.minStackPos=newStacks[0].pos;for(let i=1;i<newStacks.length;i++)newStacks[i].pos<this.minStackPos&&(this.minStackPos=newStacks[i].pos);return null}stopAt(pos){if(null!=this.stoppedAt&&this.stoppedAt<pos)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=pos}// Returns an updated version of the given stack, or null if the
258
+ // stack can't advance normally. When `split` and `stacks` are
259
+ // given, stacks split off by ambiguous operations will be pushed to
260
+ // `split`, or added to `stacks` if they move `pos` forward.
261
+ advanceStack(stack,stacks,split){let start=stack.pos,{parser}=this,base=verbose?this.stackID(stack)+" -> ":"";if(null!=this.stoppedAt&&start>this.stoppedAt)return stack.forceReduce()?stack:null;if(this.fragments){let strictCx=stack.curContext&&stack.curContext.tracker.strict,cxHash=strictCx?stack.curContext.hash:0;for(let match,cached=this.fragments.nodeAt(start);cached;){if(match=this.parser.nodeSet.types[cached.type.id]==cached.type?parser.getGoto(stack.state,cached.type.id):-1,-1<match&&cached.length&&(!strictCx||(cached.prop(common.NodeProp.contextHash)||0)==cxHash))return stack.useNode(cached,match),verbose&&console.log(base+this.stackID(stack)+` (via reuse of ${parser.getName(cached.type.id)})`),!0;if(!(cached instanceof common.Tree)||0==cached.children.length||0<cached.positions[0])break;let inner=cached.children[0];if(inner instanceof common.Tree&&0==cached.positions[0])cached=inner;else break}}let defaultReduce=parser.stateSlot(stack.state,4/* ParseState.DefaultReduce */);if(0<defaultReduce)return stack.reduce(defaultReduce),verbose&&console.log(base+this.stackID(stack)+` (via always-reduce ${parser.getName(65535&defaultReduce/* Action.ValueMask */)})`),!0;if(8400<=stack.stack.length/* Rec.CutDepth */)for(;6e3<stack.stack.length/* Rec.CutTo */&&stack.forceReduce(););let actions=this.tokens.getActions(stack);for(let i=0;i<actions.length;){let action=actions[i++],term=actions[i++],end=actions[i++],last=i==actions.length||!split,localStack=last?stack:stack.split(),main=this.tokens.mainToken;if(localStack.apply(action,term,main?main.start:localStack.pos,end),verbose&&console.log(base+this.stackID(localStack)+` (via ${0==(65536&action/* Action.ReduceFlag */)?"shift":`reduce of ${parser.getName(65535&action/* Action.ValueMask */)}`} for ${parser.getName(term)} @ ${start}${localStack==stack?"":", split"})`),last)return!0;localStack.pos>start?stacks.push(localStack):split.push(localStack)}return!1}// Advance a given stack forward as far as it will go. Returns the
262
+ // (possibly updated) stack if it got stuck, or null if it moved
263
+ // forward and was given to `pushStackDedup`.
264
+ advanceFully(stack,newStacks){for(let pos=stack.pos;;){if(!this.advanceStack(stack,null,null))return!1;if(stack.pos>pos)return pushStackDedup(stack,newStacks),!0}}runRecovery(stacks,tokens,newStacks){let finished=null,restarted=!1;for(let i=0;i<stacks.length;i++){let stack=stacks[i],token=tokens[i<<1],tokenEnd=tokens[(i<<1)+1],base=verbose?this.stackID(stack)+" -> ":"";if(stack.deadEnd){if(restarted)continue;restarted=!0,stack.restart(),verbose&&console.log(base+this.stackID(stack)+" (restarted)");let done=this.advanceFully(stack,newStacks);if(done)continue}let force=stack.split(),forceBase=base;for(let j=0;10>j/* Rec.ForceReduceLimit */&&force.forceReduce();j++){verbose&&console.log(forceBase+this.stackID(force)+" (via force-reduce)");let done=this.advanceFully(force,newStacks);if(done)break;verbose&&(forceBase=this.stackID(force)+" -> ")}for(let insert of stack.recoverByInsert(token))verbose&&console.log(base+this.stackID(insert)+" (via recover-insert)"),this.advanceFully(insert,newStacks);this.stream.end>stack.pos?(tokenEnd==stack.pos&&(tokenEnd++,token=0/* Term.Err */),stack.recoverByDelete(token,tokenEnd),verbose&&console.log(base+this.stackID(stack)+` (via recover-delete ${this.parser.getName(token)})`),pushStackDedup(stack,newStacks)):(!finished||finished.score<force.score)&&(finished=force)}return finished}// Convert the stack's buffer to a syntax tree.
265
+ stackToTree(stack){return stack.close(),common.Tree.build({buffer:StackBufferCursor.create(stack),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:stack.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(stack){let id=(stackIDs||(stackIDs=new WeakMap)).get(stack);return id||stackIDs.set(stack,id=String.fromCodePoint(this.nextStackID++)),id+stack}}class Dialect{constructor(source,flags,disabled){this.source=source,this.flags=flags,this.disabled=disabled}allows(term){return!this.disabled||0==this.disabled[term]}}const id=x=>x;/**
266
+ Context trackers are used to track stateful context (such as
267
+ indentation in the Python grammar, or parent elements in the XML
268
+ grammar) needed by external tokenizers. You declare them in a
269
+ grammar file as `@context exportName from "module"`.
270
+
271
+ Context values should be immutable, and can be updated (replaced)
272
+ on shift or reduce actions.
273
+
274
+ The export used in a `@context` declaration should be of this
275
+ type.
276
+ */class ContextTracker{/**
277
+ Define a context tracker.
278
+ */constructor(spec){this.start=spec.start,this.shift=spec.shift||id,this.reduce=spec.reduce||id,this.reuse=spec.reuse||id,this.hash=spec.hash||(()=>0),this.strict=!1!==spec.strict}}/**
279
+ Holds the parse tables for a given grammar, as generated by
280
+ `lezer-generator`, and provides [methods](#common.Parser) to parse
281
+ content with.
282
+ */class LRParser extends common.Parser{/**
283
+ @internal
284
+ */constructor(spec){function setProp(nodeID,prop,value){nodeProps[nodeID].push([prop,prop.deserialize(value+"")])}if(super(),this.wrappers=[],14!=spec.version/* File.Version */)throw new RangeError(`Parser version (${spec.version}) doesn't match runtime version (${14/* File.Version */})`);let nodeNames=spec.nodeNames.split(" ");this.minRepeatTerm=nodeNames.length;for(let i=0;i<spec.repeatNodeCount;i++)nodeNames.push("");let topTerms=Object.keys(spec.topRules).map(r=>spec.topRules[r][1]),nodeProps=[];for(let i=0;i<nodeNames.length;i++)nodeProps.push([]);if(spec.nodeProps)for(let propSpec of spec.nodeProps){let prop=propSpec[0];"string"==typeof prop&&(prop=common.NodeProp[prop]);for(let next,i=1;i<propSpec.length;)if(next=propSpec[i++],0<=next)setProp(next,prop,propSpec[i++]);else{let value=propSpec[i+-next];for(let j=-next;0<j;j--)setProp(propSpec[i++],prop,value);i++}}this.nodeSet=new common.NodeSet(nodeNames.map((name,i)=>common.NodeType.define({name:i>=this.minRepeatTerm?void 0:name,id:i,props:nodeProps[i],top:-1<topTerms.indexOf(i),error:0==i,skipped:spec.skippedNodes&&-1<spec.skippedNodes.indexOf(i)}))),spec.propSources&&(this.nodeSet=this.nodeSet.extend(...spec.propSources)),this.strict=!1,this.bufferLength=common.DefaultBufferLength;let tokenArray=decodeArray(spec.tokenData);this.context=spec.context,this.specializerSpecs=spec.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let i=0;i<this.specializerSpecs.length;i++)this.specialized[i]=this.specializerSpecs[i].term;this.specializers=this.specializerSpecs.map(getSpecializer),this.states=decodeArray(spec.states,Uint32Array),this.data=decodeArray(spec.stateData),this.goto=decodeArray(spec.goto),this.maxTerm=spec.maxTerm,this.tokenizers=spec.tokenizers.map(value=>"number"==typeof value?new TokenGroup(tokenArray,value):value),this.topRules=spec.topRules,this.dialects=spec.dialects||{},this.dynamicPrecedences=spec.dynamicPrecedences||null,this.tokenPrecTable=spec.tokenPrec,this.termNames=spec.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(input,fragments,ranges){let parse=new Parse(this,input,fragments,ranges);for(let w of this.wrappers)parse=w(parse,input,fragments,ranges);return parse}/**
285
+ Get a goto table entry @internal
286
+ */getGoto(state,term,loose=!1){let table=this.goto;if(term>=table[0])return-1;for(let pos=table[term+1];;){let groupTag=table[pos++],last=1&groupTag,target=table[pos++];if(last&&loose)return target;for(let end=pos+(groupTag>>1);pos<end;pos++)if(table[pos]==state)return target;if(last)return-1}}/**
287
+ Check if this state has an action for a given terminal @internal
288
+ */hasAction(state,terminal){let data=this.data;for(let set=0;2>set;set++)for(let next,i=this.stateSlot(state,set?2/* ParseState.Skip */:1/* ParseState.Actions */);;i+=3){if(65535==(next=data[i])/* Seq.End */)if(1==data[i+1]/* Seq.Next */)next=data[i=pair(data,i+2)];else{if(2==data[i+1]/* Seq.Other */)return pair(data,i+2);break}if(next==terminal||0==next/* Term.Err */)return pair(data,i+1)}return 0}/**
289
+ @internal
290
+ */stateSlot(state,slot){return this.states[6*state/* ParseState.Size */+slot]}/**
291
+ @internal
292
+ */stateFlag(state,flag){return 0<(this.stateSlot(state,0/* ParseState.Flags */)&flag)}/**
293
+ @internal
294
+ */validAction(state,action){return!!this.allActions(state,a=>a==action||null)}/**
295
+ @internal
296
+ */allActions(state,action){let deflt=this.stateSlot(state,4/* ParseState.DefaultReduce */),result=deflt?action(deflt):void 0;for(let i=this.stateSlot(state,1/* ParseState.Actions */);null==result;i+=3){if(65535==this.data[i]/* Seq.End */)if(1==this.data[i+1]/* Seq.Next */)i=pair(this.data,i+2);else break;result=action(pair(this.data,i+1))}return result}/**
297
+ Get the states that can follow this one through shift actions or
298
+ goto jumps. @internal
299
+ */nextStates(state){let result=[];for(let i=this.stateSlot(state,1/* ParseState.Actions */);;i+=3){if(65535==this.data[i]/* Seq.End */)if(1==this.data[i+1]/* Seq.Next */)i=pair(this.data,i+2);else break;if(0==(1&this.data[i+2])){let value=this.data[i+1];result.some((v,i)=>1&i&&v==value)||result.push(this.data[i],value)}}return result}/**
300
+ Configure the parser. Returns a new parser instance that has the
301
+ given settings modified. Settings not provided in `config` are
302
+ kept from the original parser.
303
+ */configure(config){// Hideous reflection-based kludge to make it easy to create a
304
+ // slightly modified copy of a parser.
305
+ let copy=Object.assign(Object.create(LRParser.prototype),this);if(config.props&&(copy.nodeSet=this.nodeSet.extend(...config.props)),config.top){let info=this.topRules[config.top];if(!info)throw new RangeError(`Invalid top rule name ${config.top}`);copy.top=info}return config.tokenizers&&(copy.tokenizers=this.tokenizers.map(t=>{let found=config.tokenizers.find(r=>r.from==t);return found?found.to:t})),config.specializers&&(copy.specializers=this.specializers.slice(),copy.specializerSpecs=this.specializerSpecs.map((s,i)=>{let found=config.specializers.find(r=>r.from==s.external);if(!found)return s;let spec=Object.assign(Object.assign({},s),{external:found.to});return copy.specializers[i]=getSpecializer(spec),spec})),config.contextTracker&&(copy.context=config.contextTracker),config.dialect&&(copy.dialect=this.parseDialect(config.dialect)),null!=config.strict&&(copy.strict=config.strict),config.wrap&&(copy.wrappers=copy.wrappers.concat(config.wrap)),null!=config.bufferLength&&(copy.bufferLength=config.bufferLength),copy}/**
306
+ Tells you whether any [parse wrappers](#lr.ParserConfig.wrap)
307
+ are registered for this parser.
308
+ */hasWrappers(){return 0<this.wrappers.length}/**
309
+ Returns the name associated with a given term. This will only
310
+ work for all terms when the parser was generated with the
311
+ `--names` option. By default, only the names of tagged terms are
312
+ stored.
313
+ */getName(term){return this.termNames?this.termNames[term]:(term<=this.maxNode&&this.nodeSet.types[term].name||term)+""}/**
314
+ The eof term id is always allocated directly after the node
315
+ types. @internal
316
+ */get eofTerm(){return this.maxNode+1}/**
317
+ The type of top node produced by the parser.
318
+ */get topNode(){return this.nodeSet.types[this.top[1]]}/**
319
+ @internal
320
+ */dynamicPrecedence(term){let prec=this.dynamicPrecedences;return null==prec?0:prec[term]||0}/**
321
+ @internal
322
+ */parseDialect(dialect){let values=Object.keys(this.dialects),flags=values.map(()=>!1);if(dialect)for(let part of dialect.split(" ")){let id=values.indexOf(part);0<=id&&(flags[id]=!0)}let disabled=null;for(let i=0;i<values.length;i++)if(!flags[i])for(let id,j=this.dialects[values[i]];65535!=(id=this.data[j++])/* Seq.End */;)(disabled||(disabled=new Uint8Array(this.maxTerm+1)))[id]=1;return new Dialect(dialect,flags,disabled)}/**
323
+ Used by the output of the parser generator. Not available to
324
+ user code. @hide
325
+ */static deserialize(spec){return new LRParser(spec)}}return dist.ContextTracker=ContextTracker,dist.ExternalTokenizer=ExternalTokenizer,dist.InputStream=InputStream,dist.LRParser=LRParser,dist.LocalTokenGroup=LocalTokenGroup,dist.Stack=Stack,dist}(),index=/*@__PURE__*/function getDefaultExportFromCjs(x){return x}(distExports);return module.exports=index,module.exports}