ranger-compiler 2.1.70 → 3.0.3

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 (363) hide show
  1. package/CHANGELOG.md +103 -0
  2. package/README.md +956 -133
  3. package/{compiler/Lang.clj → dist/Lang.rgr} +2345 -75
  4. package/dist/README.md +116 -0
  5. package/dist/{bin/api.d.ts → api.d.ts} +430 -154
  6. package/dist/api.js +34345 -0
  7. package/{lib/Ajax.clj → dist/lib/Ajax.rgr} +1 -1
  8. package/{lib/CmdParams.clj → dist/lib/CmdParams.rgr} +72 -72
  9. package/{lib/Crypto.clj → dist/lib/Crypto.rgr} +1 -1
  10. package/{lib/DOMLib.clj → dist/lib/DOMLib.rgr} +2 -2
  11. package/{lib/Engine3D.clj → dist/lib/Engine3D.rgr} +1 -1
  12. package/{lib/ImmutableVector.clj → dist/lib/ImmutableVector.rgr} +364 -364
  13. package/{lib/IndexedDB.clj → dist/lib/IndexedDB.rgr} +1 -1
  14. package/{lib/JSON.clj → dist/lib/JSON.rgr} +105 -2
  15. package/{lib/JinxProcess.clj → dist/lib/JinxProcess.rgr} +3 -3
  16. package/{lib/Storage.clj → dist/lib/Storage.rgr} +1 -1
  17. package/{lib/Timers.clj → dist/lib/Timers.rgr} +176 -170
  18. package/{lib/ViewLib.clj → dist/lib/ViewLib.rgr} +1 -1
  19. package/dist/lib/lib/ACEEditor.rgr +5 -0
  20. package/dist/lib/lib/Ajax.rgr +196 -0
  21. package/dist/lib/lib/CmdParams.rgr +72 -0
  22. package/dist/lib/lib/Crypto.rgr +90 -0
  23. package/dist/lib/lib/DOMLib.rgr +307 -0
  24. package/{examples/3D/Engine3D.clj → dist/lib/lib/Engine3D.rgr} +870 -857
  25. package/dist/lib/lib/ImmutableVector.rgr +364 -0
  26. package/dist/lib/lib/IndexedDB.rgr +32 -0
  27. package/{compiler/JSON.clj → dist/lib/lib/JSON.rgr} +106 -3
  28. package/dist/lib/lib/JinxProcess.rgr +838 -0
  29. package/dist/lib/lib/SQL.rgr +44 -0
  30. package/dist/lib/lib/ServiceLib.rgr +9 -0
  31. package/dist/lib/lib/Storage.rgr +89 -0
  32. package/dist/lib/lib/Time.rgr +75 -0
  33. package/dist/lib/lib/Timers.rgr +176 -0
  34. package/dist/lib/lib/TypedArrays.rgr +14 -0
  35. package/dist/lib/lib/ViewLib.rgr +851 -0
  36. package/dist/lib/lib/WebLib.rgr +47 -0
  37. package/dist/lib/lib/WebServerLib.rgr +137 -0
  38. package/{lib/ranger-dir.clj → dist/lib/lib/ranger-dir.rgr} +1 -1
  39. package/{compiler/stdlib.clj → dist/lib/lib/stdlib.rgr} +42 -19
  40. package/{lib/stdops.clj → dist/lib/lib/stdops.rgr} +1 -1
  41. package/dist/lib/ranger-dir.rgr +175 -0
  42. package/{lib/stdlib.clj → dist/lib/stdlib.rgr} +2 -2
  43. package/dist/lib/stdops.rgr +168 -0
  44. package/dist/package.json +47 -0
  45. package/{compiler/bin/output.js → dist/rgrc.js} +15377 -7936
  46. package/dist/stdops.rgr +168 -0
  47. package/package.json +196 -39
  48. package/adventofcode/day1/bin/LambdaSignature1.java +0 -3
  49. package/adventofcode/day1/bin/LambdaSignature2.java +0 -3
  50. package/adventofcode/day1/bin/LambdaSignature3.java +0 -3
  51. package/adventofcode/day1/bin/day1.cpp +0 -124
  52. package/adventofcode/day1/bin/day1.go +0 -75
  53. package/adventofcode/day1/bin/day1.js +0 -45
  54. package/adventofcode/day1/bin/day1.php +0 -46
  55. package/adventofcode/day1/bin/day1.scala +0 -48
  56. package/adventofcode/day1/bin/day1.swift +0 -48
  57. package/adventofcode/day1/bin/day1_part2.cpp +0 -180
  58. package/adventofcode/day1/bin/day1_part2.go +0 -123
  59. package/adventofcode/day1/bin/day1_part2.js +0 -76
  60. package/adventofcode/day1/bin/day1_part2.php +0 -88
  61. package/adventofcode/day1/bin/day1_part2.scala +0 -81
  62. package/adventofcode/day1/bin/day1_part2.swift +0 -91
  63. package/adventofcode/day1/bin/day_one.java +0 -38
  64. package/adventofcode/day1/bin/day_one_part_two.java +0 -57
  65. package/adventofcode/day1/bin/operatorsOf.java +0 -37
  66. package/adventofcode/day1/bin/operatorsOf_5.java +0 -10
  67. package/adventofcode/day1/bin/operatorsOfboolean_5.java +0 -10
  68. package/adventofcode/day1/bin/variant.hpp +0 -2416
  69. package/adventofcode/day1/compile.bat +0 -7
  70. package/adventofcode/day1/compile2.bat +0 -7
  71. package/adventofcode/day1/day1.clj +0 -19
  72. package/adventofcode/day1/day1_part2.clj +0 -43
  73. package/adventofcode/day1/input1.txt +0 -1
  74. package/adventofcode/day2/bin/LambdaSignature1.class +0 -0
  75. package/adventofcode/day2/bin/LambdaSignature1.java +0 -3
  76. package/adventofcode/day2/bin/LambdaSignature2.class +0 -0
  77. package/adventofcode/day2/bin/LambdaSignature2.java +0 -3
  78. package/adventofcode/day2/bin/day2.cpp +0 -133
  79. package/adventofcode/day2/bin/day2.go +0 -85
  80. package/adventofcode/day2/bin/day2.js +0 -45
  81. package/adventofcode/day2/bin/day2.php +0 -59
  82. package/adventofcode/day2/bin/day2.scala +0 -54
  83. package/adventofcode/day2/bin/day2.swift +0 -62
  84. package/adventofcode/day2/bin/day2_part2.cpp +0 -150
  85. package/adventofcode/day2/bin/day2_part2.go +0 -101
  86. package/adventofcode/day2/bin/day2_part2.js +0 -54
  87. package/adventofcode/day2/bin/day2_part2.php +0 -80
  88. package/adventofcode/day2/bin/day2_part2.scala +0 -68
  89. package/adventofcode/day2/bin/day2_part2.swift +0 -82
  90. package/adventofcode/day2/bin/day_two.java +0 -61
  91. package/adventofcode/day2/bin/day_two_part_two$1$1$1.class +0 -0
  92. package/adventofcode/day2/bin/day_two_part_two$1$1.class +0 -0
  93. package/adventofcode/day2/bin/day_two_part_two$1.class +0 -0
  94. package/adventofcode/day2/bin/day_two_part_two.class +0 -0
  95. package/adventofcode/day2/bin/day_two_part_two.java +0 -80
  96. package/adventofcode/day2/bin/operatorsOf.class +0 -0
  97. package/adventofcode/day2/bin/operatorsOf.java +0 -18
  98. package/adventofcode/day2/bin/variant.hpp +0 -2416
  99. package/adventofcode/day2/compile.bat +0 -7
  100. package/adventofcode/day2/compile2.bat +0 -7
  101. package/adventofcode/day2/day2.clj +0 -60
  102. package/adventofcode/day2/day2_part2.clj +0 -69
  103. package/adventofcode/day2/input1.txt +0 -1
  104. package/adventofcode/day3/bin/Grid.java +0 -92
  105. package/adventofcode/day3/bin/GridRow.java +0 -5
  106. package/adventofcode/day3/bin/LambdaSignature1.java +0 -3
  107. package/adventofcode/day3/bin/LambdaSignature2.java +0 -3
  108. package/adventofcode/day3/bin/LambdaSignature3.java +0 -3
  109. package/adventofcode/day3/bin/day3.cpp +0 -64
  110. package/adventofcode/day3/bin/day3.go +0 -55
  111. package/adventofcode/day3/bin/day3.js +0 -42
  112. package/adventofcode/day3/bin/day3.php +0 -41
  113. package/adventofcode/day3/bin/day3.scala +0 -52
  114. package/adventofcode/day3/bin/day3.swift +0 -43
  115. package/adventofcode/day3/bin/day3_part2.cpp +0 -216
  116. package/adventofcode/day3/bin/day3_part2.go +0 -188
  117. package/adventofcode/day3/bin/day3_part2.js +0 -123
  118. package/adventofcode/day3/bin/day3_part2.php +0 -135
  119. package/adventofcode/day3/bin/day3_part2.swift +0 -131
  120. package/adventofcode/day3/bin/day_three_part_two.java +0 -43
  121. package/adventofcode/day3/bin/day_two.java +0 -42
  122. package/adventofcode/day3/bin/operatorsOf.java +0 -14
  123. package/adventofcode/day3/bin/variant.hpp +0 -2416
  124. package/adventofcode/day3/compile.bat +0 -7
  125. package/adventofcode/day3/compile2.bat +0 -7
  126. package/adventofcode/day3/day3.clj +0 -42
  127. package/adventofcode/day3/day3_part2.clj +0 -112
  128. package/adventofcode/day4/bin/LambdaSignature1.java +0 -3
  129. package/adventofcode/day4/bin/day4.cpp +0 -118
  130. package/adventofcode/day4/bin/day4.go +0 -75
  131. package/adventofcode/day4/bin/day4.js +0 -40
  132. package/adventofcode/day4/bin/day4.php +0 -52
  133. package/adventofcode/day4/bin/day4.scala +0 -47
  134. package/adventofcode/day4/bin/day4.swift +0 -56
  135. package/adventofcode/day4/bin/day4_part2.go +0 -129
  136. package/adventofcode/day4/bin/day4_part2.js +0 -72
  137. package/adventofcode/day4/bin/day_four.java +0 -41
  138. package/adventofcode/day4/bin/inputData.java +0 -7
  139. package/adventofcode/day4/bin/operatorsOf.java +0 -11
  140. package/adventofcode/day4/bin/variant.hpp +0 -2416
  141. package/adventofcode/day4/compile.bat +0 -7
  142. package/adventofcode/day4/compile2.bat +0 -7
  143. package/adventofcode/day4/day4.clj +0 -32
  144. package/adventofcode/day4/day4_part2.clj +0 -44
  145. package/adventofcode/day4/input.clj +0 -519
  146. package/adventofcode/day4/input.txt +0 -512
  147. package/bin/api.ts +0 -24471
  148. package/bin/compiler.ts +0 -24482
  149. package/bin/output.js +0 -23819
  150. package/compiler/ColorConsole.clj +0 -22
  151. package/compiler/ContextOperators.clj +0 -75
  152. package/compiler/FlowEnterVarDef.clj +0 -223
  153. package/compiler/InputFileSystem.clj +0 -276
  154. package/compiler/RangerDocs.clj +0 -7
  155. package/compiler/TFactory.clj +0 -146
  156. package/compiler/TFiles.clj +0 -23
  157. package/compiler/TFlow.clj +0 -39
  158. package/compiler/TNodeFactory.clj +0 -84
  159. package/compiler/TTypes.clj +0 -188
  160. package/compiler/VirtualCompiler.clj +0 -807
  161. package/compiler/bin/ng_Compiler.js +0 -23779
  162. package/compiler/commonmark_plugin.clj +0 -359
  163. package/compiler/feat2.bat +0 -2
  164. package/compiler/feats.bat +0 -9
  165. package/compiler/feature_tests.clj +0 -192
  166. package/compiler/index.js +0 -2
  167. package/compiler/issue_57.clj +0 -25
  168. package/compiler/makefile_plugin.clj +0 -135
  169. package/compiler/markdown_plugin.clj +0 -386
  170. package/compiler/maven_plugin.clj +0 -162
  171. package/compiler/ng_AndroidPageWriter.clj +0 -299
  172. package/compiler/ng_CodeNode.clj +0 -756
  173. package/compiler/ng_CodeNodeCompilerExtensions.clj +0 -839
  174. package/compiler/ng_Compiler.clj +0 -49
  175. package/compiler/ng_CompilerGeneric.clj +0 -260
  176. package/compiler/ng_CompilerOrig.clj +0 -854
  177. package/compiler/ng_DictNode.clj +0 -346
  178. package/compiler/ng_DictNode2.clj +0 -316
  179. package/compiler/ng_Execute.clj +0 -138
  180. package/compiler/ng_Execute1.clj +0 -129
  181. package/compiler/ng_FlowWork.clj +0 -3951
  182. package/compiler/ng_LiveCompiler.clj +0 -1109
  183. package/compiler/ng_RagnerJavaScriptClassWriter.clj +0 -402
  184. package/compiler/ng_RangerActiveOperators.clj +0 -86
  185. package/compiler/ng_RangerAppClassDesc.clj +0 -400
  186. package/compiler/ng_RangerAppEnums.clj +0 -86
  187. package/compiler/ng_RangerAppFunctionDesc.clj +0 -127
  188. package/compiler/ng_RangerAppMessages.clj +0 -15
  189. package/compiler/ng_RangerAppOperatorDesc.clj +0 -20
  190. package/compiler/ng_RangerAppParamDesc.clj +0 -388
  191. package/compiler/ng_RangerAppWriterContext.clj +0 -1793
  192. package/compiler/ng_RangerArgMatch.clj +0 -638
  193. package/compiler/ng_RangerCSharpClassWriter.clj +0 -484
  194. package/compiler/ng_RangerCppClassWriter.clj +0 -1023
  195. package/compiler/ng_RangerDocGenerator.clj +0 -305
  196. package/compiler/ng_RangerFlowParser.clj +0 -4992
  197. package/compiler/ng_RangerFlowParserOrig.clj +0 -4002
  198. package/compiler/ng_RangerGenericClassWriter.clj +0 -573
  199. package/compiler/ng_RangerGolangClassWriter.clj +0 -1766
  200. package/compiler/ng_RangerImmutableExtension.clj +0 -77
  201. package/compiler/ng_RangerJava7ClassWriter.clj +0 -961
  202. package/compiler/ng_RangerJavaScriptClassWriter.clj +0 -1040
  203. package/compiler/ng_RangerKotlinClassWriter.clj +0 -372
  204. package/compiler/ng_RangerLanguageWriters.clj +0 -14
  205. package/compiler/ng_RangerLispParser.clj +0 -873
  206. package/compiler/ng_RangerPHPClassWriter.clj +0 -643
  207. package/compiler/ng_RangerPlugin.clj +0 -41
  208. package/compiler/ng_RangerRangerClassWriter.clj +0 -357
  209. package/compiler/ng_RangerRustClassWriter.clj +0 -420
  210. package/compiler/ng_RangerScalaClassWriter.clj +0 -818
  211. package/compiler/ng_RangerSerializeClass.clj +0 -502
  212. package/compiler/ng_RangerServiceBuilder.clj +0 -63
  213. package/compiler/ng_RangerSwift3ClassWriter.clj +0 -809
  214. package/compiler/ng_RangerSwiftClassWriter.clj +0 -0
  215. package/compiler/ng_RangerTypeClass.clj +0 -45
  216. package/compiler/ng_SourceParser.clj +0 -241
  217. package/compiler/ng_SourceParser2.clj +0 -214
  218. package/compiler/ng_WebPageWriter.clj +0 -39
  219. package/compiler/ng_jsonParser.clj +0 -340
  220. package/compiler/ng_p_test.clj +0 -1711
  221. package/compiler/ng_parser.clj +0 -911
  222. package/compiler/ng_parser2.clj +0 -735
  223. package/compiler/ng_parser2_backup.clj +0 -1679
  224. package/compiler/ng_parser_backup.clj +0 -886
  225. package/compiler/ng_parser_ok.clj +0 -1718
  226. package/compiler/ng_parser_ok2.clj +0 -1717
  227. package/compiler/ng_parser_std_match.clj +0 -687
  228. package/compiler/ng_parser_std_match2.clj +0 -1012
  229. package/compiler/ng_parser_v2.clj +0 -1251
  230. package/compiler/ng_ui.clj +0 -403
  231. package/compiler/ng_ui_test.clj +0 -18
  232. package/compiler/ng_writer.clj +0 -338
  233. package/compiler/ng_xmlParser.clj +0 -472
  234. package/compiler/ng_xmlParser2.clj +0 -317
  235. package/compiler/ng_xmlParser3.clj +0 -251
  236. package/compiler/opdoc.bat +0 -4
  237. package/compiler/operators.md +0 -290
  238. package/compiler/p.bat +0 -4
  239. package/compiler/package.json +0 -10
  240. package/compiler/pcmd.bat +0 -4
  241. package/compiler/pcmd2.bat +0 -3
  242. package/compiler/plaintext_plugin.clj +0 -69
  243. package/compiler/plugin.bat +0 -19
  244. package/compiler/plugin2.bat +0 -4
  245. package/compiler/plugin_app.bat +0 -3
  246. package/compiler/plugin_apps.clj +0 -27
  247. package/compiler/plugins.bat +0 -10
  248. package/compiler/reveal_plugin.clj +0 -409
  249. package/compiler/simplePlugin.clj +0 -780
  250. package/compiler/t.bat +0 -3
  251. package/compiler/test_any.clj +0 -43
  252. package/compiler/test_call.clj +0 -141
  253. package/compiler/test_chain.clj +0 -79
  254. package/compiler/test_json.clj +0 -10
  255. package/compiler/test_lambda.clj +0 -153
  256. package/compiler/test_pcmd.clj +0 -32
  257. package/compiler/test_pcmd2.clj +0 -29
  258. package/compiler/test_plugin.clj +0 -237
  259. package/compiler/test_readfile.clj +0 -13
  260. package/compiler/test_reveal.clj +0 -19
  261. package/compiler/test_slides.clj +0 -312
  262. package/compiler/test_types.clj +0 -143
  263. package/compiler/test_types2.clj +0 -49
  264. package/compiler/test_types3.clj +0 -53
  265. package/compiler/test_var.clj +0 -40
  266. package/compiler/tonpm.bat +0 -14
  267. package/compiler/tonpm2.bat +0 -12
  268. package/compiler/ui_plugin.clj +0 -507
  269. package/compiler/ui_plugin2.clj +0 -427
  270. package/compiler/update-git.bat +0 -3
  271. package/compiler/vcomp.bat +0 -4
  272. package/compiler/viewbuilder_Android.clj +0 -176
  273. package/compiler/viewbuilder_Web.clj +0 -105
  274. package/dist/bin/api.js +0 -32422
  275. package/dist/bin/compiler.d.ts +0 -1638
  276. package/dist/bin/compiler.js +0 -32444
  277. package/examples/3D/bin/test_3d.js +0 -329
  278. package/examples/3D/test_3d.clj +0 -385
  279. package/examples/EVGColor/EVGColor.clj +0 -310
  280. package/examples/EVGColor/EVGColorContext.clj +0 -176
  281. package/examples/EVGColor/bin/EVGColor.js +0 -286
  282. package/examples/EVGColor/bin/minimized.js +0 -286
  283. package/examples/SVGPath/SVGPath.clj +0 -625
  284. package/examples/SVGPath/Vec2.clj +0 -103
  285. package/examples/SVGPath/bin/SVGPath.cpp +0 -887
  286. package/examples/SVGPath/bin/SVGPath.js +0 -682
  287. package/examples/SVGPath/bin/SVGPath.ts +0 -711
  288. package/examples/SVGPath/bin/minimized.js +0 -578
  289. package/examples/SVGPath/bin/variant.hpp +0 -2416
  290. package/examples/minification/Vec2.clj +0 -103
  291. package/examples/minification/bin/minified.js +0 -44
  292. package/examples/minification/bin/test.js +0 -117
  293. package/examples/minification/test.clj +0 -13
  294. package/fiddle/VirtualCompiler.js +0 -23495
  295. package/fiddle/browser_editor.js +0 -13240
  296. package/fiddle/compileEnv.js +0 -1
  297. package/fiddle/compileEnv.json +0 -1
  298. package/fiddle/lang_data.js +0 -1
  299. package/index.html +0 -18
  300. package/native/httpd/HttpTester.clj +0 -33
  301. package/native/httpd/RangerWebService.clj +0 -81
  302. package/operators.md +0 -290
  303. package/tsconfig.json +0 -29
  304. package/versions/cpp/compiler.cpp +0 -15032
  305. package/versions/es6/compiler.js +0 -12860
  306. package/versions/go/compiler.go +0 -21338
  307. package/versions/java/AfterCodeNode.java +0 -4
  308. package/versions/java/ClassJoinPoint.java +0 -6
  309. package/versions/java/CodeFile.java +0 -42
  310. package/versions/java/CodeFileSystem.java +0 -72
  311. package/versions/java/CodeNode.java +0 -807
  312. package/versions/java/CodeSlice.java +0 -13
  313. package/versions/java/CodeWriter.java +0 -185
  314. package/versions/java/ColorConsole.java +0 -8
  315. package/versions/java/CompilerInterface.java +0 -213
  316. package/versions/java/DictNode.java +0 -353
  317. package/versions/java/LiveCompiler.java +0 -772
  318. package/versions/java/NodeEvalState.java +0 -24
  319. package/versions/java/OpFindResult.java +0 -6
  320. package/versions/java/RangerAppArrayValue.java +0 -7
  321. package/versions/java/RangerAppClassDesc.java +0 -217
  322. package/versions/java/RangerAppEnum.java +0 -14
  323. package/versions/java/RangerAppFunctionDesc.java +0 -20
  324. package/versions/java/RangerAppHashValue.java +0 -11
  325. package/versions/java/RangerAppInterfaceImpl.java +0 -6
  326. package/versions/java/RangerAppMethodVariants.java +0 -6
  327. package/versions/java/RangerAppParamDesc.java +0 -321
  328. package/versions/java/RangerAppTodo.java +0 -6
  329. package/versions/java/RangerAppValue.java +0 -10
  330. package/versions/java/RangerAppWriterContext.java +0 -800
  331. package/versions/java/RangerArgMatch.java +0 -317
  332. package/versions/java/RangerBackReference.java +0 -7
  333. package/versions/java/RangerCSharpClassWriter.java +0 -287
  334. package/versions/java/RangerCompilerMessage.java +0 -9
  335. package/versions/java/RangerCppClassWriter.java +0 -725
  336. package/versions/java/RangerFlowParser.java +0 -2142
  337. package/versions/java/RangerGenericClassWriter.java +0 -367
  338. package/versions/java/RangerGolangClassWriter.java +0 -1379
  339. package/versions/java/RangerJava7ClassWriter.java +0 -652
  340. package/versions/java/RangerJavaScriptClassWriter.java +0 -305
  341. package/versions/java/RangerKotlinClassWriter.java +0 -380
  342. package/versions/java/RangerLispParser.java +0 -845
  343. package/versions/java/RangerNodeValue.java +0 -9
  344. package/versions/java/RangerPHPClassWriter.java +0 -527
  345. package/versions/java/RangerParamEventHandler.java +0 -6
  346. package/versions/java/RangerParamEventList.java +0 -5
  347. package/versions/java/RangerParamEventMap.java +0 -27
  348. package/versions/java/RangerRangerClassWriter.java +0 -268
  349. package/versions/java/RangerRefForce.java +0 -7
  350. package/versions/java/RangerScalaClassWriter.java +0 -365
  351. package/versions/java/RangerSerializeClass.java +0 -148
  352. package/versions/java/RangerSwift3ClassWriter.java +0 -548
  353. package/versions/java/RangerTypeClass.java +0 -17
  354. package/versions/java/SourceCode.java +0 -65
  355. package/versions/php/compiler.php +0 -13830
  356. package/versions/swift3/compiler.swift +0 -12542
  357. /package/{lib/ACEEditor.clj → dist/lib/ACEEditor.rgr} +0 -0
  358. /package/{lib/SQL.clj → dist/lib/SQL.rgr} +0 -0
  359. /package/{lib/ServiceLib.clj → dist/lib/ServiceLib.rgr} +0 -0
  360. /package/{lib/Time.clj → dist/lib/Time.rgr} +0 -0
  361. /package/{lib/TypedArrays.clj → dist/lib/TypedArrays.rgr} +0 -0
  362. /package/{lib/WebLib.clj → dist/lib/WebLib.rgr} +0 -0
  363. /package/{lib/WebServerLib.clj → dist/lib/WebServerLib.rgr} +0 -0
