ranger-compiler 2.1.69 → 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 +991 -96
  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/{bin/output.js → dist/rgrc.js} +15377 -7935
  46. package/dist/stdops.rgr +168 -0
  47. package/package.json +196 -38
  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/compiler/ColorConsole.clj +0 -22
  150. package/compiler/ContextOperators.clj +0 -75
  151. package/compiler/FlowEnterVarDef.clj +0 -223
  152. package/compiler/InputFileSystem.clj +0 -276
  153. package/compiler/RangerDocs.clj +0 -7
  154. package/compiler/TFactory.clj +0 -146
  155. package/compiler/TFiles.clj +0 -23
  156. package/compiler/TFlow.clj +0 -39
  157. package/compiler/TNodeFactory.clj +0 -84
  158. package/compiler/TTypes.clj +0 -188
  159. package/compiler/VirtualCompiler.clj +0 -800
  160. package/compiler/bin/ng_Compiler.js +0 -23779
  161. package/compiler/commonmark_plugin.clj +0 -359
  162. package/compiler/feat2.bat +0 -2
  163. package/compiler/feats.bat +0 -9
  164. package/compiler/feature_tests.clj +0 -192
  165. package/compiler/index.js +0 -2
  166. package/compiler/issue_57.clj +0 -25
  167. package/compiler/makefile_plugin.clj +0 -135
  168. package/compiler/markdown_plugin.clj +0 -386
  169. package/compiler/maven_plugin.clj +0 -162
  170. package/compiler/ng_AndroidPageWriter.clj +0 -299
  171. package/compiler/ng_CodeNode.clj +0 -756
  172. package/compiler/ng_CodeNodeCompilerExtensions.clj +0 -839
  173. package/compiler/ng_Compiler.clj +0 -49
  174. package/compiler/ng_CompilerGeneric.clj +0 -260
  175. package/compiler/ng_CompilerOrig.clj +0 -854
  176. package/compiler/ng_DictNode.clj +0 -346
  177. package/compiler/ng_DictNode2.clj +0 -316
  178. package/compiler/ng_Execute.clj +0 -138
  179. package/compiler/ng_Execute1.clj +0 -129
  180. package/compiler/ng_FlowWork.clj +0 -3951
  181. package/compiler/ng_LiveCompiler.clj +0 -1109
  182. package/compiler/ng_RagnerJavaScriptClassWriter.clj +0 -402
  183. package/compiler/ng_RangerActiveOperators.clj +0 -86
  184. package/compiler/ng_RangerAppClassDesc.clj +0 -400
  185. package/compiler/ng_RangerAppEnums.clj +0 -86
  186. package/compiler/ng_RangerAppFunctionDesc.clj +0 -127
  187. package/compiler/ng_RangerAppMessages.clj +0 -15
  188. package/compiler/ng_RangerAppOperatorDesc.clj +0 -20
  189. package/compiler/ng_RangerAppParamDesc.clj +0 -388
  190. package/compiler/ng_RangerAppWriterContext.clj +0 -1793
  191. package/compiler/ng_RangerArgMatch.clj +0 -638
  192. package/compiler/ng_RangerCSharpClassWriter.clj +0 -484
  193. package/compiler/ng_RangerCppClassWriter.clj +0 -1023
  194. package/compiler/ng_RangerDocGenerator.clj +0 -305
  195. package/compiler/ng_RangerFlowParser.clj +0 -4992
  196. package/compiler/ng_RangerFlowParserOrig.clj +0 -4002
  197. package/compiler/ng_RangerGenericClassWriter.clj +0 -573
  198. package/compiler/ng_RangerGolangClassWriter.clj +0 -1766
  199. package/compiler/ng_RangerImmutableExtension.clj +0 -77
  200. package/compiler/ng_RangerJava7ClassWriter.clj +0 -961
  201. package/compiler/ng_RangerJavaScriptClassWriter.clj +0 -1042
  202. package/compiler/ng_RangerKotlinClassWriter.clj +0 -372
  203. package/compiler/ng_RangerLanguageWriters.clj +0 -14
  204. package/compiler/ng_RangerLispParser.clj +0 -873
  205. package/compiler/ng_RangerPHPClassWriter.clj +0 -643
  206. package/compiler/ng_RangerPlugin.clj +0 -41
  207. package/compiler/ng_RangerRangerClassWriter.clj +0 -357
  208. package/compiler/ng_RangerRustClassWriter.clj +0 -420
  209. package/compiler/ng_RangerScalaClassWriter.clj +0 -818
  210. package/compiler/ng_RangerSerializeClass.clj +0 -502
  211. package/compiler/ng_RangerServiceBuilder.clj +0 -63
  212. package/compiler/ng_RangerSwift3ClassWriter.clj +0 -809
  213. package/compiler/ng_RangerSwiftClassWriter.clj +0 -0
  214. package/compiler/ng_RangerTypeClass.clj +0 -45
  215. package/compiler/ng_SourceParser.clj +0 -241
  216. package/compiler/ng_SourceParser2.clj +0 -214
  217. package/compiler/ng_WebPageWriter.clj +0 -39
  218. package/compiler/ng_jsonParser.clj +0 -340
  219. package/compiler/ng_p_test.clj +0 -1711
  220. package/compiler/ng_parser.clj +0 -911
  221. package/compiler/ng_parser2.clj +0 -735
  222. package/compiler/ng_parser2_backup.clj +0 -1679
  223. package/compiler/ng_parser_backup.clj +0 -886
  224. package/compiler/ng_parser_ok.clj +0 -1718
  225. package/compiler/ng_parser_ok2.clj +0 -1717
  226. package/compiler/ng_parser_std_match.clj +0 -687
  227. package/compiler/ng_parser_std_match2.clj +0 -1012
  228. package/compiler/ng_parser_v2.clj +0 -1251
  229. package/compiler/ng_ui.clj +0 -403
  230. package/compiler/ng_ui_test.clj +0 -18
  231. package/compiler/ng_writer.clj +0 -338
  232. package/compiler/ng_xmlParser.clj +0 -472
  233. package/compiler/ng_xmlParser2.clj +0 -317
  234. package/compiler/ng_xmlParser3.clj +0 -251
  235. package/compiler/opdoc.bat +0 -4
  236. package/compiler/operators.md +0 -290
  237. package/compiler/p.bat +0 -4
  238. package/compiler/package.json +0 -10
  239. package/compiler/pcmd.bat +0 -4
  240. package/compiler/pcmd2.bat +0 -3
  241. package/compiler/plaintext_plugin.clj +0 -69
  242. package/compiler/plugin.bat +0 -19
  243. package/compiler/plugin2.bat +0 -4
  244. package/compiler/plugin_app.bat +0 -3
  245. package/compiler/plugin_apps.clj +0 -27
  246. package/compiler/plugins.bat +0 -10
  247. package/compiler/reveal_plugin.clj +0 -409
  248. package/compiler/simplePlugin.clj +0 -780
  249. package/compiler/t.bat +0 -3
  250. package/compiler/test_any.clj +0 -43
  251. package/compiler/test_call.clj +0 -141
  252. package/compiler/test_chain.clj +0 -79
  253. package/compiler/test_json.clj +0 -10
  254. package/compiler/test_lambda.clj +0 -153
  255. package/compiler/test_pcmd.clj +0 -32
  256. package/compiler/test_pcmd2.clj +0 -29
  257. package/compiler/test_plugin.clj +0 -237
  258. package/compiler/test_readfile.clj +0 -13
  259. package/compiler/test_reveal.clj +0 -19
  260. package/compiler/test_slides.clj +0 -312
  261. package/compiler/test_types.clj +0 -143
  262. package/compiler/test_types2.clj +0 -49
  263. package/compiler/test_types3.clj +0 -53
  264. package/compiler/test_var.clj +0 -40
  265. package/compiler/tonpm.bat +0 -14
  266. package/compiler/tonpm2.bat +0 -12
  267. package/compiler/ui_plugin.clj +0 -507
  268. package/compiler/ui_plugin2.clj +0 -427
  269. package/compiler/update-git.bat +0 -3
  270. package/compiler/vcomp.bat +0 -4
  271. package/compiler/viewbuilder_Android.clj +0 -176
  272. package/compiler/viewbuilder_Web.clj +0 -105
  273. package/dist/bin/api.js +0 -32422
  274. package/dist/bin/api.js.map +0 -1
  275. package/dist/bin/compiler.d.ts +0 -1638
  276. package/dist/bin/compiler.js +0 -32444
  277. package/dist/bin/compiler.js.map +0 -1
  278. package/examples/3D/bin/test_3d.js +0 -329
  279. package/examples/3D/test_3d.clj +0 -385
  280. package/examples/EVGColor/EVGColor.clj +0 -310
  281. package/examples/EVGColor/EVGColorContext.clj +0 -176
  282. package/examples/EVGColor/bin/EVGColor.js +0 -286
  283. package/examples/EVGColor/bin/minimized.js +0 -286
  284. package/examples/SVGPath/SVGPath.clj +0 -625
  285. package/examples/SVGPath/Vec2.clj +0 -103
  286. package/examples/SVGPath/bin/SVGPath.cpp +0 -887
  287. package/examples/SVGPath/bin/SVGPath.js +0 -682
  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,845 +0,0 @@
