ranger-compiler 2.1.70 → 3.0.4
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.
- package/CHANGELOG.md +114 -0
- package/README.md +956 -133
- package/{compiler/Lang.clj → dist/Lang.rgr} +2345 -75
- package/dist/README.md +116 -0
- package/dist/{bin/api.d.ts → api.d.ts} +430 -154
- package/dist/api.js +34345 -0
- package/{lib/Ajax.clj → dist/lib/Ajax.rgr} +1 -1
- package/{lib/CmdParams.clj → dist/lib/CmdParams.rgr} +72 -72
- package/{lib/Crypto.clj → dist/lib/Crypto.rgr} +1 -1
- package/{lib/DOMLib.clj → dist/lib/DOMLib.rgr} +2 -2
- package/{lib/Engine3D.clj → dist/lib/Engine3D.rgr} +1 -1
- package/{lib/ImmutableVector.clj → dist/lib/ImmutableVector.rgr} +364 -364
- package/{lib/IndexedDB.clj → dist/lib/IndexedDB.rgr} +1 -1
- package/{lib/JSON.clj → dist/lib/JSON.rgr} +105 -2
- package/{lib/JinxProcess.clj → dist/lib/JinxProcess.rgr} +3 -3
- package/{lib/Storage.clj → dist/lib/Storage.rgr} +1 -1
- package/{lib/Timers.clj → dist/lib/Timers.rgr} +176 -170
- package/{lib/ViewLib.clj → dist/lib/ViewLib.rgr} +1 -1
- package/dist/lib/lib/ACEEditor.rgr +5 -0
- package/dist/lib/lib/Ajax.rgr +196 -0
- package/dist/lib/lib/CmdParams.rgr +72 -0
- package/dist/lib/lib/Crypto.rgr +90 -0
- package/dist/lib/lib/DOMLib.rgr +307 -0
- package/{examples/3D/Engine3D.clj → dist/lib/lib/Engine3D.rgr} +870 -857
- package/dist/lib/lib/ImmutableVector.rgr +364 -0
- package/dist/lib/lib/IndexedDB.rgr +32 -0
- package/{compiler/JSON.clj → dist/lib/lib/JSON.rgr} +106 -3
- package/dist/lib/lib/JinxProcess.rgr +838 -0
- package/dist/lib/lib/SQL.rgr +44 -0
- package/dist/lib/lib/ServiceLib.rgr +9 -0
- package/dist/lib/lib/Storage.rgr +89 -0
- package/dist/lib/lib/Time.rgr +75 -0
- package/dist/lib/lib/Timers.rgr +176 -0
- package/dist/lib/lib/TypedArrays.rgr +14 -0
- package/dist/lib/lib/ViewLib.rgr +851 -0
- package/dist/lib/lib/WebLib.rgr +47 -0
- package/dist/lib/lib/WebServerLib.rgr +137 -0
- package/{lib/ranger-dir.clj → dist/lib/lib/ranger-dir.rgr} +1 -1
- package/{compiler/stdlib.clj → dist/lib/lib/stdlib.rgr} +42 -19
- package/{lib/stdops.clj → dist/lib/lib/stdops.rgr} +1 -1
- package/dist/lib/ranger-dir.rgr +175 -0
- package/{lib/stdlib.clj → dist/lib/stdlib.rgr} +2 -2
- package/dist/lib/stdops.rgr +168 -0
- package/dist/package.json +47 -0
- package/{compiler/bin/output.js → dist/rgrc.js} +15377 -7936
- package/dist/stdops.rgr +168 -0
- package/package.json +196 -39
- package/adventofcode/day1/bin/LambdaSignature1.java +0 -3
- package/adventofcode/day1/bin/LambdaSignature2.java +0 -3
- package/adventofcode/day1/bin/LambdaSignature3.java +0 -3
- package/adventofcode/day1/bin/day1.cpp +0 -124
- package/adventofcode/day1/bin/day1.go +0 -75
- package/adventofcode/day1/bin/day1.js +0 -45
- package/adventofcode/day1/bin/day1.php +0 -46
- package/adventofcode/day1/bin/day1.scala +0 -48
- package/adventofcode/day1/bin/day1.swift +0 -48
- package/adventofcode/day1/bin/day1_part2.cpp +0 -180
- package/adventofcode/day1/bin/day1_part2.go +0 -123
- package/adventofcode/day1/bin/day1_part2.js +0 -76
- package/adventofcode/day1/bin/day1_part2.php +0 -88
- package/adventofcode/day1/bin/day1_part2.scala +0 -81
- package/adventofcode/day1/bin/day1_part2.swift +0 -91
- package/adventofcode/day1/bin/day_one.java +0 -38
- package/adventofcode/day1/bin/day_one_part_two.java +0 -57
- package/adventofcode/day1/bin/operatorsOf.java +0 -37
- package/adventofcode/day1/bin/operatorsOf_5.java +0 -10
- package/adventofcode/day1/bin/operatorsOfboolean_5.java +0 -10
- package/adventofcode/day1/bin/variant.hpp +0 -2416
- package/adventofcode/day1/compile.bat +0 -7
- package/adventofcode/day1/compile2.bat +0 -7
- package/adventofcode/day1/day1.clj +0 -19
- package/adventofcode/day1/day1_part2.clj +0 -43
- package/adventofcode/day1/input1.txt +0 -1
- package/adventofcode/day2/bin/LambdaSignature1.class +0 -0
- package/adventofcode/day2/bin/LambdaSignature1.java +0 -3
- package/adventofcode/day2/bin/LambdaSignature2.class +0 -0
- package/adventofcode/day2/bin/LambdaSignature2.java +0 -3
- package/adventofcode/day2/bin/day2.cpp +0 -133
- package/adventofcode/day2/bin/day2.go +0 -85
- package/adventofcode/day2/bin/day2.js +0 -45
- package/adventofcode/day2/bin/day2.php +0 -59
- package/adventofcode/day2/bin/day2.scala +0 -54
- package/adventofcode/day2/bin/day2.swift +0 -62
- package/adventofcode/day2/bin/day2_part2.cpp +0 -150
- package/adventofcode/day2/bin/day2_part2.go +0 -101
- package/adventofcode/day2/bin/day2_part2.js +0 -54
- package/adventofcode/day2/bin/day2_part2.php +0 -80
- package/adventofcode/day2/bin/day2_part2.scala +0 -68
- package/adventofcode/day2/bin/day2_part2.swift +0 -82
- package/adventofcode/day2/bin/day_two.java +0 -61
- package/adventofcode/day2/bin/day_two_part_two$1$1$1.class +0 -0
- package/adventofcode/day2/bin/day_two_part_two$1$1.class +0 -0
- package/adventofcode/day2/bin/day_two_part_two$1.class +0 -0
- package/adventofcode/day2/bin/day_two_part_two.class +0 -0
- package/adventofcode/day2/bin/day_two_part_two.java +0 -80
- package/adventofcode/day2/bin/operatorsOf.class +0 -0
- package/adventofcode/day2/bin/operatorsOf.java +0 -18
- package/adventofcode/day2/bin/variant.hpp +0 -2416
- package/adventofcode/day2/compile.bat +0 -7
- package/adventofcode/day2/compile2.bat +0 -7
- package/adventofcode/day2/day2.clj +0 -60
- package/adventofcode/day2/day2_part2.clj +0 -69
- package/adventofcode/day2/input1.txt +0 -1
- package/adventofcode/day3/bin/Grid.java +0 -92
- package/adventofcode/day3/bin/GridRow.java +0 -5
- package/adventofcode/day3/bin/LambdaSignature1.java +0 -3
- package/adventofcode/day3/bin/LambdaSignature2.java +0 -3
- package/adventofcode/day3/bin/LambdaSignature3.java +0 -3
- package/adventofcode/day3/bin/day3.cpp +0 -64
- package/adventofcode/day3/bin/day3.go +0 -55
- package/adventofcode/day3/bin/day3.js +0 -42
- package/adventofcode/day3/bin/day3.php +0 -41
- package/adventofcode/day3/bin/day3.scala +0 -52
- package/adventofcode/day3/bin/day3.swift +0 -43
- package/adventofcode/day3/bin/day3_part2.cpp +0 -216
- package/adventofcode/day3/bin/day3_part2.go +0 -188
- package/adventofcode/day3/bin/day3_part2.js +0 -123
- package/adventofcode/day3/bin/day3_part2.php +0 -135
- package/adventofcode/day3/bin/day3_part2.swift +0 -131
- package/adventofcode/day3/bin/day_three_part_two.java +0 -43
- package/adventofcode/day3/bin/day_two.java +0 -42
- package/adventofcode/day3/bin/operatorsOf.java +0 -14
- package/adventofcode/day3/bin/variant.hpp +0 -2416
- package/adventofcode/day3/compile.bat +0 -7
- package/adventofcode/day3/compile2.bat +0 -7
- package/adventofcode/day3/day3.clj +0 -42
- package/adventofcode/day3/day3_part2.clj +0 -112
- package/adventofcode/day4/bin/LambdaSignature1.java +0 -3
- package/adventofcode/day4/bin/day4.cpp +0 -118
- package/adventofcode/day4/bin/day4.go +0 -75
- package/adventofcode/day4/bin/day4.js +0 -40
- package/adventofcode/day4/bin/day4.php +0 -52
- package/adventofcode/day4/bin/day4.scala +0 -47
- package/adventofcode/day4/bin/day4.swift +0 -56
- package/adventofcode/day4/bin/day4_part2.go +0 -129
- package/adventofcode/day4/bin/day4_part2.js +0 -72
- package/adventofcode/day4/bin/day_four.java +0 -41
- package/adventofcode/day4/bin/inputData.java +0 -7
- package/adventofcode/day4/bin/operatorsOf.java +0 -11
- package/adventofcode/day4/bin/variant.hpp +0 -2416
- package/adventofcode/day4/compile.bat +0 -7
- package/adventofcode/day4/compile2.bat +0 -7
- package/adventofcode/day4/day4.clj +0 -32
- package/adventofcode/day4/day4_part2.clj +0 -44
- package/adventofcode/day4/input.clj +0 -519
- package/adventofcode/day4/input.txt +0 -512
- package/bin/api.ts +0 -24471
- package/bin/compiler.ts +0 -24482
- package/bin/output.js +0 -23819
- package/compiler/ColorConsole.clj +0 -22
- package/compiler/ContextOperators.clj +0 -75
- package/compiler/FlowEnterVarDef.clj +0 -223
- package/compiler/InputFileSystem.clj +0 -276
- package/compiler/RangerDocs.clj +0 -7
- package/compiler/TFactory.clj +0 -146
- package/compiler/TFiles.clj +0 -23
- package/compiler/TFlow.clj +0 -39
- package/compiler/TNodeFactory.clj +0 -84
- package/compiler/TTypes.clj +0 -188
- package/compiler/VirtualCompiler.clj +0 -807
- package/compiler/bin/ng_Compiler.js +0 -23779
- package/compiler/commonmark_plugin.clj +0 -359
- package/compiler/feat2.bat +0 -2
- package/compiler/feats.bat +0 -9
- package/compiler/feature_tests.clj +0 -192
- package/compiler/index.js +0 -2
- package/compiler/issue_57.clj +0 -25
- package/compiler/makefile_plugin.clj +0 -135
- package/compiler/markdown_plugin.clj +0 -386
- package/compiler/maven_plugin.clj +0 -162
- package/compiler/ng_AndroidPageWriter.clj +0 -299
- package/compiler/ng_CodeNode.clj +0 -756
- package/compiler/ng_CodeNodeCompilerExtensions.clj +0 -839
- package/compiler/ng_Compiler.clj +0 -49
- package/compiler/ng_CompilerGeneric.clj +0 -260
- package/compiler/ng_CompilerOrig.clj +0 -854
- package/compiler/ng_DictNode.clj +0 -346
- package/compiler/ng_DictNode2.clj +0 -316
- package/compiler/ng_Execute.clj +0 -138
- package/compiler/ng_Execute1.clj +0 -129
- package/compiler/ng_FlowWork.clj +0 -3951
- package/compiler/ng_LiveCompiler.clj +0 -1109
- package/compiler/ng_RagnerJavaScriptClassWriter.clj +0 -402
- package/compiler/ng_RangerActiveOperators.clj +0 -86
- package/compiler/ng_RangerAppClassDesc.clj +0 -400
- package/compiler/ng_RangerAppEnums.clj +0 -86
- package/compiler/ng_RangerAppFunctionDesc.clj +0 -127
- package/compiler/ng_RangerAppMessages.clj +0 -15
- package/compiler/ng_RangerAppOperatorDesc.clj +0 -20
- package/compiler/ng_RangerAppParamDesc.clj +0 -388
- package/compiler/ng_RangerAppWriterContext.clj +0 -1793
- package/compiler/ng_RangerArgMatch.clj +0 -638
- package/compiler/ng_RangerCSharpClassWriter.clj +0 -484
- package/compiler/ng_RangerCppClassWriter.clj +0 -1023
- package/compiler/ng_RangerDocGenerator.clj +0 -305
- package/compiler/ng_RangerFlowParser.clj +0 -4992
- package/compiler/ng_RangerFlowParserOrig.clj +0 -4002
- package/compiler/ng_RangerGenericClassWriter.clj +0 -573
- package/compiler/ng_RangerGolangClassWriter.clj +0 -1766
- package/compiler/ng_RangerImmutableExtension.clj +0 -77
- package/compiler/ng_RangerJava7ClassWriter.clj +0 -961
- package/compiler/ng_RangerJavaScriptClassWriter.clj +0 -1040
- package/compiler/ng_RangerKotlinClassWriter.clj +0 -372
- package/compiler/ng_RangerLanguageWriters.clj +0 -14
- package/compiler/ng_RangerLispParser.clj +0 -873
- package/compiler/ng_RangerPHPClassWriter.clj +0 -643
- package/compiler/ng_RangerPlugin.clj +0 -41
- package/compiler/ng_RangerRangerClassWriter.clj +0 -357
- package/compiler/ng_RangerRustClassWriter.clj +0 -420
- package/compiler/ng_RangerScalaClassWriter.clj +0 -818
- package/compiler/ng_RangerSerializeClass.clj +0 -502
- package/compiler/ng_RangerServiceBuilder.clj +0 -63
- package/compiler/ng_RangerSwift3ClassWriter.clj +0 -809
- package/compiler/ng_RangerSwiftClassWriter.clj +0 -0
- package/compiler/ng_RangerTypeClass.clj +0 -45
- package/compiler/ng_SourceParser.clj +0 -241
- package/compiler/ng_SourceParser2.clj +0 -214
- package/compiler/ng_WebPageWriter.clj +0 -39
- package/compiler/ng_jsonParser.clj +0 -340
- package/compiler/ng_p_test.clj +0 -1711
- package/compiler/ng_parser.clj +0 -911
- package/compiler/ng_parser2.clj +0 -735
- package/compiler/ng_parser2_backup.clj +0 -1679
- package/compiler/ng_parser_backup.clj +0 -886
- package/compiler/ng_parser_ok.clj +0 -1718
- package/compiler/ng_parser_ok2.clj +0 -1717
- package/compiler/ng_parser_std_match.clj +0 -687
- package/compiler/ng_parser_std_match2.clj +0 -1012
- package/compiler/ng_parser_v2.clj +0 -1251
- package/compiler/ng_ui.clj +0 -403
- package/compiler/ng_ui_test.clj +0 -18
- package/compiler/ng_writer.clj +0 -338
- package/compiler/ng_xmlParser.clj +0 -472
- package/compiler/ng_xmlParser2.clj +0 -317
- package/compiler/ng_xmlParser3.clj +0 -251
- package/compiler/opdoc.bat +0 -4
- package/compiler/operators.md +0 -290
- package/compiler/p.bat +0 -4
- package/compiler/package.json +0 -10
- package/compiler/pcmd.bat +0 -4
- package/compiler/pcmd2.bat +0 -3
- package/compiler/plaintext_plugin.clj +0 -69
- package/compiler/plugin.bat +0 -19
- package/compiler/plugin2.bat +0 -4
- package/compiler/plugin_app.bat +0 -3
- package/compiler/plugin_apps.clj +0 -27
- package/compiler/plugins.bat +0 -10
- package/compiler/reveal_plugin.clj +0 -409
- package/compiler/simplePlugin.clj +0 -780
- package/compiler/t.bat +0 -3
- package/compiler/test_any.clj +0 -43
- package/compiler/test_call.clj +0 -141
- package/compiler/test_chain.clj +0 -79
- package/compiler/test_json.clj +0 -10
- package/compiler/test_lambda.clj +0 -153
- package/compiler/test_pcmd.clj +0 -32
- package/compiler/test_pcmd2.clj +0 -29
- package/compiler/test_plugin.clj +0 -237
- package/compiler/test_readfile.clj +0 -13
- package/compiler/test_reveal.clj +0 -19
- package/compiler/test_slides.clj +0 -312
- package/compiler/test_types.clj +0 -143
- package/compiler/test_types2.clj +0 -49
- package/compiler/test_types3.clj +0 -53
- package/compiler/test_var.clj +0 -40
- package/compiler/tonpm.bat +0 -14
- package/compiler/tonpm2.bat +0 -12
- package/compiler/ui_plugin.clj +0 -507
- package/compiler/ui_plugin2.clj +0 -427
- package/compiler/update-git.bat +0 -3
- package/compiler/vcomp.bat +0 -4
- package/compiler/viewbuilder_Android.clj +0 -176
- package/compiler/viewbuilder_Web.clj +0 -105
- package/dist/bin/api.js +0 -32422
- package/dist/bin/compiler.d.ts +0 -1638
- package/dist/bin/compiler.js +0 -32444
- package/examples/3D/bin/test_3d.js +0 -329
- package/examples/3D/test_3d.clj +0 -385
- package/examples/EVGColor/EVGColor.clj +0 -310
- package/examples/EVGColor/EVGColorContext.clj +0 -176
- package/examples/EVGColor/bin/EVGColor.js +0 -286
- package/examples/EVGColor/bin/minimized.js +0 -286
- package/examples/SVGPath/SVGPath.clj +0 -625
- package/examples/SVGPath/Vec2.clj +0 -103
- package/examples/SVGPath/bin/SVGPath.cpp +0 -887
- package/examples/SVGPath/bin/SVGPath.js +0 -682
- package/examples/SVGPath/bin/SVGPath.ts +0 -711
- package/examples/SVGPath/bin/minimized.js +0 -578
- package/examples/SVGPath/bin/variant.hpp +0 -2416
- package/examples/minification/Vec2.clj +0 -103
- package/examples/minification/bin/minified.js +0 -44
- package/examples/minification/bin/test.js +0 -117
- package/examples/minification/test.clj +0 -13
- package/fiddle/VirtualCompiler.js +0 -23495
- package/fiddle/browser_editor.js +0 -13240
- package/fiddle/compileEnv.js +0 -1
- package/fiddle/compileEnv.json +0 -1
- package/fiddle/lang_data.js +0 -1
- package/index.html +0 -18
- package/native/httpd/HttpTester.clj +0 -33
- package/native/httpd/RangerWebService.clj +0 -81
- package/operators.md +0 -290
- package/tsconfig.json +0 -29
- package/versions/cpp/compiler.cpp +0 -15032
- package/versions/es6/compiler.js +0 -12860
- package/versions/go/compiler.go +0 -21338
- package/versions/java/AfterCodeNode.java +0 -4
- package/versions/java/ClassJoinPoint.java +0 -6
- package/versions/java/CodeFile.java +0 -42
- package/versions/java/CodeFileSystem.java +0 -72
- package/versions/java/CodeNode.java +0 -807
- package/versions/java/CodeSlice.java +0 -13
- package/versions/java/CodeWriter.java +0 -185
- package/versions/java/ColorConsole.java +0 -8
- package/versions/java/CompilerInterface.java +0 -213
- package/versions/java/DictNode.java +0 -353
- package/versions/java/LiveCompiler.java +0 -772
- package/versions/java/NodeEvalState.java +0 -24
- package/versions/java/OpFindResult.java +0 -6
- package/versions/java/RangerAppArrayValue.java +0 -7
- package/versions/java/RangerAppClassDesc.java +0 -217
- package/versions/java/RangerAppEnum.java +0 -14
- package/versions/java/RangerAppFunctionDesc.java +0 -20
- package/versions/java/RangerAppHashValue.java +0 -11
- package/versions/java/RangerAppInterfaceImpl.java +0 -6
- package/versions/java/RangerAppMethodVariants.java +0 -6
- package/versions/java/RangerAppParamDesc.java +0 -321
- package/versions/java/RangerAppTodo.java +0 -6
- package/versions/java/RangerAppValue.java +0 -10
- package/versions/java/RangerAppWriterContext.java +0 -800
- package/versions/java/RangerArgMatch.java +0 -317
- package/versions/java/RangerBackReference.java +0 -7
- package/versions/java/RangerCSharpClassWriter.java +0 -287
- package/versions/java/RangerCompilerMessage.java +0 -9
- package/versions/java/RangerCppClassWriter.java +0 -725
- package/versions/java/RangerFlowParser.java +0 -2142
- package/versions/java/RangerGenericClassWriter.java +0 -367
- package/versions/java/RangerGolangClassWriter.java +0 -1379
- package/versions/java/RangerJava7ClassWriter.java +0 -652
- package/versions/java/RangerJavaScriptClassWriter.java +0 -305
- package/versions/java/RangerKotlinClassWriter.java +0 -380
- package/versions/java/RangerLispParser.java +0 -845
- package/versions/java/RangerNodeValue.java +0 -9
- package/versions/java/RangerPHPClassWriter.java +0 -527
- package/versions/java/RangerParamEventHandler.java +0 -6
- package/versions/java/RangerParamEventList.java +0 -5
- package/versions/java/RangerParamEventMap.java +0 -27
- package/versions/java/RangerRangerClassWriter.java +0 -268
- package/versions/java/RangerRefForce.java +0 -7
- package/versions/java/RangerScalaClassWriter.java +0 -365
- package/versions/java/RangerSerializeClass.java +0 -148
- package/versions/java/RangerSwift3ClassWriter.java +0 -548
- package/versions/java/RangerTypeClass.java +0 -17
- package/versions/java/SourceCode.java +0 -65
- package/versions/php/compiler.php +0 -13830
- package/versions/swift3/compiler.swift +0 -12542
- /package/{lib/ACEEditor.clj → dist/lib/ACEEditor.rgr} +0 -0
- /package/{lib/SQL.clj → dist/lib/SQL.rgr} +0 -0
- /package/{lib/ServiceLib.clj → dist/lib/ServiceLib.rgr} +0 -0
- /package/{lib/Time.clj → dist/lib/Time.rgr} +0 -0
- /package/{lib/TypedArrays.clj → dist/lib/TypedArrays.rgr} +0 -0
- /package/{lib/WebLib.clj → dist/lib/WebLib.rgr} +0 -0
- /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
|
-
}
|