@@ -1,1718 +0,0 @@
1
- (
2
-
3
- (Enum RangerNodeRefType:int (
4
- NoType
5
- ))
6
-
7
- (Enum RangerNodeType:int
8
- (
9
- NoType
10
- InvalidType
11
- Double
12
- Integer
13
- String
14
- Boolean
15
- Array
16
- Hash
17
- Object
18
- VRef
19
- Comment
20
- Enum
21
- Char
22
- CharBuffer
23
- Expression
24
- ExpressionType
25
- Lambda
26
- XMLNode
27
- XMLText
28
- XMLAttr
29
- XMLCDATA
30
- Dictionary
31
- Any
32
- Class
33
- GenericClass
34
- ClassRef
35
- Method
36
- ClassVar
37
- Function
38
- Literal
39
- Quasiliteral
40
- Null
41
- )
42
- )
43
-
44
- ( CreateClass CodeNode {
45
-
46
- (def code:SourceCode)
47
- (def sp:int 0)
48
- (def ep:int 0)
49
-
50
- (def has_operator:boolean false)
51
- (def op_index:int 0)
52
-
53
- ; could be also vref_annotation
54
- (def mutable_def:boolean false)
55
-
56
- (def expression:boolean false)
57
- (def vref:string "")
58
- (def is_block_node:boolean false) ; specifically marked as a block node
59
-
60
- (def infix_operator:boolean false) ; if we are collecting infix nodex like 4 + 2 * 10
61
- (def infix_node@(weak):CodeNode )
62
- (def infix_subnode:boolean false)
63
-
64
- (def operator_pred:int 0)
65
- (def to_the_right:boolean false)
66
- (def right_node@(weak):CodeNode )
67
-
68
- (def type_type:string "") ; hash, function, array ?
69
- (def type_name:string "")
70
- (def key_type:string "")
71
- (def array_type:string "")
72
-
73
- (def ns:[string])
74
-
75
- (def has_vref_annotation:boolean false)
76
- (def vref_annotation:CodeNode)
77
-
78
- (def has_type_annotation:boolean false)
79
- (def type_annotation:CodeNode)
80
-
81
- ; (def typeClass:RangerTypeClass @weak(true))
82
-
83
- (def value_type:RangerNodeType RangerNodeType.NoType)
84
-
85
- ; after node has been evaluated
86
- (def eval_type:RangerNodeType RangerNodeType.NoType)
87
- (def eval_type_name:string "")
88
- (def eval_key_type:string "")
89
- (def eval_array_type:string "")
90
-
91
- (def flow_done:boolean false)
92
- (def ref_change_done:boolean false)
93
-
94
- ; if the node references to object, if this reference is weak or not
95
- (def ref_type:RangerNodeRefType RangerNodeRefType.NoType)
96
- (def ref_need_assign:int 0)
97
-
98
- (def double_value:double 0.0)
99
- (def string_value:string "")
100
- (def int_value:int 1)
101
- (def boolean_value:boolean false )
102
- (def expression_value:CodeNode)
103
-
104
- (def props:[string:CodeNode])
105
- (def prop_keys:[string])
106
-
107
- (def comments:[CodeNode])
108
- (def children:[CodeNode])
109
- (def parent@(weak):CodeNode )
110
-
111
- (def didReturnAtIndex:int -1)
112
-
113
- (def hasVarDef:boolean false)
114
- (def hasClassDescription:boolean false)
115
- (def hasNewOper:boolean false)
116
- (def hasFnCall:boolean false)
117
- (def hasParamDesc:boolean false)
118
-
119
- (Constructor (source:SourceCode start:int end:int)
120
- (
121
- (= sp start)
122
- (= ep end)
123
- (= code source)
124
- )
125
- )
126
-
127
- fn getCode:string () {
128
- return "--code--"
129
- }
130
-
131
- (PublicMethod isPrimitive:boolean ()
132
- (
133
- (if (||
134
- (== value_type RangerNodeType.Double)
135
- (== value_type RangerNodeType.String)
136
- (== value_type RangerNodeType.Integer)
137
- (== value_type RangerNodeType.Boolean)
138
- )
139
- (
140
- (return true)
141
- )
142
- )
143
- (return false)
144
- )
145
- )
146
-
147
- ( PublicMethod walk:void () (
148
-
149
- (switch value_type (
150
- (case RangerNodeType.Double {
151
- print "Double " + double_value
152
- })
153
- (case RangerNodeType.String
154
- (
155
- (print ( + "String : " string_value))
156
- )
157
- )
158
- (case RangerNodeType.Integer
159
- (
160
- (print ( + "Integer : " int_value))
161
- )
162
- )
163
- (case RangerNodeType.Boolean
164
- (
165
- (if boolean_value
166
- (print ( "Boolean : true "))
167
- (print ( "Boolean : false" ))
168
- )
169
- )
170
- )
171
- (case RangerNodeType.VRef
172
- (
173
- (print ( "VREF : " + vref + " : " + type_name))
174
- )
175
- )
176
- (case RangerNodeType.Array
177
- (
178
- (print ( "Array : " + vref + " : " + array_type))
179
-
180
- )
181
- )
182
- (case RangerNodeType.Hash
183
- (
184
- (print ( "Hash : " + vref + " : [" + key_type + ":" + array_type + "]"))
185
-
186
- )
187
- )
188
- (case RangerNodeType.ExpressionType
189
- (
190
- (print ( + "Expression type : " vref ))
191
- (print "----- expression starts ------")
192
- (expression_value.walk ())
193
- (print "----- expression ends ------")
194
- )
195
- )
196
- (case RangerNodeType.Comment
197
- (
198
- (print ( + "Comment : " string_value))
199
- )
200
- )
201
- (default {
202
-
203
- })
204
-
205
- )
206
-
207
- )
208
-
209
- (if expression
210
- (print "(")
211
- (print (substring code.code sp ep))
212
- )
213
-
214
- (if has_vref_annotation (
215
- (print "-------------------- ANNOTATION STARTS ----------------------")
216
- (vref_annotation.walk())
217
- (print "-------------------- ANNOTATION ENDS ----------------------")
218
- ))
219
-
220
- (for children item:CodeNode i
221
- (item.walk())
222
- )
223
-
224
- (if expression
225
- (print ")")
226
- )
227
-
228
-
229
- ))
230
-
231
-
232
-
233
- })
234
-
235
- (class SourceCode {
236
- def code:string ""
237
- def sp:int 0
238
- def ep:int 0
239
-
240
- (Constructor (code_str:string ) {
241
- code = code_str
242
- })
243
- })
244
-
245
-
246
- ( CreateClass RangerLispParser:void {
247
- (def code:SourceCode)
248
- (def buff:charbuffer)
249
- (def len:int 0)
250
- (def i:int 0)
251
- (def parents@(weak):[CodeNode] )
252
- (def next:CodeNode)
253
-
254
- (def paren_cnt:int 0)
255
- (def get_op_pred:int 0)
256
-
257
- (def rootNode:CodeNode )
258
- (def curr_node@(weak):CodeNode @weak(true) )
259
-
260
- (def had_error:boolean false)
261
- ; (def had_lf false)
262
-
263
- (fn joo:void(cm:SourceCode) {
264
- def ll:int (strlen cm.code)
265
- })
266
-
267
- sfn theMain@(main):void () {
268
-
269
- print "Hello World"
270
-
271
- def read_code:string (readfile "." "testCode.clj")
272
-
273
- def the_code:SourceCode (new SourceCode( (unwrap read_code)))
274
-
275
- def p:RangerLispParser (new RangerLispParser(the_code))
276
- timer "Time for parsing the code:" {
277
- p.parse()
278
- }
279
- def rn:CodeNode (unwrap p.rootNode)
280
- rn.walk()
281
- print("--- done --- ")
282
-
283
- }
284
-
285
- (Constructor (code_module:SourceCode )
286
- (
287
- (= buff (to_charbuffer code_module.code))
288
- (= code code_module)
289
-
290
- (= len (length (unwrap buff)))
291
-
292
- (= rootNode (new CodeNode ( (unwrap code) 0 0)))
293
- (= rootNode.is_block_node true)
294
- (= rootNode.expression true)
295
- (= curr_node rootNode)
296
- (push parents (unwrap curr_node))
297
- (= paren_cnt 1)
298
-
299
- )
300
- )
301
-
302
- ( PublicMethod getCode:string () {
303
- return (rootNode.getCode())
304
- })
305
-
306
-
307
- ( PublicMethod parse_raw_annotation:CodeNode () {
308
-
309
- (def sp:int i)
310
- (def ep:int i)
311
-
312
- ; skip annotation mark and continue
313
- (= i (+ i 1))
314
- (= sp i)
315
- (= ep i)
316
-
317
- (if (< i len) {
318
- ; parse new expression as variable type
319
- (def a_node2@(returnvalue):CodeNode (new CodeNode((unwrap code) sp ep)))
320
-
321
- (= a_node2.expression true)
322
- (= curr_node a_node2)
323
-
324
- (push parents a_node2)
325
- (= i (+ i 1))
326
- (= paren_cnt (+ paren_cnt 1))
327
-
328
- (this.parse())
329
-
330
- return a_node2
331
- } {
332
-
333
- }
334
- )
335
- return (new CodeNode((unwrap code) sp ep))
336
- })
337
-
338
- ( PublicMethod skip_space:boolean (is_block_parent : boolean) {
339
- (def s:charbuffer (unwrap buff))
340
- (def did_break:boolean false)
341
-
342
-
343
- (if (i >= len) {
344
- return true
345
- })
346
-
347
- (def c:char (charAt s i))
348
-
349
-
350
- def bb:boolean (== c (charcode "."))
351
-
352
- ; --> skipping of comma (== c (charcode ",")) removed
353
- (while ( && (< i len)
354
- (<= c 32 ) )
355
- (
356
-
357
- (if (&& is_block_parent (|| (== c 10) (== c 13) ))
358
- (
359
-
360
- (this.end_expression())
361
- (= did_break true)
362
- (break _)
363
- )
364
- )
365
-
366
- (= i (+ 1 i))
367
-
368
- (if (i >= len) {
369
- return true
370
- })
371
- (= c (charAt s i))
372
- )
373
- )
374
- return did_break
375
- }
376
- )
377
-
378
-
379
- ( PublicMethod end_expression:boolean () (
380
-
381
- (= i (+ 1 i))
382
- (if (i >= len) {
383
- return false
384
- })
385
-
386
- (= paren_cnt (- paren_cnt 1))
387
- (if (< paren_cnt 0)
388
- (print "Parser error ) mismatch")
389
- )
390
-
391
- (removeLast parents)
392
- (if (!null? curr_node)
393
- (
394
- (= curr_node.ep i)
395
- (= curr_node.infix_operator false)
396
- )
397
- )
398
-
399
- (if (> (array_length parents) 0)
400
- (
401
- (= curr_node (itemAt parents (- (array_length parents) 1 ) ))
402
- )
403
- (
404
- (= curr_node rootNode)
405
- )
406
- )
407
- (= curr_node.infix_operator false)
408
- (return true)
409
- ))
410
-
411
- (PublicMethod getOperator:int () {
412
-
413
- (def s:charbuffer (unwrap buff))
414
-
415
- if ( i + 2 >= len ) {
416
- return 0
417
- }
418
-
419
- def c:char (charAt s i)
420
- def c2:char (charAt s (+ i 1))
421
-
422
- switch c {
423
-
424
- case ( (charcode "*" ) ) {
425
- i = i + 1
426
- return 14
427
- }
428
-
429
- case ( (charcode "/" ) ) {
430
- i = i + 1
431
- return 14
432
- }
433
-
434
- case ( (charcode "+" ) ) {
435
- i = i + 1
436
- return 13
437
- }
438
-
439
- case ( (charcode "-" ) ) {
440
- i = i + 1
441
- return 13
442
- }
443
-
444
- case ( (charcode "<" ) ) {
445
- if (c2 == (charcode "=")) {
446
- i = i + 2
447
- return 11
448
- }
449
- i = i + 1
450
- return 11
451
- }
452
-
453
- case ( (charcode ">" ) ) {
454
- if (c2 == (charcode "=")) {
455
- i = i + 2
456
- return 11
457
- }
458
- i = i + 1
459
- return 11
460
- }
461
-
462
- case ( (charcode "!" ) ) {
463
- if (c2 == (charcode "=")) {
464
- i = i + 2
465
- return 10
466
- }
467
- return 0 ; currently negation not supported
468
- }
469
- case ( (charcode "=" ) ) {
470
- if (c2 == (charcode "=")) {
471
- i = i + 2
472
- return 10 ; == operator
473
- }
474
- i = i + 1
475
- return 3 ; assigment operator
476
- }
477
-
478
- case ( (charcode "&" ) ) {
479
- if (c2 == (charcode "&")) {
480
- i = i + 2
481
- return 6 ; && operator
482
- }
483
- return 0
484
- }
485
-
486
- case ( (charcode "|" ) ) {
487
- if (c2 == (charcode "|")) {
488
- i = i + 2
489
- return 5 ; && operator
490
- }
491
- return 0
492
- }
493
-
494
- default {
495
-
496
- }
497
-
498
- }
499
-
500
- return 0
501
- })
502
-
503
- (PublicMethod isOperator:int () {
504
-
505
- (def s:charbuffer (unwrap buff))
506
-
507
- if ( i - 2 > len ) {
508
- return 0
509
- }
510
-
511
- def c:char (charAt s i)
512
- def c2:char (charAt s (+ i 1))
513
-
514
- switch c {
515
-
516
- case ( (charcode "*" ) ) {
517
- return 1
518
- }
519
-
520
- case ( (charcode "/" ) ) {
521
- return 14
522
- }
523
-
524
- case ( (charcode "+" ) ) {
525
- return 13
526
- }
527
-
528
- case ( (charcode "-" ) ) {
529
- return 13
530
- }
531
-
532
- case ( (charcode "<" ) ) {
533
- if (c2 == (charcode "=")) {
534
- return 11
535
- }
536
- return 11
537
- }
538
-
539
- case ( (charcode ">" ) ) {
540
- if (c2 == (charcode "=")) {
541
- return 11
542
- }
543
- return 11
544
- }
545
-
546
- case ( (charcode "!" ) ) {
547
- if (c2 == (charcode "=")) {
548
- return 10
549
- }
550
- return 0 ; currently negation not supported
551
- }
552
- case ( (charcode "=" ) ) {
553
- if (c2 == (charcode "=")) {
554
- return 10 ; == operator
555
- }
556
- return 3 ; assigment operator
557
- }
558
-
559
- case ( (charcode "&" ) ) {
560
- if (c2 == (charcode "&")) {
561
- return 6 ; && operator
562
- }
563
- return 0
564
- }
565
-
566
- case ( (charcode "|" ) ) {
567
- if (c2 == (charcode "|")) {
568
- return 5 ; && operator
569
- }
570
- return 0
571
- }
572
- default {
573
-
574
- }
575
- }
576
-
577
- return 0
578
- })
579
-
580
-
581
- (PublicMethod getOperatorPred:int (str:string)
582
- {
583
-
584
- switch str {
585
- case ( "<" ) {
586
- return 11
587
- }
588
- case ( ">" ) {
589
- return 11
590
- }
591
- case ( "<=" ) {
592
- return 11
593
- }
594
- case ( ">=" ) {
595
- return 11
596
- }
597
- case ( "==" ) {
598
- return 10
599
- }
600
-
601
- case ( "!=" ) {
602
- return 10
603
- }
604
- case ( "=" ) {
605
- return 3
606
- }
607
- case "&&" {
608
- return 6
609
- }
610
- case "||" {
611
- return 5
612
- }
613
- case "+" {
614
- return 13
615
- }
616
-
617
- case "-" {
618
- return 13
619
- }
620
- case "*" {
621
- return 14
622
- }
623
- case "/" {
624
- return 14
625
- }
626
- default {
627
-
628
- }
629
- }
630
- return 0
631
- }
632
- )
633
- (PublicMethod insert_node:void (p_node@(strong lives):CodeNode) {
634
- def push_target@(weak lives):CodeNode curr_node
635
-
636
- if(curr_node.infix_operator) {
637
- push_target = curr_node.infix_node
638
- if(push_target.to_the_right) {
639
- push_target = push_target.right_node
640
- p_node.parent = push_target
641
- }
642
- }
643
- push push_target.children p_node
644
-
645
- })
646
-
647
- ( PublicMethod parse:void () (
648
-
649
- (def s:charbuffer (unwrap buff))
650
-
651
- @onError(
652
- (if (!null? curr_node)
653
- (
654
- (def line_index:int (call curr_node getLine ()))
655
- (= line_index (call curr_node getLine ()))
656
- (print (+ (call curr_node getFilename ()) " Line: " line_index))
657
- (print "Parser error close to")
658
- (print (call curr_node getLineString(line_index)))
659
-
660
- (= had_error true)
661
- )
662
- )
663
- )
664
-
665
- (def c:char (charAt s 0))
666
- (def next_c:char 0)
667
- (def fc:char 0)
668
-
669
- (def new_node:CodeNode)
670
-
671
- (def sp:int 0)
672
- (def ep:int 0)
673
-
674
- (def last_i:int 0)
675
- (def had_lf:boolean false)
676
-
677
- (while (< i len)
678
- (
679
-
680
- (if had_error (break _))
681
- ; (print i)
682
- (= last_i i)
683
-
684
- (def is_block_parent:boolean false)
685
-
686
- (if had_lf
687
- (
688
- (= had_lf false)
689
- (this.end_expression())
690
- (break _)
691
- )
692
- )
693
-
694
-
695
- (if (!null? curr_node)
696
- (
697
-
698
- (if (!null? curr_node.parent)
699
- (
700
- (def nodeParent:CodeNode curr_node.parent)
701
- (if nodeParent.is_block_node (
702
- (= is_block_parent true)
703
- ))
704
- )
705
- )
706
- )
707
- )
708
-
709
-
710
- ; comma expression
711
- ; (|| (<= (charAt s i) 32 ) (== (charAt s i) (charcode ","))
712
-
713
- ; original: (<= (charAt s i) 32 ) )
714
- ; new with comma: (|| (<= (charAt s i) 32 ) (== (charAt s i) (charcode ",")))
715
-
716
- (if (this.skip_space(is_block_parent)) {
717
- break _
718
- })
719
-
720
- (= had_lf false)
721
- (= c (charAt s i))
722
-
723
- (if (< i len)
724
- (
725
- (= c (charAt s i))
726
- (if (== c 59)
727
- (
728
- (= sp (+ i 1))
729
- ; read the comment
730
- (while ( && (< i len)
731
- (> (charAt s i) 31 ) )
732
- (
733
- ; (print "-- comment --")
734
- (= i (+ 1 i))
735
- )
736
- )
737
-
738
- (if (i >= len)
739
- (break _)
740
- )
741
-
742
- (= new_node (new CodeNode((unwrap code) sp i)))
743
- (= new_node.value_type RangerNodeType.Comment)
744
- (= new_node.string_value (substring s sp i))
745
- (push curr_node.comments (unwrap new_node))
746
-
747
- (continue _)
748
- ))
749
-
750
- ; NEW S-EXPRESSION STARTS HERE!!!!!
751
- (if (< i (- len 1))
752
- (
753
- (= fc (charAt s (+ i 1)))
754
- (if (||
755
- (== c 40)
756
- (== c (charcode "{")) ; support also braces for now
757
- (&& (== c 39) (== fc 40) )
758
- (&& (== c 96) (== fc 40) ) )
759
- (
760
- ; (print "Found ( ")
761
- (= paren_cnt (+ paren_cnt 1))
762
- (if (null? curr_node)
763
- (
764
- (= rootNode (new CodeNode((unwrap code) i i)))
765
- (= curr_node rootNode)
766
- (if (== c 96) (= curr_node.value_type RangerNodeType.Quasiliteral))
767
- (if (== c 39) (= curr_node.value_type RangerNodeType.Literal))
768
- (= curr_node.expression true)
769
- (push parents (unwrap curr_node))
770
- ; (print "-> new root node")
771
- )
772
- (
773
- (def new_qnode@(lives):CodeNode (new CodeNode((unwrap code) i i)))
774
- (if (== c 96) (= new_qnode.value_type RangerNodeType.Quasiliteral))
775
- (if (== c 39) (= new_qnode.value_type RangerNodeType.Literal))
776
- (= new_qnode.expression true)
777
-
778
- (this.insert_node(new_qnode))
779
- ; (push curr_node.children new_qnode)
780
- (push parents new_qnode) ; lifetime?
781
- (= curr_node new_qnode)
782
-
783
- ; (print "added a new child node")
784
- )
785
- )
786
- (if (== c (charcode "{"))
787
- (
788
- ( = curr_node.is_block_node true )
789
- )
790
- )
791
- (= i (+ 1 i))
792
- (this.parse())
793
- (continue _)
794
-
795
- ))
796
- )
797
- )
798
-
799
- (= sp i)
800
- (= ep i)
801
- (= fc (charAt s i))
802
-
803
- (if ( || ( && (== fc 45) (>= (charAt s (+ i 1)) 46) (<= (charAt s (+ i 1)) 57) )
804
- ( && (>= fc 48) (<= fc 57) ) )
805
- (
806
- ; (print "Found number ")
807
- (def is_double:boolean false)
808
- (= sp i)
809
- (= i (+ 1 i))
810
- (= c (charAt s i))
811
- (while ( && (< i len)
812
- ( || ( && (>= c 48) (<= c 57))
813
- ;( == c (charcode "e"))
814
- ;( == c (charcode "E"))
815
- ( == c (charcode "."))
816
- (&& (== i sp)
817
- ( || ( == c (charcode "+"))
818
- ( == c (charcode "-")) ) )
819
-
820
- )
821
- )
822
- (
823
- (if ( == c (charcode "."))
824
- (
825
- (= is_double true)
826
- )
827
- )
828
- (= i (+ 1 i))
829
- (= c (charAt s i))
830
- )
831
- )
832
- (= ep i)
833
-
834
- (def new_num_node:CodeNode (new CodeNode((unwrap code) sp ep)))
835
-
836
- (if is_double
837
- (
838
- (= new_num_node.value_type RangerNodeType.Double)
839
- (= new_num_node.double_value (unwrap (str2double (substring s sp ep))))
840
- )
841
- (
842
- (= new_num_node.value_type RangerNodeType.Integer)
843
- (= new_num_node.int_value (unwrap (str2int (substring s sp ep))))
844
- )
845
-
846
- )
847
-
848
-
849
- (this.insert_node(new_num_node))
850
- ; (push curr_node.children new_num_node)
851
- ; (print (call new_node getString ()))
852
- ; set type to number...
853
- (continue _ )
854
-
855
- ))
856
-
857
- ; if " then we have a string value
858
- (if (== fc 34)
859
- (
860
- ; (= i (+ i 1))
861
- (= sp (+ i 1))
862
- (= ep sp)
863
- (= c (charAt s i))
864
-
865
- (def must_encode:boolean false)
866
- ; find the end of ""
867
- (while (< i len)
868
- (
869
- (= i (+ 1 i))
870
- (= c (charAt s i))
871
- (if (== c 34)
872
- (break _)
873
- )
874
- (if (== c 92)
875
- (
876
- ; escape character after \...
877
- ; \"\"
878
- (= i (+ 1 i))
879
- (if (< i len)
880
- (
881
- (= must_encode true)
882
- (= c (charAt s i))
883
- )
884
- (break _)
885
- )
886
- )
887
- )
888
- )
889
- )
890
- (= ep i)
891
- (if (< i len)
892
- (
893
- (def encoded_str:string "")
894
- (if must_encode
895
- (
896
-
897
- (def orig_str:charbuffer (to_charbuffer (substring s sp ep)))
898
- (def str_length:int (length orig_str))
899
- (def ii:int 0)
900
-
901
- ; a bit slow algorithm, could be improved much faster by copying
902
- ; longer slices
903
- (while (< ii str_length)
904
- (
905
- (def cc:char (charAt orig_str ii))
906
-
907
- (if (== cc 92)
908
- (
909
- (def next_ch:char (charAt orig_str (+ ii 1)))
910
- (switch next_ch (
911
- (case 34 ( ( = encoded_str (+ encoded_str (strfromcode 34 ) ) ) ) )
912
- (case 92 ( ( = encoded_str (+ encoded_str (strfromcode 92 ) ) ) ) )
913
- (case 47 ( ( = encoded_str (+ encoded_str (strfromcode 47 ) ) ) ) )
914
-
915
- (case 98
916
- ( = encoded_str (+ encoded_str (strfromcode 8 ) ) )
917
- )
918
- (case 102
919
- ( = encoded_str (+ encoded_str (strfromcode 12 ) ) )
920
- )
921
- (case 110
922
- (
923
- ( = encoded_str (+ encoded_str (strfromcode 10 ) ) )
924
- )
925
-
926
- )
927
- (case 114
928
- ( = encoded_str (+ encoded_str (strfromcode 13 ) ) )
929
- )
930
- (case 116
931
- ( = encoded_str (+ encoded_str (strfromcode 9 ) ) )
932
- )
933
- (case 117
934
- (
935
- ;; \uxxxx
936
- ;; then have to create UTF encoded string using the hex values
937
- ;; TODO
938
- ( = ii (+ ii 4)) ; 2 + 4
939
- )
940
- )
941
- (default ())
942
- )
943
- )
944
- ( = ii (+ ii 2))
945
- )
946
- (
947
- ; add normal char to the string
948
- ( = encoded_str (+ encoded_str (substring orig_str ii (+ 1 ii))))
949
- ( = ii (+ ii 1))
950
- )
951
- )
952
- )
953
- )
954
- )
955
- )
956
-
957
- (def new_str_node:CodeNode (new CodeNode((unwrap code) sp ep)))
958
- (= new_str_node.value_type RangerNodeType.String)
959
-
960
- (if must_encode
961
- (= new_str_node.string_value encoded_str)
962
- (= new_str_node.string_value (substring s sp ep))
963
- )
964
-
965
- (this.insert_node(new_str_node))
966
- ;(push curr_node.children new_str_node)
967
-
968
- ; (print (call new_node getString ()))
969
- ; set type to number...
970
- (= i (+ 1 i))
971
- (continue _ )
972
-
973
- )
974
- )
975
- )
976
- ) ; if " " ends
977
-
978
- ; test for true / false
979
- (if ( && (== fc (charcode "t"))
980
- (== (charAt s (+ i 1)) (charcode "r"))
981
- (== (charAt s (+ i 2)) (charcode "u"))
982
- (== (charAt s (+ i 3)) (charcode "e")) )
983
- (
984
-
985
- (def new_true_node:CodeNode (new CodeNode((unwrap code) sp (+ sp 4))))
986
- (= new_true_node.value_type RangerNodeType.Boolean)
987
- (= new_true_node.boolean_value true)
988
-
989
- (this.insert_node(new_true_node))
990
- ; (push curr_node.children new_true_node)
991
-
992
- (= i (+ i 4))
993
- (continue _)
994
- )
995
- )
996
-
997
- (if ( && (== fc (charcode "f"))
998
- (== (charAt s (+ i 1)) (charcode "a"))
999
- (== (charAt s (+ i 2)) (charcode "l"))
1000
- (== (charAt s (+ i 3)) (charcode "s"))
1001
- (== (charAt s (+ i 4)) (charcode "e")) )
1002
- (
1003
-
1004
-
1005
- (def new_f_node:CodeNode (new CodeNode((unwrap code) sp (+ sp 5))))
1006
- (= new_f_node.value_type RangerNodeType.Boolean)
1007
- (= new_f_node.boolean_value false)
1008
-
1009
- (this.insert_node(new_f_node))
1010
- ; (push curr_node.children new_f_node)
1011
-
1012
- (= i (+ i 5))
1013
- (continue _)
1014
- )
1015
- )
1016
-
1017
- ; expression annotation...
1018
- ; @prop(true)
1019
- (if (== fc (charcode "@"))
1020
- (
1021
- ; skip annotation mark and continue
1022
- (= i (+ i 1))
1023
- (= sp i)
1024
- (= ep i)
1025
- (= c (charAt s i))
1026
-
1027
- ; read the annontation element
1028
- (while ( && (< i len)
1029
- (> (charAt s i) 32 )
1030
- (!= c 40)
1031
- (!= c 41)
1032
- (!= c (charcode "}"))
1033
-
1034
- )
1035
- (
1036
- ; (print (+ "char:" c))
1037
- (= i (+ 1 i))
1038
- (= c (charAt s i))
1039
- )
1040
- )
1041
- (= ep i)
1042
-
1043
- (if (&& (< i len) (> ep sp) )
1044
- (
1045
- ; parse new expression as variable type
1046
- (def a_node2@(lives):CodeNode (new CodeNode((unwrap code) sp ep)))
1047
- (def a_name:string (substring s sp ep))
1048
-
1049
- (= a_node2.expression true)
1050
- (= curr_node a_node2)
1051
-
1052
- (push parents a_node2)
1053
- (= i (+ i 1))
1054
- (= paren_cnt (+ paren_cnt 1))
1055
-
1056
- (this.parse())
1057
-
1058
- @todo("add get strong reference from array")
1059
- ; the branching is mildly proglematic...
1060
- (def use_first:boolean false)
1061
- (if (== 1 (array_length a_node2.children))
1062
- (
1063
- (def ch1:CodeNode (itemAt a_node2.children 0))
1064
- (= use_first (ch1.isPrimitive()))
1065
- )
1066
- )
1067
- (if use_first
1068
- (
1069
- (def theNode:CodeNode (array_extract a_node2.children 0))
1070
- (set curr_node.props a_name theNode)
1071
- )(
1072
- (set curr_node.props a_name a_node2)
1073
- )
1074
- )
1075
-
1076
- (push curr_node.prop_keys a_name)
1077
- (continue _)
1078
-
1079
- )
1080
- )
1081
- )
1082
- )
1083
-
1084
- ; collect namespaces like obj.foo.x into separate array
1085
- ; ["obj", "foo", "x"]
1086
- (def ns_list@(temp):[string])
1087
- (def last_ns:int i)
1088
- (def ns_cnt:int 1)
1089
-
1090
- (def vref_had_type_ann:boolean false)
1091
- (def vref_ann_node@(temp):CodeNode )
1092
- (def vref_end:int i)
1093
-
1094
- ; collect the reference symbol.
1095
- ; change: if the parent node is a block node the reference is interpreted
1096
- ; as a new S-expression
1097
- (if ( && (< i len)
1098
- (> (charAt s i) 32 )
1099
- (!= c 58)
1100
- (!= c 40)
1101
- (!= c 41)
1102
- (!= c (charcode "}"))
1103
-
1104
- )
1105
- (
1106
- ; if reference symbol is observed in block node, make it a call immediately
1107
- (if (== curr_node.is_block_node true)
1108
- (
1109
- (def new_expr_node:CodeNode (new CodeNode((unwrap code) sp ep)))
1110
- (= new_expr_node.parent curr_node)
1111
- (= new_expr_node.expression true)
1112
- (push curr_node.children new_expr_node)
1113
- (= curr_node new_expr_node)
1114
- (push parents new_expr_node)
1115
- (= paren_cnt (+ 1 paren_cnt))
1116
-
1117
- (this.parse())
1118
- (continue _)
1119
- )
1120
- )
1121
- )
1122
- )
1123
-
1124
- ; op check
1125
-
1126
- (def op_c:int 0)
1127
- (if (>= (array_length curr_node.children) 0)
1128
- (
1129
- (= op_c (this.getOperator()))
1130
- )
1131
- )
1132
-
1133
- (def last_was_newline:boolean false)
1134
- (if (> op_c 0)
1135
- (
1136
- ; (print "--> found operator !!!")
1137
- )
1138
- (
1139
- (while ( && (< i len)
1140
- (> (charAt s i) 32 )
1141
- (!= c 58)
1142
- (!= c 40)
1143
- (!= c 41)
1144
- (!= c (charcode "}"))
1145
-
1146
- )
1147
- (
1148
-
1149
- (if (> i sp)
1150
- (
1151
- (def is_opchar:int (this.isOperator()))
1152
- (if (> is_opchar 0)
1153
- (
1154
- ; (print (+ "opchar around " (substring s last_ns (+ i 1))))
1155
- (break _)
1156
- )
1157
- )
1158
- )
1159
- )
1160
-
1161
- ; (print (+ "char:" c))
1162
- (= i (+ 1 i))
1163
- (= c (charAt s i))
1164
-
1165
- (if ( || (== c 10) (== c 13))
1166
- (
1167
- (= last_was_newline true)
1168
- (break _)
1169
- )
1170
- )
1171
-
1172
-
1173
- ; obj.
1174
- (if (== c (charcode "."))
1175
- (
1176
- (push ns_list (substring s last_ns i))
1177
- (= last_ns (+ i 1))
1178
- (= ns_cnt (+ 1 ns_cnt))
1179
- )
1180
- )
1181
-
1182
- (if ( && ( > i vref_end ) (== c (charcode "@")) )
1183
- (
1184
- (= vref_had_type_ann true)
1185
- (= vref_end i)
1186
- (= vref_ann_node (this.parse_raw_annotation ()))
1187
- ; (print "found annotation node")
1188
- (= c (charAt s i))
1189
- (break _)
1190
- )
1191
- )
1192
- )
1193
- )
1194
-
1195
- )
1196
- )
1197
-
1198
- (= ep i)
1199
-
1200
- (if vref_had_type_ann
1201
- (
1202
- (= ep vref_end)
1203
- )
1204
- )
1205
- (push ns_list (substring s last_ns ep))
1206
-
1207
-
1208
- ;(if (skip_space is_block_parent)
1209
- ; (break _)
1210
- ;)
1211
- ;(= c (charAt s i))
1212
-
1213
- ; skip empty space
1214
- (= c (charAt s i))
1215
- (while ( && (< i len)
1216
- (<= c 32 )
1217
- (== false last_was_newline)
1218
- )
1219
- (
1220
- ; (print "-- space --")
1221
- (= i (+ 1 i))
1222
- (= c (charAt s i))
1223
-
1224
- ; no newlines allowed here...
1225
- ;
1226
- (if (&& is_block_parent ( || (== c 10) (== c 13)))
1227
- (
1228
- (= i (- i 1))
1229
- (= c (charAt s i))
1230
- (= had_lf true)
1231
- (break _)
1232
- )
1233
- )
1234
- )
1235
- )
1236
-
1237
- ; : found, i:int or similar, variable type definition comes here
1238
- (if (== c 58)
1239
- (
1240
- ; (print "==> variable type")
1241
- (= i (+ i 1))
1242
-
1243
- ; skip whitespace
1244
- (while ( && (< i len) (<= (charAt s i) 32 ) ) (= i (+ 1 i)) )
1245
-
1246
- ; type definition start, end
1247
- (def vt_sp:int i)
1248
- (def vt_ep:int i)
1249
-
1250
- (= c (charAt s i))
1251
-
1252
- ; if variable type is function declaration like
1253
- ; (def f:(_:int(_:int _int)))
1254
- (if (== c (charcode "("))
1255
- (
1256
- ; parse new expression as variable type
1257
- (def a_node3@(lives):CodeNode (new CodeNode((unwrap code) sp ep)))
1258
- (= a_node3.expression true)
1259
- (= curr_node a_node3)
1260
-
1261
- (push parents a_node3)
1262
- (= i (+ i 1))
1263
-
1264
- (this.parse())
1265
-
1266
- (def new_expr_node:CodeNode (new CodeNode((unwrap code) sp vt_ep)))
1267
- (= new_expr_node.vref (substring s sp ep))
1268
- (= new_expr_node.ns ns_list)
1269
- (= new_expr_node.expression_value a_node3)
1270
- (= new_expr_node.value_type RangerNodeType.ExpressionType)
1271
-
1272
- (if vref_had_type_ann
1273
- (
1274
- (= new_expr_node.vref_annotation vref_ann_node)
1275
- (= new_expr_node.has_vref_annotation true)
1276
- )
1277
- )
1278
- (push curr_node.children new_expr_node)
1279
-
1280
- (continue _)
1281
-
1282
- )
1283
- )
1284
-
1285
- (if (== c (charcode "["))
1286
- (
1287
- ; handle start of array
1288
- (= i (+ i 1))
1289
- (= vt_sp i)
1290
-
1291
- (def hash_sep:int 0)
1292
- (def had_array_type_ann:boolean false)
1293
- (= c (charAt s i))
1294
- (while (&& (< i len) (> c 32)
1295
- (!= c 93) )
1296
- (
1297
- (= i (+ 1 i))
1298
- (= c (charAt s i))
1299
- (if (== c (charcode ":"))
1300
- (
1301
- (= hash_sep i)
1302
- )
1303
- )
1304
-
1305
- (if (== c (charcode "@"))
1306
- (
1307
- (= had_array_type_ann true)
1308
- (break _)
1309
- )
1310
- )
1311
- )
1312
- )
1313
- (= vt_ep i)
1314
- (if (> hash_sep 0)
1315
- (
1316
- ; hash
1317
- ; (print "Found HASH type")
1318
- ; (print (substring s sp ep))
1319
- (= vt_ep i)
1320
- (def type_name:string (substring s (+ 1 hash_sep) vt_ep))
1321
- (def key_type_name:string (substring s vt_sp hash_sep))
1322
-
1323
- ; also add namespace....
1324
- (def new_hash_node:CodeNode (new CodeNode((unwrap code) sp vt_ep)))
1325
- (= new_hash_node.vref (substring s sp ep))
1326
- (= new_hash_node.ns ns_list)
1327
- (= new_hash_node.value_type RangerNodeType.Hash)
1328
-
1329
- (= new_hash_node.array_type type_name)
1330
- (= new_hash_node.key_type key_type_name)
1331
-
1332
- (if vref_had_type_ann
1333
- (
1334
- (= new_hash_node.vref_annotation vref_ann_node)
1335
- (= new_hash_node.has_vref_annotation true)
1336
- )
1337
- )
1338
-
1339
- (if had_array_type_ann
1340
- (
1341
- (def vann_hash:CodeNode (this.parse_raw_annotation ()))
1342
- (= new_hash_node.type_annotation vann_hash)
1343
- (= new_hash_node.has_type_annotation true)
1344
- (print "--> parsed HASH TYPE annotation")
1345
- )
1346
- )
1347
-
1348
- (= new_hash_node.parent curr_node)
1349
- (push curr_node.children new_hash_node)
1350
- ; (print new_node.vref)
1351
- (= i (+ 1 i))
1352
- (continue _)
1353
-
1354
- )
1355
- (
1356
- ; array
1357
- (= vt_ep i)
1358
- (def type_name:string (substring s vt_sp vt_ep))
1359
- ; (print type_name)
1360
- ; also add namespace....
1361
- (def new_arr_node:CodeNode (new CodeNode((unwrap code) sp vt_ep)))
1362
- (= new_arr_node.vref (substring s sp ep))
1363
- (= new_arr_node.ns ns_list)
1364
- (= new_arr_node.value_type RangerNodeType.Array)
1365
-
1366
- (= new_arr_node.array_type type_name)
1367
- (= new_arr_node.parent curr_node)
1368
- (push curr_node.children new_arr_node)
1369
-
1370
-
1371
- (if vref_had_type_ann
1372
- (
1373
- (= new_arr_node.vref_annotation vref_ann_node)
1374
- (= new_arr_node.has_vref_annotation true)
1375
- )
1376
- )
1377
-
1378
- (if had_array_type_ann
1379
- (
1380
- (def vann_arr:CodeNode (this.parse_raw_annotation ()))
1381
- (= new_arr_node.type_annotation vann_arr)
1382
- (= new_arr_node.has_type_annotation true)
1383
- (print "--> parsed ARRAY TYPE annotation")
1384
- )
1385
- )
1386
-
1387
- (= i (+ 1 i))
1388
- (continue _)
1389
-
1390
- )
1391
- )
1392
- )
1393
- )
1394
-
1395
- ; parse normal type like :int, :double etc.
1396
- (def had_type_ann:boolean false)
1397
- (while ( && (< i len)
1398
- (> (charAt s i) 32 )
1399
- (!= c 58)
1400
- (!= c 40)
1401
- (!= c 41)
1402
- (!= c (charcode "}"))
1403
- (!= c (charcode ","))
1404
-
1405
- )
1406
- (
1407
- ; (print (+ "char:" c))
1408
- (= i (+ 1 i))
1409
- (= c (charAt s i))
1410
-
1411
- (if (== c (charcode "@"))
1412
- (
1413
- (= had_type_ann true)
1414
- ;(= i (- i 1))
1415
- (break _)
1416
- )
1417
- )
1418
- )
1419
- )
1420
- (if (< i len)
1421
- (
1422
- (= vt_ep i)
1423
- (def type_name:string (substring s vt_sp vt_ep))
1424
-
1425
- ; if current node is a block node then the expression will be the first child of
1426
- ; a new S-expression
1427
-
1428
- ; also add namespace....
1429
- (def new_ref_node:CodeNode (new CodeNode((unwrap code) sp ep)))
1430
- (= new_ref_node.vref (substring s sp ep))
1431
- (= new_ref_node.ns ns_list)
1432
- (= new_ref_node.value_type RangerNodeType.VRef)
1433
- (= new_ref_node.type_name (substring s vt_sp vt_ep))
1434
- (= new_ref_node.parent curr_node)
1435
-
1436
- (if vref_had_type_ann
1437
- (
1438
- (= new_ref_node.vref_annotation vref_ann_node)
1439
- (= new_ref_node.has_vref_annotation true)
1440
- )
1441
- )
1442
-
1443
- ; (print (+ "Found type " new_node.type_name))
1444
- (push curr_node.children new_ref_node)
1445
- (if had_type_ann
1446
- (
1447
- (def vann:CodeNode (this.parse_raw_annotation ()))
1448
- (= new_ref_node.type_annotation vann)
1449
- (= new_ref_node.has_type_annotation true)
1450
- ; (print "--> parsed TYPE annotation")
1451
- )
1452
- )
1453
- (continue _)
1454
- )
1455
- )
1456
- )
1457
- (
1458
- ; variable without a type definition
1459
-
1460
- ; (= c (charAt s i))
1461
-
1462
- (if ( && (< i len) (> ep sp) )
1463
- (
1464
- (def new_vref_node:CodeNode (new CodeNode((unwrap code) sp ep)))
1465
- (= new_vref_node.vref (substring s sp ep))
1466
- (= new_vref_node.value_type RangerNodeType.VRef)
1467
- (= new_vref_node.ns ns_list)
1468
- (= new_vref_node.parent curr_node)
1469
-
1470
- ; test if this is operator
1471
- (def op_pred:int (this.getOperatorPred(new_vref_node.vref)))
1472
-
1473
- ; comma will stop the infix processing...
1474
-
1475
- (if (== new_vref_node.vref ",")
1476
- (
1477
- (= curr_node.infix_operator false)
1478
- (continue _)
1479
- )
1480
- )
1481
-
1482
- ; TODO: check the IF below...
1483
- (def pTarget@(weak):CodeNode curr_node)
1484
- (if curr_node.infix_operator {
1485
- def iNode:CodeNode curr_node.infix_node
1486
- if (|| (> op_pred 0) (== iNode.to_the_right false) ) {
1487
- pTarget = iNode
1488
- } {
1489
-
1490
- def rn@(lives):CodeNode pTarget.right_node
1491
- new_vref_node.parent = rn
1492
- pTarget = rn
1493
- }
1494
- })
1495
-
1496
- (push pTarget.children new_vref_node)
1497
-
1498
-
1499
- (if vref_had_type_ann
1500
- (
1501
- ; (def vann:CodeNode (this.parse_raw_annotation ()))
1502
- (= new_vref_node.vref_annotation vref_ann_node)
1503
- (= new_vref_node.has_vref_annotation true)
1504
- ; (print "--> had a normal vref annotation")
1505
- ; (print (substring s sp ep))
1506
- )
1507
- )
1508
-
1509
- ; call operator consideration here, not implemented because it is hard if not impossible to determine
1510
- ; if the expression is starting simply a new list or is it actually a call.
1511
- (if ( || (== (charAt s (+ i 1)) (charcode "(") ) (== (charAt s (+ i 0)) (charcode "(")) )
1512
- (
1513
- (if ( && (== 0 op_pred) curr_node.infix_operator (== 1 (array_length curr_node.children)))
1514
- (
1515
- ; TODO: consider options for call operator here.
1516
- )
1517
- )
1518
- )
1519
- )
1520
-
1521
-
1522
- (if ( || ( && (> op_pred 0) curr_node.infix_operator) ( && (> op_pred 0) (>= (array_length curr_node.children) 2) ) )
1523
- (
1524
-
1525
- ; assigment operator...
1526
- (if ( && (== op_pred 3) ( == 2 (array_length curr_node.children) ) )
1527
- (
1528
- ; just swap the first and second node...
1529
- (def n_ch:CodeNode (array_extract curr_node.children 0))
1530
- (push curr_node.children n_ch)
1531
-
1532
- )
1533
- (
1534
-
1535
- (if (== false curr_node.infix_operator)
1536
- (
1537
- ; (print "we should create a new infix_operator node right here...")
1538
- (def if_node:CodeNode (new CodeNode((unwrap code) sp ep)))
1539
-
1540
-
1541
-
1542
- (= curr_node.infix_operator true)
1543
- (= if_node.infix_subnode true)
1544
-
1545
- (= curr_node.value_type RangerNodeType.NoType)
1546
- (= curr_node.expression true)
1547
-
1548
- (= if_node.expression true)
1549
-
1550
- ; move the nodes to the infix node and use that node instead
1551
- (def ch_cnt:int (array_length curr_node.children))
1552
- (def ii:int 0)
1553
- (def start_from:int (- ch_cnt 2))
1554
-
1555
- (push curr_node.children if_node)
1556
- (= curr_node.infix_node if_node)
1557
-
1558
- ; possible memory leak:
1559
- (def keep_nodes:CodeNode (new CodeNode((unwrap code) sp ep)))
1560
- (while (> ch_cnt 0)
1561
- (
1562
- (def n_ch:CodeNode (array_extract curr_node.children 0))
1563
- (def p_target:CodeNode if_node)
1564
- (if ( || (< ii start_from) n_ch.infix_subnode )
1565
- ( = p_target keep_nodes)
1566
- )
1567
- (push p_target.children n_ch)
1568
- (= ch_cnt (- ch_cnt 1))
1569
- (= ii (+ 1 ii))
1570
- )
1571
- )
1572
- (for keep_nodes.children keep:CodeNode i
1573
- (
1574
- (push curr_node.children keep)
1575
- )
1576
- )
1577
- ; infix_node
1578
- )
1579
- )
1580
-
1581
- ; lives annotation removes the warnings...
1582
- (def ifNode@(lives):CodeNode curr_node.infix_node)
1583
-
1584
- ; (print ( + "operator" new_vref_node.vref " close to") )
1585
- ; (def c_line_index:int (call curr_node getLine ()))
1586
- ; (print (call curr_node getLineString(c_line_index)))
1587
- ; (print (+ "now has " (array_length curr_node.children) " nodes "))
1588
-
1589
-
1590
- (def new_op_node:CodeNode (new CodeNode((unwrap code) sp ep)))
1591
- (= new_op_node.expression true)
1592
- (= new_op_node.parent ifNode)
1593
-
1594
- (def until_index:int (- (array_length ifNode.children) 1))
1595
- (def to_right:boolean false)
1596
- (def just_continue:boolean false)
1597
-
1598
- (if ( && (> ifNode.operator_pred 0) ( < ifNode.operator_pred op_pred) )
1599
- (
1600
- (= to_right true)
1601
- )
1602
- )
1603
-
1604
- (if ( && (> ifNode.operator_pred 0) ( > ifNode.operator_pred op_pred) )
1605
- (
1606
- (= ifNode.to_the_right false)
1607
- )
1608
- )
1609
-
1610
- (if ( && (> ifNode.operator_pred 0) ( == ifNode.operator_pred op_pred) )
1611
- (
1612
- (= to_right ifNode.to_the_right)
1613
- )
1614
- )
1615
-
1616
- (def opTarget:CodeNode ifNode)
1617
- (if to_right
1618
- (
1619
- ; 3 * 4 + 5 * 7
1620
- (def op_node:CodeNode (array_extract ifNode.children until_index))
1621
- (def last_value:CodeNode (array_extract ifNode.children (- until_index 1)))
1622
-
1623
- (push new_op_node.children op_node)
1624
- (push new_op_node.children last_value)
1625
-
1626
- )
1627
- (
1628
- (if (== false just_continue)
1629
- (
1630
- (while (> until_index 0)
1631
- (
1632
- (def what_to_add:CodeNode (array_extract ifNode.children 0))
1633
- (push new_op_node.children what_to_add)
1634
- (= until_index (- until_index 1))
1635
- )
1636
- )
1637
- )
1638
- )
1639
- )
1640
- )
1641
- (push opTarget.children new_op_node)
1642
-
1643
- (if to_right (
1644
- (= ifNode.right_node new_op_node)
1645
- (= ifNode.to_the_right true)
1646
- ))
1647
-
1648
- (= ifNode.operator_pred op_pred)
1649
- (continue _)
1650
-
1651
-
1652
- )
1653
- )
1654
-
1655
-
1656
-
1657
- )
1658
- )
1659
-
1660
- (continue _)
1661
- )
1662
- )
1663
- )
1664
- )
1665
-
1666
- (if ( || (== c 41) (== c (charcode "}")) )
1667
- (
1668
- ; } is the same as newline and if we have { return "foobar" } it is required to end the current expression first
1669
- (if (&& (== c (charcode "}")) is_block_parent ( > (array_length curr_node.children) 0) )
1670
- (
1671
- (this.end_expression())
1672
- )
1673
- )
1674
-
1675
- ; (print "Found ) ")
1676
- (= i (+ 1 i))
1677
- (= paren_cnt (- paren_cnt 1))
1678
- (if (< paren_cnt 0) {
1679
- ; was throwing exception here...
1680
- break _
1681
- })
1682
-
1683
- (removeLast parents)
1684
- (if (!null? curr_node)
1685
- (= curr_node.ep i)
1686
- )
1687
-
1688
- (if (> (array_length parents) 0)
1689
- (
1690
- (= curr_node (itemAt parents (- (array_length parents) 1 ) ))
1691
- )
1692
- (
1693
- (= curr_node rootNode)
1694
- )
1695
- )
1696
- (break _)
1697
-
1698
- ))
1699
-
1700
- (if (== last_i i)
1701
- (= i (+ 1 i))
1702
- )
1703
- )
1704
- )
1705
-
1706
- )
1707
- )
1708
-
1709
- )
1710
- }
1711
- )
1712
- )
1713
-
1714
-
1715
-
1716
-
1717
-
1718
-