1
- import java.util.Optional;
2
- import java.util.*;
3
- import java.io.*;
4
-
5
- class RangerLispParser {
6
- public Optional<SourceCode> code = Optional.empty();
7
- public Optional<byte[]> buff = Optional.empty();
8
- public int __len = 0;
9
- public int i = 0;
10
- public ArrayList<CodeNode> parents = new ArrayList<CodeNode>();
11
- public Optional<CodeNode> next = Optional.empty() /** note: unused */;
12
- public int paren_cnt = 0;
13
- public int get_op_pred = 0 /** note: unused */;
14
- public Optional<CodeNode> rootNode = Optional.empty();
15
- public Optional<CodeNode> curr_node = Optional.empty();
16
- public boolean had_error = false;
17
-
18
- RangerLispParser( SourceCode code_module ) {
19
- buff = Optional.of(code_module.code.getBytes());
20
- code = Optional.of(code_module);
21
- __len = (buff.get()).length;
22
- rootNode = Optional.of(new CodeNode(code.get(), 0, 0));
23
- rootNode.get().is_block_node = true;
24
- rootNode.get().expression = true;
25
- curr_node = rootNode;
26
- parents.add(curr_node.get());
27
- paren_cnt = 1;
28
- }
29
-
30
- public void joo( SourceCode cm ) {
31
- /** unused: final int ll = cm.code.length() **/ ;
32
- }
33
-
34
- public CodeNode parse_raw_annotation() {
35
- int sp = i;
36
- int ep = i;
37
- i = i + 1;
38
- sp = i;
39
- ep = i;
40
- if ( i < __len ) {
41
- final CodeNode a_node2 = new CodeNode(code.get(), sp, ep);
42
- a_node2.expression = true;
43
- curr_node = Optional.of(a_node2);
44
- parents.add(a_node2);
45
- i = i + 1;
46
- paren_cnt = paren_cnt + 1;
47
- this.parse();
48
- return a_node2;
49
- } else {
50
- }
51
- return new CodeNode(code.get(), sp, ep);
52
- }
53
-
54
- public boolean skip_space( boolean is_block_parent ) {
55
- final byte[] s = buff.get();
56
- boolean did_break = false;
57
- if ( i >= __len ) {
58
- return true;
59
- }
60
- byte c = s[i];
61
- /** unused: final boolean bb = c == (46) **/ ;
62
- while ((i < __len) && (c <= 32)) {
63
- if ( is_block_parent && ((c == 10) || (c == 13)) ) {
64
- this.end_expression();
65
- did_break = true;
66
- break;
67
- }
68
- i = 1 + i;
69
- if ( i >= __len ) {
70
- return true;
71
- }
72
- c = s[i];
73
- }
74
- return did_break;
75
- }
76
-
77
- public boolean end_expression() {
78
- i = 1 + i;
79
- if ( i >= __len ) {
80
- return false;
81
- }
82
- paren_cnt = paren_cnt - 1;
83
- if ( paren_cnt < 0 ) {
84
- System.out.println(String.valueOf( "Parser error ) mismatch" ) );
85
- }
86
- parents.remove(parents.size() - 1);
87
- if ( curr_node.isPresent() ) {
88
- curr_node.get().ep = i;
89
- curr_node.get().infix_operator = false;
90
- }
91
- if ( (parents.size()) > 0 ) {
92
- curr_node = Optional.of(parents.get(((parents.size()) - 1)));
93
- } else {
94
- curr_node = rootNode;
95
- }
96
- curr_node.get().infix_operator = false;
97
- return true;
98
- }
99
-
100
- public int getOperator() {
101
- final byte[] s = buff.get();
102
- if ( (i + 2) >= __len ) {
103
- return 0;
104
- }
105
- final byte c = s[i];
106
- final byte c2 = s[(i + 1)];
107
- switch (c ) {
108
- case 42 :
109
- i = i + 1;
110
- return 14;
111
- case 47 :
112
- i = i + 1;
113
- return 14;
114
- case 43 :
115
- i = i + 1;
116
- return 13;
117
- case 45 :
118
- i = i + 1;
119
- return 13;
120
- case 60 :
121
- if ( c2 == (61) ) {
122
- i = i + 2;
123
- return 11;
124
- }
125
- i = i + 1;
126
- return 11;
127
- case 62 :
128
- if ( c2 == (61) ) {
129
- i = i + 2;
130
- return 11;
131
- }
132
- i = i + 1;
133
- return 11;
134
- case 33 :
135
- if ( c2 == (61) ) {
136
- i = i + 2;
137
- return 10;
138
- }
139
- return 0;
140
- case 61 :
141
- if ( c2 == (61) ) {
142
- i = i + 2;
143
- return 10;
144
- }
145
- i = i + 1;
146
- return 3;
147
- case 38 :
148
- if ( c2 == (38) ) {
149
- i = i + 2;
150
- return 6;
151
- }
152
- return 0;
153
- case 124 :
154
- if ( c2 == (124) ) {
155
- i = i + 2;
156
- return 5;
157
- }
158
- return 0;
159
- default:
160
- break;
161
- }
162
- return 0;
163
- }
164
-
165
- public int isOperator() {
166
- final byte[] s = buff.get();
167
- if ( (i - 2) > __len ) {
168
- return 0;
169
- }
170
- final byte c = s[i];
171
- final byte c2 = s[(i + 1)];
172
- switch (c ) {
173
- case 42 :
174
- return 1;
175
- case 47 :
176
- return 14;
177
- case 43 :
178
- return 13;
179
- case 45 :
180
- return 13;
181
- case 60 :
182
- if ( c2 == (61) ) {
183
- return 11;
184
- }
185
- return 11;
186
- case 62 :
187
- if ( c2 == (61) ) {
188
- return 11;
189
- }
190
- return 11;
191
- case 33 :
192
- if ( c2 == (61) ) {
193
- return 10;
194
- }
195
- return 0;
196
- case 61 :
197
- if ( c2 == (61) ) {
198
- return 10;
199
- }
200
- return 3;
201
- case 38 :
202
- if ( c2 == (38) ) {
203
- return 6;
204
- }
205
- return 0;
206
- case 124 :
207
- if ( c2 == (124) ) {
208
- return 5;
209
- }
210
- return 0;
211
- default:
212
- break;
213
- }
214
- return 0;
215
- }
216
-
217
- public int getOperatorPred( String str ) {
218
- switch (str ) {
219
- case "<" :
220
- return 11;
221
- case ">" :
222
- return 11;
223
- case "<=" :
224
- return 11;
225
- case ">=" :
226
- return 11;
227
- case "==" :
228
- return 10;
229
- case "!=" :
230
- return 10;
231
- case "=" :
232
- return 3;
233
- case "&&" :
234
- return 6;
235
- case "||" :
236
- return 5;
237
- case "+" :
238
- return 13;
239
- case "-" :
240
- return 13;
241
- case "*" :
242
- return 14;
243
- case "/" :
244
- return 14;
245
- default:
246
- break;
247
- }
248
- return 0;
249
- }
250
-
251
- public void insert_node( CodeNode p_node ) {
252
- Optional<CodeNode> push_target = curr_node;
253
- if ( curr_node.get().infix_operator ) {
254
- push_target = curr_node.get().infix_node;
255
- if ( push_target.get().to_the_right ) {
256
- push_target = push_target.get().right_node;
257
- p_node.parent = push_target;
258
- }
259
- }
260
- push_target.get().children.add(p_node);
261
- }
262
-
263
- public void parse() {
264
- final byte[] s = buff.get();
265
- byte c = s[0];
266
- /** unused: final byte next_c = 0 **/ ;
267
- byte fc = 0;
268
- Optional<CodeNode> new_node = Optional.empty();
269
- int sp = 0;
270
- int ep = 0;
271
- int last_i = 0;
272
- boolean had_lf = false;
273
- while (i < __len) {
274
- if ( had_error ) {
275
- break;
276
- }
277
- last_i = i;
278
- boolean is_block_parent = false;
279
- if ( had_lf ) {
280
- had_lf = false;
281
- this.end_expression();
282
- break;
283
- }
284
- if ( curr_node.isPresent() ) {
285
- if ( curr_node.get().parent.isPresent() ) {
286
- final Optional<CodeNode> nodeParent = curr_node.get().parent;
287
- if ( nodeParent.get().is_block_node ) {
288
- is_block_parent = true;
289
- }
290
- }
291
- }
292
- if ( this.skip_space(is_block_parent) ) {
293
- break;
294
- }
295
- had_lf = false;
296
- c = s[i];
297
- if ( i < __len ) {
298
- c = s[i];
299
- if ( c == 59 ) {
300
- sp = i + 1;
301
- while ((i < __len) && ((s[i]) > 31)) {
302
- i = 1 + i;
303
- }
304
- if ( i >= __len ) {
305
- break;
306
- }
307
- new_node = Optional.of(new CodeNode(code.get(), sp, i));
308
- new_node.get().parsed_type = 10;
309
- new_node.get().value_type = 10;
310
- new_node.get().string_value = new String(s,sp, i - sp );
311
- curr_node.get().comments.add(new_node.get());
312
- continue;
313
- }
314
- if ( i < (__len - 1) ) {
315
- fc = s[(i + 1)];
316
- if ( (((c == 40) || (c == (123))) || ((c == 39) && (fc == 40))) || ((c == 96) && (fc == 40)) ) {
317
- paren_cnt = paren_cnt + 1;
318
- if ( !curr_node.isPresent() ) {
319
- rootNode = Optional.of(new CodeNode(code.get(), i, i));
320
- curr_node = rootNode;
321
- if ( c == 96 ) {
322
- curr_node.get().parsed_type = 30;
323
- curr_node.get().value_type = 30;
324
- }
325
- if ( c == 39 ) {
326
- curr_node.get().parsed_type = 29;
327
- curr_node.get().value_type = 29;
328
- }
329
- curr_node.get().expression = true;
330
- parents.add(curr_node.get());
331
- } else {
332
- final CodeNode new_qnode = new CodeNode(code.get(), i, i);
333
- if ( c == 96 ) {
334
- new_qnode.value_type = 30;
335
- }
336
- if ( c == 39 ) {
337
- new_qnode.value_type = 29;
338
- }
339
- new_qnode.expression = true;
340
- this.insert_node(new_qnode);
341
- parents.add(new_qnode);
342
- curr_node = Optional.of(new_qnode);
343
- }
344
- if ( c == (123) ) {
345
- curr_node.get().is_block_node = true;
346
- }
347
- i = 1 + i;
348
- this.parse();
349
- continue;
350
- }
351
- }
352
- sp = i;
353
- ep = i;
354
- fc = s[i];
355
- if ( (((fc == 45) && ((s[(i + 1)]) >= 46)) && ((s[(i + 1)]) <= 57)) || ((fc >= 48) && (fc <= 57)) ) {
356
- boolean is_double = false;
357
- sp = i;
358
- i = 1 + i;
359
- c = s[i];
360
- while ((i < __len) && ((((c >= 48) && (c <= 57)) || (c == (46))) || ((i == sp) && ((c == (43)) || (c == (45)))))) {
361
- if ( c == (46) ) {
362
- is_double = true;
363
- }
364
- i = 1 + i;
365
- c = s[i];
366
- }
367
- ep = i;
368
- final CodeNode new_num_node = new CodeNode(code.get(), sp, ep);
369
- if ( is_double ) {
370
- new_num_node.parsed_type = 2;
371
- new_num_node.value_type = 2;
372
- new_num_node.double_value = (Optional.of(Double.parseDouble((new String(s,sp, ep - sp )) ))).get();
373
- } else {
374
- new_num_node.parsed_type = 3;
375
- new_num_node.value_type = 3;
376
- new_num_node.int_value = (Optional.of(Integer.parseInt((new String(s,sp, ep - sp )) ))).get();
377
- }
378
- this.insert_node(new_num_node);
379
- continue;
380
- }
381
- if ( fc == 34 ) {
382
- sp = i + 1;
383
- ep = sp;
384
- c = s[i];
385
- boolean must_encode = false;
386
- while (i < __len) {
387
- i = 1 + i;
388
- c = s[i];
389
- if ( c == 34 ) {
390
- break;
391
- }
392
- if ( c == 92 ) {
393
- i = 1 + i;
394
- if ( i < __len ) {
395
- must_encode = true;
396
- c = s[i];
397
- } else {
398
- break;
399
- }
400
- }
401
- }
402
- ep = i;
403
- if ( i < __len ) {
404
- String encoded_str = "";
405
- if ( must_encode ) {
406
- final byte[] orig_str = (new String(s,sp, ep - sp )).getBytes();
407
- final int str_length = orig_str.length;
408
- int ii = 0;
409
- while (ii < str_length) {
410
- final byte cc = orig_str[ii];
411
- if ( cc == 92 ) {
412
- final byte next_ch = orig_str[(ii + 1)];
413
- switch (next_ch ) {
414
- case 34 :
415
- encoded_str = encoded_str + ((new String( Character.toChars(34))));
416
- break;
417
- case 92 :
418
- encoded_str = encoded_str + ((new String( Character.toChars(92))));
419
- break;
420
- case 47 :
421
- encoded_str = encoded_str + ((new String( Character.toChars(47))));
422
- break;
423
- case 98 :
424
- encoded_str = encoded_str + ((new String( Character.toChars(8))));
425
- break;
426
- case 102 :
427
- encoded_str = encoded_str + ((new String( Character.toChars(12))));
428
- break;
429
- case 110 :
430
- encoded_str = encoded_str + ((new String( Character.toChars(10))));
431
- break;
432
- case 114 :
433
- encoded_str = encoded_str + ((new String( Character.toChars(13))));
434
- break;
435
- case 116 :
436
- encoded_str = encoded_str + ((new String( Character.toChars(9))));
437
- break;
438
- case 117 :
439
- ii = ii + 4;
440
- break;
441
- default:
442
- break;
443
- }
444
- ii = ii + 2;
445
- } else {
446
- encoded_str = encoded_str + (new String(orig_str,ii, (1 + ii) - ii ));
447
- ii = ii + 1;
448
- }
449
- }
450
- }
451
- final CodeNode new_str_node = new CodeNode(code.get(), sp, ep);
452
- new_str_node.parsed_type = 4;
453
- new_str_node.value_type = 4;
454
- if ( must_encode ) {
455
- new_str_node.string_value = encoded_str;
456
- } else {
457
- new_str_node.string_value = new String(s,sp, ep - sp );
458
- }
459
- this.insert_node(new_str_node);
460
- i = 1 + i;
461
- continue;
462
- }
463
- }
464
- if ( (((fc == (116)) && ((s[(i + 1)]) == (114))) && ((s[(i + 2)]) == (117))) && ((s[(i + 3)]) == (101)) ) {
465
- final CodeNode new_true_node = new CodeNode(code.get(), sp, sp + 4);
466
- new_true_node.value_type = 5;
467
- new_true_node.parsed_type = 5;
468
- new_true_node.boolean_value = true;
469
- this.insert_node(new_true_node);
470
- i = i + 4;
471
- continue;
472
- }
473
- if ( ((((fc == (102)) && ((s[(i + 1)]) == (97))) && ((s[(i + 2)]) == (108))) && ((s[(i + 3)]) == (115))) && ((s[(i + 4)]) == (101)) ) {
474
- final CodeNode new_f_node = new CodeNode(code.get(), sp, sp + 5);
475
- new_f_node.value_type = 5;
476
- new_f_node.parsed_type = 5;
477
- new_f_node.boolean_value = false;
478
- this.insert_node(new_f_node);
479
- i = i + 5;
480
- continue;
481
- }
482
- if ( fc == (64) ) {
483
- i = i + 1;
484
- sp = i;
485
- ep = i;
486
- c = s[i];
487
- while (((((i < __len) && ((s[i]) > 32)) && (c != 40)) && (c != 41)) && (c != (125))) {
488
- i = 1 + i;
489
- c = s[i];
490
- }
491
- ep = i;
492
- if ( (i < __len) && (ep > sp) ) {
493
- final CodeNode a_node2 = new CodeNode(code.get(), sp, ep);
494
- final String a_name = new String(s,sp, ep - sp );
495
- a_node2.expression = true;
496
- curr_node = Optional.of(a_node2);
497
- parents.add(a_node2);
498
- i = i + 1;
499
- paren_cnt = paren_cnt + 1;
500
- this.parse();
501
- boolean use_first = false;
502
- if ( 1 == (a_node2.children.size()) ) {
503
- final CodeNode ch1 = a_node2.children.get(0);
504
- use_first = ch1.isPrimitive();
505
- }
506
- if ( use_first ) {
507
- final CodeNode theNode = a_node2.children.remove(0);
508
- curr_node.get().props.put(a_name, theNode);
509
- } else {
510
- curr_node.get().props.put(a_name, a_node2);
511
- }
512
- curr_node.get().prop_keys.add(a_name);
513
- continue;
514
- }
515
- }
516
- ArrayList<String> ns_list = new ArrayList<String>();
517
- int last_ns = i;
518
- int ns_cnt = 1;
519
- boolean vref_had_type_ann = false;
520
- Optional<CodeNode> vref_ann_node = Optional.empty();
521
- int vref_end = i;
522
- if ( (((((i < __len) && ((s[i]) > 32)) && (c != 58)) && (c != 40)) && (c != 41)) && (c != (125)) ) {
523
- if ( curr_node.get().is_block_node == true ) {
524
- final CodeNode new_expr_node = new CodeNode(code.get(), sp, ep);
525
- new_expr_node.parent = curr_node;
526
- new_expr_node.expression = true;
527
- curr_node.get().children.add(new_expr_node);
528
- curr_node = Optional.of(new_expr_node);
529
- parents.add(new_expr_node);
530
- paren_cnt = 1 + paren_cnt;
531
- this.parse();
532
- continue;
533
- }
534
- }
535
- int op_c = 0;
536
- op_c = this.getOperator();
537
- boolean last_was_newline = false;
538
- if ( op_c > 0 ) {
539
- } else {
540
- while ((((((i < __len) && ((s[i]) > 32)) && (c != 58)) && (c != 40)) && (c != 41)) && (c != (125))) {
541
- if ( i > sp ) {
542
- final int is_opchar = this.isOperator();
543
- if ( is_opchar > 0 ) {
544
- break;
545
- }
546
- }
547
- i = 1 + i;
548
- c = s[i];
549
- if ( (c == 10) || (c == 13) ) {
550
- last_was_newline = true;
551
- break;
552
- }
553
- if ( c == (46) ) {
554
- ns_list.add(new String(s,last_ns, i - last_ns ));
555
- last_ns = i + 1;
556
- ns_cnt = 1 + ns_cnt;
557
- }
558
- if ( (i > vref_end) && (c == (64)) ) {
559
- vref_had_type_ann = true;
560
- vref_end = i;
561
- vref_ann_node = Optional.of(this.parse_raw_annotation());
562
- c = s[i];
563
- break;
564
- }
565
- }
566
- }
567
- ep = i;
568
- if ( vref_had_type_ann ) {
569
- ep = vref_end;
570
- }
571
- ns_list.add(new String(s,last_ns, ep - last_ns ));
572
- c = s[i];
573
- while (((i < __len) && (c <= 32)) && (false == last_was_newline)) {
574
- i = 1 + i;
575
- c = s[i];
576
- if ( is_block_parent && ((c == 10) || (c == 13)) ) {
577
- i = i - 1;
578
- c = s[i];
579
- had_lf = true;
580
- break;
581
- }
582
- }
583
- if ( c == 58 ) {
584
- i = i + 1;
585
- while ((i < __len) && ((s[i]) <= 32)) {
586
- i = 1 + i;
587
- }
588
- int vt_sp = i;
589
- int vt_ep = i;
590
- c = s[i];
591
- if ( c == (40) ) {
592
- final CodeNode vann_arr2 = this.parse_raw_annotation();
593
- vann_arr2.expression = true;
594
- final CodeNode new_expr_node_1 = new CodeNode(code.get(), sp, vt_ep);
595
- new_expr_node_1.vref = new String(s,sp, ep - sp );
596
- new_expr_node_1.ns = ns_list;
597
- new_expr_node_1.expression_value = Optional.of(vann_arr2);
598
- new_expr_node_1.parsed_type = 15;
599
- new_expr_node_1.value_type = 15;
600
- if ( vref_had_type_ann ) {
601
- new_expr_node_1.vref_annotation = vref_ann_node;
602
- new_expr_node_1.has_vref_annotation = true;
603
- }
604
- curr_node.get().children.add(new_expr_node_1);
605
- continue;
606
- }
607
- if ( c == (91) ) {
608
- i = i + 1;
609
- vt_sp = i;
610
- int hash_sep = 0;
611
- boolean had_array_type_ann = false;
612
- c = s[i];
613
- while (((i < __len) && (c > 32)) && (c != 93)) {
614
- i = 1 + i;
615
- c = s[i];
616
- if ( c == (58) ) {
617
- hash_sep = i;
618
- }
619
- if ( c == (64) ) {
620
- had_array_type_ann = true;
621
- break;
622
- }
623
- }
624
- vt_ep = i;
625
- if ( hash_sep > 0 ) {
626
- vt_ep = i;
627
- final String type_name = new String(s,(1 + hash_sep), vt_ep - (1 + hash_sep) );
628
- final String key_type_name = new String(s,vt_sp, hash_sep - vt_sp );
629
- final CodeNode new_hash_node = new CodeNode(code.get(), sp, vt_ep);
630
- new_hash_node.vref = new String(s,sp, ep - sp );
631
- new_hash_node.ns = ns_list;
632
- new_hash_node.parsed_type = 7;
633
- new_hash_node.value_type = 7;
634
- new_hash_node.array_type = type_name;
635
- new_hash_node.key_type = key_type_name;
636
- if ( vref_had_type_ann ) {
637
- new_hash_node.vref_annotation = vref_ann_node;
638
- new_hash_node.has_vref_annotation = true;
639
- }
640
- if ( had_array_type_ann ) {
641
- final CodeNode vann_hash = this.parse_raw_annotation();
642
- new_hash_node.type_annotation = Optional.of(vann_hash);
643
- new_hash_node.has_type_annotation = true;
644
- System.out.println(String.valueOf( "--> parsed HASH TYPE annotation" ) );
645
- }
646
- new_hash_node.parent = curr_node;
647
- curr_node.get().children.add(new_hash_node);
648
- i = 1 + i;
649
- continue;
650
- } else {
651
- vt_ep = i;
652
- final String type_name_1 = new String(s,vt_sp, vt_ep - vt_sp );
653
- final CodeNode new_arr_node = new CodeNode(code.get(), sp, vt_ep);
654
- new_arr_node.vref = new String(s,sp, ep - sp );
655
- new_arr_node.ns = ns_list;
656
- new_arr_node.parsed_type = 6;
657
- new_arr_node.value_type = 6;
658
- new_arr_node.array_type = type_name_1;
659
- new_arr_node.parent = curr_node;
660
- curr_node.get().children.add(new_arr_node);
661
- if ( vref_had_type_ann ) {
662
- new_arr_node.vref_annotation = vref_ann_node;
663
- new_arr_node.has_vref_annotation = true;
664
- }
665
- if ( had_array_type_ann ) {
666
- final CodeNode vann_arr = this.parse_raw_annotation();
667
- new_arr_node.type_annotation = Optional.of(vann_arr);
668
- new_arr_node.has_type_annotation = true;
669
- System.out.println(String.valueOf( "--> parsed ARRAY TYPE annotation" ) );
670
- }
671
- i = 1 + i;
672
- continue;
673
- }
674
- }
675
- boolean had_type_ann = false;
676
- while (((((((i < __len) && ((s[i]) > 32)) && (c != 58)) && (c != 40)) && (c != 41)) && (c != (125))) && (c != (44))) {
677
- i = 1 + i;
678
- c = s[i];
679
- if ( c == (64) ) {
680
- had_type_ann = true;
681
- break;
682
- }
683
- }
684
- if ( i < __len ) {
685
- vt_ep = i;
686
- /** unused: final String type_name_2 = new String(s,vt_sp, vt_ep - vt_sp ) **/ ;
687
- final CodeNode new_ref_node = new CodeNode(code.get(), sp, ep);
688
- new_ref_node.vref = new String(s,sp, ep - sp );
689
- new_ref_node.ns = ns_list;
690
- new_ref_node.parsed_type = 9;
691
- new_ref_node.value_type = 9;
692
- new_ref_node.type_name = new String(s,vt_sp, vt_ep - vt_sp );
693
- new_ref_node.parent = curr_node;
694
- if ( vref_had_type_ann ) {
695
- new_ref_node.vref_annotation = vref_ann_node;
696
- new_ref_node.has_vref_annotation = true;
697
- }
698
- curr_node.get().children.add(new_ref_node);
699
- if ( had_type_ann ) {
700
- final CodeNode vann = this.parse_raw_annotation();
701
- new_ref_node.type_annotation = Optional.of(vann);
702
- new_ref_node.has_type_annotation = true;
703
- }
704
- continue;
705
- }
706
- } else {
707
- if ( (i < __len) && (ep > sp) ) {
708
- final CodeNode new_vref_node = new CodeNode(code.get(), sp, ep);
709
- new_vref_node.vref = new String(s,sp, ep - sp );
710
- new_vref_node.parsed_type = 9;
711
- new_vref_node.value_type = 9;
712
- new_vref_node.ns = ns_list;
713
- new_vref_node.parent = curr_node;
714
- final int op_pred = this.getOperatorPred(new_vref_node.vref);
715
- if ( new_vref_node.vref.equals(",") ) {
716
- curr_node.get().infix_operator = false;
717
- continue;
718
- }
719
- Optional<CodeNode> pTarget = curr_node;
720
- if ( curr_node.get().infix_operator ) {
721
- final Optional<CodeNode> iNode = curr_node.get().infix_node;
722
- if ( (op_pred > 0) || (iNode.get().to_the_right == false) ) {
723
- pTarget = iNode;
724
- } else {
725
- final Optional<CodeNode> rn = iNode.get().right_node;
726
- new_vref_node.parent = rn;
727
- pTarget = rn;
728
- }
729
- }
730
- pTarget.get().children.add(new_vref_node);
731
- if ( vref_had_type_ann ) {
732
- new_vref_node.vref_annotation = vref_ann_node;
733
- new_vref_node.has_vref_annotation = true;
734
- }
735
- if ( (i + 1) < __len ) {
736
- if ( ((s[(i + 1)]) == (40)) || ((s[(i + 0)]) == (40)) ) {
737
- if ( ((0 == op_pred) && curr_node.get().infix_operator) && (1 == (curr_node.get().children.size())) ) {
738
- }
739
- }
740
- }
741
- if ( ((op_pred > 0) && curr_node.get().infix_operator) || ((op_pred > 0) && ((curr_node.get().children.size()) >= 2)) ) {
742
- if ( (op_pred == 3) && (2 == (curr_node.get().children.size())) ) {
743
- final CodeNode n_ch = curr_node.get().children.remove(0);
744
- curr_node.get().children.add(n_ch);
745
- } else {
746
- if ( false == curr_node.get().infix_operator ) {
747
- final CodeNode if_node = new CodeNode(code.get(), sp, ep);
748
- curr_node.get().infix_node = Optional.of(if_node);
749
- curr_node.get().infix_operator = true;
750
- if_node.infix_subnode = true;
751
- curr_node.get().value_type = 0;
752
- curr_node.get().expression = true;
753
- if_node.expression = true;
754
- int ch_cnt = curr_node.get().children.size();
755
- int ii_1 = 0;
756
- final int start_from = ch_cnt - 2;
757
- final CodeNode keep_nodes = new CodeNode(code.get(), sp, ep);
758
- while (ch_cnt > 0) {
759
- final CodeNode n_ch_1 = curr_node.get().children.remove(0);
760
- CodeNode p_target = if_node;
761
- if ( (ii_1 < start_from) || n_ch_1.infix_subnode ) {
762
- p_target = keep_nodes;
763
- }
764
- p_target.children.add(n_ch_1);
765
- ch_cnt = ch_cnt - 1;
766
- ii_1 = 1 + ii_1;
767
- }
768
- for ( int i_1 = 0; i_1 < keep_nodes.children.size(); i_1++) {
769
- CodeNode keep = keep_nodes.children.get(i_1);
770
- curr_node.get().children.add(keep);
771
- }
772
- curr_node.get().children.add(if_node);
773
- }
774
- final Optional<CodeNode> ifNode = curr_node.get().infix_node;
775
- final CodeNode new_op_node = new CodeNode(code.get(), sp, ep);
776
- new_op_node.expression = true;
777
- new_op_node.parent = ifNode;
778
- int until_index = (ifNode.get().children.size()) - 1;
779
- boolean to_right = false;
780
- final boolean just_continue = false;
781
- if ( (ifNode.get().operator_pred > 0) && (ifNode.get().operator_pred < op_pred) ) {
782
- to_right = true;
783
- }
784
- if ( (ifNode.get().operator_pred > 0) && (ifNode.get().operator_pred > op_pred) ) {
785
- ifNode.get().to_the_right = false;
786
- }
787
- if ( (ifNode.get().operator_pred > 0) && (ifNode.get().operator_pred == op_pred) ) {
788
- to_right = ifNode.get().to_the_right;
789
- }
790
- /** unused: final Optional<CodeNode> opTarget = ifNode **/ ;
791
- if ( to_right ) {
792
- final CodeNode op_node = ifNode.get().children.remove(until_index);
793
- final CodeNode last_value = ifNode.get().children.remove((until_index - 1));
794
- new_op_node.children.add(op_node);
795
- new_op_node.children.add(last_value);
796
- } else {
797
- if ( false == just_continue ) {
798
- while (until_index > 0) {
799
- final CodeNode what_to_add = ifNode.get().children.remove(0);
800
- new_op_node.children.add(what_to_add);
801
- until_index = until_index - 1;
802
- }
803
- }
804
- }
805
- if ( to_right || (false == just_continue) ) {
806
- ifNode.get().children.add(new_op_node);
807
- }
808
- if ( to_right ) {
809
- ifNode.get().right_node = Optional.of(new_op_node);
810
- ifNode.get().to_the_right = true;
811
- }
812
- ifNode.get().operator_pred = op_pred;
813
- continue;
814
- }
815
- }
816
- continue;
817
- }
818
- }
819
- if ( (c == 41) || (c == (125)) ) {
820
- if ( ((c == (125)) && is_block_parent) && ((curr_node.get().children.size()) > 0) ) {
821
- this.end_expression();
822
- }
823
- i = 1 + i;
824
- paren_cnt = paren_cnt - 1;
825
- if ( paren_cnt < 0 ) {
826
- break;
827
- }
828
- parents.remove(parents.size() - 1);
829
- if ( curr_node.isPresent() ) {
830
- curr_node.get().ep = i;
831
- }
832
- if ( (parents.size()) > 0 ) {
833
- curr_node = Optional.of(parents.get(((parents.size()) - 1)));
834
- } else {
835
- curr_node = rootNode;
836
- }
837
- break;
838
- }
839
- if ( last_i == i ) {
840
- i = 1 + i;
841
- }
842
- }
843
- }
844
- }
845
- }