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,807 +0,0 @@
|
|
|
1
|
-
import java.util.Optional;
|
|
2
|
-
import java.util.*;
|
|
3
|
-
import java.io.*;
|
|
4
|
-
|
|
5
|
-
class CodeNode {
|
|
6
|
-
public Optional<SourceCode> code = Optional.empty();
|
|
7
|
-
public int sp = 0;
|
|
8
|
-
public int ep = 0;
|
|
9
|
-
public boolean has_operator = false;
|
|
10
|
-
public boolean disabled_node = false;
|
|
11
|
-
public int op_index = 0;
|
|
12
|
-
public boolean is_system_class = false;
|
|
13
|
-
public boolean mutable_def = false;
|
|
14
|
-
public boolean expression = false;
|
|
15
|
-
public String vref = "";
|
|
16
|
-
public boolean is_block_node = false;
|
|
17
|
-
public boolean infix_operator = false;
|
|
18
|
-
public Optional<CodeNode> infix_node = Optional.empty();
|
|
19
|
-
public boolean infix_subnode = false;
|
|
20
|
-
public boolean has_lambda = false;
|
|
21
|
-
public boolean has_lambda_call = false;
|
|
22
|
-
public int operator_pred = 0;
|
|
23
|
-
public boolean to_the_right = false;
|
|
24
|
-
public Optional<CodeNode> right_node = Optional.empty();
|
|
25
|
-
public String type_type = "";
|
|
26
|
-
public String type_name = "";
|
|
27
|
-
public String key_type = "";
|
|
28
|
-
public String array_type = "";
|
|
29
|
-
public ArrayList<String> ns = new ArrayList<String>();
|
|
30
|
-
public boolean has_vref_annotation = false;
|
|
31
|
-
public Optional<CodeNode> vref_annotation = Optional.empty();
|
|
32
|
-
public boolean has_type_annotation = false;
|
|
33
|
-
public Optional<CodeNode> type_annotation = Optional.empty();
|
|
34
|
-
public int parsed_type = 0;
|
|
35
|
-
public int value_type = 0;
|
|
36
|
-
public int ref_type = 0;
|
|
37
|
-
public int ref_need_assign = 0 /** note: unused */;
|
|
38
|
-
public double double_value = 0;
|
|
39
|
-
public String string_value = "";
|
|
40
|
-
public int int_value = 0;
|
|
41
|
-
public boolean boolean_value = false;
|
|
42
|
-
public Optional<CodeNode> expression_value = Optional.empty();
|
|
43
|
-
public HashMap<String,CodeNode> props = new HashMap<String,CodeNode>();
|
|
44
|
-
public ArrayList<String> prop_keys = new ArrayList<String>();
|
|
45
|
-
public ArrayList<CodeNode> comments = new ArrayList<CodeNode>();
|
|
46
|
-
public ArrayList<CodeNode> children = new ArrayList<CodeNode>();
|
|
47
|
-
public Optional<CodeNode> parent = Optional.empty();
|
|
48
|
-
public Optional<RangerTypeClass> typeClass = Optional.empty();
|
|
49
|
-
public Optional<RangerAppWriterContext> lambda_ctx = Optional.empty();
|
|
50
|
-
public ArrayList<RangerAppParamDesc> nsp = new ArrayList<RangerAppParamDesc>();
|
|
51
|
-
public int eval_type = 0;
|
|
52
|
-
public String eval_type_name = "";
|
|
53
|
-
public String eval_key_type = "";
|
|
54
|
-
public String eval_array_type = "";
|
|
55
|
-
public Optional<CodeNode> eval_function = Optional.empty();
|
|
56
|
-
public boolean flow_done = false;
|
|
57
|
-
public boolean ref_change_done = false;
|
|
58
|
-
public Optional<CodeNode> eval_type_node = Optional.empty() /** note: unused */;
|
|
59
|
-
public int didReturnAtIndex = -1;
|
|
60
|
-
public boolean hasVarDef = false;
|
|
61
|
-
public boolean hasClassDescription = false;
|
|
62
|
-
public boolean hasNewOper = false;
|
|
63
|
-
public Optional<RangerAppClassDesc> clDesc = Optional.empty();
|
|
64
|
-
public boolean hasFnCall = false;
|
|
65
|
-
public Optional<RangerAppFunctionDesc> fnDesc = Optional.empty();
|
|
66
|
-
public boolean hasParamDesc = false;
|
|
67
|
-
public Optional<RangerAppParamDesc> paramDesc = Optional.empty();
|
|
68
|
-
public Optional<RangerAppParamDesc> ownParamDesc = Optional.empty();
|
|
69
|
-
public Optional<RangerAppWriterContext> evalCtx = Optional.empty();
|
|
70
|
-
public Optional<NodeEvalState> evalState = Optional.empty() /** note: unused */;
|
|
71
|
-
|
|
72
|
-
CodeNode( SourceCode source , int start , int end ) {
|
|
73
|
-
sp = start;
|
|
74
|
-
ep = end;
|
|
75
|
-
code = Optional.of(source);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
public String getParsedString() {
|
|
79
|
-
return code.get().code.substring(sp, ep );
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
public String getFilename() {
|
|
83
|
-
return code.get().filename;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
public Optional<CodeNode> getFlag( String flagName ) {
|
|
87
|
-
Optional<CodeNode> res = Optional.empty();
|
|
88
|
-
if ( false == has_vref_annotation ) {
|
|
89
|
-
return Optional.ofNullable((res.isPresent() ? (CodeNode)res.get() : null ) );
|
|
90
|
-
}
|
|
91
|
-
for ( int i = 0; i < vref_annotation.get().children.size(); i++) {
|
|
92
|
-
CodeNode ch = vref_annotation.get().children.get(i);
|
|
93
|
-
if ( ch.vref.equals(flagName) ) {
|
|
94
|
-
res = Optional.of(ch);
|
|
95
|
-
return Optional.ofNullable((res.isPresent() ? (CodeNode)res.get() : null ) );
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
return Optional.ofNullable((res.isPresent() ? (CodeNode)res.get() : null ) );
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
public boolean hasFlag( String flagName ) {
|
|
102
|
-
if ( false == has_vref_annotation ) {
|
|
103
|
-
return false;
|
|
104
|
-
}
|
|
105
|
-
for ( int i = 0; i < vref_annotation.get().children.size(); i++) {
|
|
106
|
-
CodeNode ch = vref_annotation.get().children.get(i);
|
|
107
|
-
if ( ch.vref.equals(flagName) ) {
|
|
108
|
-
return true;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
return false;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
public void setFlag( String flagName ) {
|
|
115
|
-
if ( false == has_vref_annotation ) {
|
|
116
|
-
vref_annotation = Optional.of(new CodeNode(code.get(), sp, ep));
|
|
117
|
-
}
|
|
118
|
-
if ( this.hasFlag(flagName) ) {
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
final CodeNode flag = new CodeNode(code.get(), sp, ep);
|
|
122
|
-
flag.vref = flagName;
|
|
123
|
-
flag.value_type = 9;
|
|
124
|
-
vref_annotation.get().children.add(flag);
|
|
125
|
-
has_vref_annotation = true;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
public String getTypeInformationString() {
|
|
129
|
-
String s = "";
|
|
130
|
-
if ( (vref.length()) > 0 ) {
|
|
131
|
-
s = ((s + "<vref:") + vref) + ">";
|
|
132
|
-
} else {
|
|
133
|
-
s = s + "<no.vref>";
|
|
134
|
-
}
|
|
135
|
-
if ( (type_name.length()) > 0 ) {
|
|
136
|
-
s = ((s + "<type_name:") + type_name) + ">";
|
|
137
|
-
} else {
|
|
138
|
-
s = s + "<no.type_name>";
|
|
139
|
-
}
|
|
140
|
-
if ( (array_type.length()) > 0 ) {
|
|
141
|
-
s = ((s + "<array_type:") + array_type) + ">";
|
|
142
|
-
} else {
|
|
143
|
-
s = s + "<no.array_type>";
|
|
144
|
-
}
|
|
145
|
-
if ( (key_type.length()) > 0 ) {
|
|
146
|
-
s = ((s + "<key_type:") + key_type) + ">";
|
|
147
|
-
} else {
|
|
148
|
-
s = s + "<no.key_type>";
|
|
149
|
-
}
|
|
150
|
-
switch (value_type ) {
|
|
151
|
-
case 5 :
|
|
152
|
-
s = s + "<value_type=Boolean>";
|
|
153
|
-
break;
|
|
154
|
-
case 4 :
|
|
155
|
-
s = s + "<value_type=String>";
|
|
156
|
-
break;
|
|
157
|
-
}
|
|
158
|
-
return s;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
public int getLine() {
|
|
162
|
-
return code.get().getLine(sp);
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
public String getLineString( int line_index ) {
|
|
166
|
-
return code.get().getLineString(line_index);
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
public String getColStartString() {
|
|
170
|
-
return code.get().getColumnStr(sp);
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
public String getLineAsString() {
|
|
174
|
-
final int idx = this.getLine();
|
|
175
|
-
final int line_name_idx = idx + 1;
|
|
176
|
-
return (((this.getFilename() + ", line ") + line_name_idx) + " : ") + code.get().getLineString(idx);
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
public String getPositionalString() {
|
|
180
|
-
if ( (ep > sp) && ((ep - sp) < 50) ) {
|
|
181
|
-
int start = sp;
|
|
182
|
-
int end = ep;
|
|
183
|
-
start = start - 100;
|
|
184
|
-
end = end + 50;
|
|
185
|
-
if ( start < 0 ) {
|
|
186
|
-
start = 0;
|
|
187
|
-
}
|
|
188
|
-
if ( end >= (code.get().code.length()) ) {
|
|
189
|
-
end = (code.get().code.length()) - 1;
|
|
190
|
-
}
|
|
191
|
-
return code.get().code.substring(start, end );
|
|
192
|
-
}
|
|
193
|
-
return "";
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
public boolean isParsedAsPrimitive() {
|
|
197
|
-
if ( (((((parsed_type == 2) || (parsed_type == 4)) || (parsed_type == 3)) || (parsed_type == 12)) || (parsed_type == 13)) || (parsed_type == 5) ) {
|
|
198
|
-
return true;
|
|
199
|
-
}
|
|
200
|
-
return false;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
public boolean isPrimitive() {
|
|
204
|
-
if ( (((((value_type == 2) || (value_type == 4)) || (value_type == 3)) || (value_type == 12)) || (value_type == 13)) || (value_type == 5) ) {
|
|
205
|
-
return true;
|
|
206
|
-
}
|
|
207
|
-
return false;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
public boolean isPrimitiveType() {
|
|
211
|
-
final String tn = type_name;
|
|
212
|
-
if ( (((((tn.equals("double")) || (tn.equals("string"))) || (tn.equals("int"))) || (tn.equals("char"))) || (tn.equals("charbuffer"))) || (tn.equals("boolean")) ) {
|
|
213
|
-
return true;
|
|
214
|
-
}
|
|
215
|
-
return false;
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
public boolean isAPrimitiveType() {
|
|
219
|
-
String tn = type_name;
|
|
220
|
-
if ( (value_type == 6) || (value_type == 7) ) {
|
|
221
|
-
tn = array_type;
|
|
222
|
-
}
|
|
223
|
-
if ( (((((tn.equals("double")) || (tn.equals("string"))) || (tn.equals("int"))) || (tn.equals("char"))) || (tn.equals("charbuffer"))) || (tn.equals("boolean")) ) {
|
|
224
|
-
return true;
|
|
225
|
-
}
|
|
226
|
-
return false;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
public CodeNode getFirst() {
|
|
230
|
-
return children.get(0);
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
public CodeNode getSecond() {
|
|
234
|
-
return children.get(1);
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
public CodeNode getThird() {
|
|
238
|
-
return children.get(2);
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
public boolean isSecondExpr() {
|
|
242
|
-
if ( (children.size()) > 1 ) {
|
|
243
|
-
final CodeNode second = children.get(1);
|
|
244
|
-
if ( second.expression ) {
|
|
245
|
-
return true;
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
return false;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
public String getOperator() {
|
|
252
|
-
final String s = "";
|
|
253
|
-
if ( (children.size()) > 0 ) {
|
|
254
|
-
final CodeNode fc = children.get(0);
|
|
255
|
-
if ( fc.value_type == 9 ) {
|
|
256
|
-
return fc.vref;
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
return s;
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
public String getVRefAt( int idx ) {
|
|
263
|
-
final String s = "";
|
|
264
|
-
if ( (children.size()) > idx ) {
|
|
265
|
-
final CodeNode fc = children.get(idx);
|
|
266
|
-
return fc.vref;
|
|
267
|
-
}
|
|
268
|
-
return s;
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
public String getStringAt( int idx ) {
|
|
272
|
-
final String s = "";
|
|
273
|
-
if ( (children.size()) > idx ) {
|
|
274
|
-
final CodeNode fc = children.get(idx);
|
|
275
|
-
if ( fc.value_type == 4 ) {
|
|
276
|
-
return fc.string_value;
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
return s;
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
public boolean hasExpressionProperty( String name ) {
|
|
283
|
-
final Optional<CodeNode> ann = Optional.ofNullable(props.get(name));
|
|
284
|
-
if ( ann.isPresent() ) {
|
|
285
|
-
return ann.get().expression;
|
|
286
|
-
}
|
|
287
|
-
return false;
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
public Optional<CodeNode> getExpressionProperty( String name ) {
|
|
291
|
-
final Optional<CodeNode> ann = Optional.ofNullable(props.get(name));
|
|
292
|
-
if ( ann.isPresent() ) {
|
|
293
|
-
return Optional.ofNullable((ann.isPresent() ? (CodeNode)ann.get() : null ) );
|
|
294
|
-
}
|
|
295
|
-
return Optional.ofNullable((ann.isPresent() ? (CodeNode)ann.get() : null ) );
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
public boolean hasIntProperty( String name ) {
|
|
299
|
-
final Optional<CodeNode> ann = Optional.ofNullable(props.get(name));
|
|
300
|
-
if ( ann.isPresent() ) {
|
|
301
|
-
final CodeNode fc = ann.get().children.get(0);
|
|
302
|
-
if ( fc.value_type == 3 ) {
|
|
303
|
-
return true;
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
return false;
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
public int getIntProperty( String name ) {
|
|
310
|
-
final Optional<CodeNode> ann = Optional.ofNullable(props.get(name));
|
|
311
|
-
if ( ann.isPresent() ) {
|
|
312
|
-
final CodeNode fc = ann.get().children.get(0);
|
|
313
|
-
if ( fc.value_type == 3 ) {
|
|
314
|
-
return fc.int_value;
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
return 0;
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
public boolean hasDoubleProperty( String name ) {
|
|
321
|
-
final Optional<CodeNode> ann = Optional.ofNullable(props.get(name));
|
|
322
|
-
if ( ann.isPresent() ) {
|
|
323
|
-
if ( ann.get().value_type == 2 ) {
|
|
324
|
-
return true;
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
return false;
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
public double getDoubleProperty( String name ) {
|
|
331
|
-
final Optional<CodeNode> ann = Optional.ofNullable(props.get(name));
|
|
332
|
-
if ( ann.isPresent() ) {
|
|
333
|
-
if ( ann.get().value_type == 2 ) {
|
|
334
|
-
return ann.get().double_value;
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
return 0;
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
public boolean hasStringProperty( String name ) {
|
|
341
|
-
if ( false == (props.containsKey(name)) ) {
|
|
342
|
-
return false;
|
|
343
|
-
}
|
|
344
|
-
final Optional<CodeNode> ann = Optional.ofNullable(props.get(name));
|
|
345
|
-
if ( ann.isPresent() ) {
|
|
346
|
-
if ( ann.get().value_type == 4 ) {
|
|
347
|
-
return true;
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
return false;
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
public String getStringProperty( String name ) {
|
|
354
|
-
final Optional<CodeNode> ann = Optional.ofNullable(props.get(name));
|
|
355
|
-
if ( ann.isPresent() ) {
|
|
356
|
-
if ( ann.get().value_type == 4 ) {
|
|
357
|
-
return ann.get().string_value;
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
return "";
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
public boolean hasBooleanProperty( String name ) {
|
|
364
|
-
final Optional<CodeNode> ann = Optional.ofNullable(props.get(name));
|
|
365
|
-
if ( ann.isPresent() ) {
|
|
366
|
-
if ( ann.get().value_type == 5 ) {
|
|
367
|
-
return true;
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
return false;
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
public boolean getBooleanProperty( String name ) {
|
|
374
|
-
final Optional<CodeNode> ann = Optional.ofNullable(props.get(name));
|
|
375
|
-
if ( ann.isPresent() ) {
|
|
376
|
-
if ( ann.get().value_type == 5 ) {
|
|
377
|
-
return ann.get().boolean_value;
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
return false;
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
public boolean isFirstTypeVref( String vrefName ) {
|
|
384
|
-
if ( (children.size()) > 0 ) {
|
|
385
|
-
final CodeNode fc = children.get(0);
|
|
386
|
-
if ( fc.value_type == 9 ) {
|
|
387
|
-
return true;
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
return false;
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
public boolean isFirstVref( String vrefName ) {
|
|
394
|
-
if ( (children.size()) > 0 ) {
|
|
395
|
-
final CodeNode fc = children.get(0);
|
|
396
|
-
if ( fc.vref.equals(vrefName) ) {
|
|
397
|
-
return true;
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
return false;
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
public String getString() {
|
|
404
|
-
return code.get().code.substring(sp, ep );
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
public void walk() {
|
|
408
|
-
switch (value_type ) {
|
|
409
|
-
case 2 :
|
|
410
|
-
System.out.println(String.valueOf( "Double : " + double_value ) );
|
|
411
|
-
break;
|
|
412
|
-
case 4 :
|
|
413
|
-
System.out.println(String.valueOf( "String : " + string_value ) );
|
|
414
|
-
break;
|
|
415
|
-
}
|
|
416
|
-
if ( expression ) {
|
|
417
|
-
System.out.println(String.valueOf( "(" ) );
|
|
418
|
-
} else {
|
|
419
|
-
System.out.println(String.valueOf( code.get().code.substring(sp, ep ) ) );
|
|
420
|
-
}
|
|
421
|
-
for ( int i = 0; i < children.size(); i++) {
|
|
422
|
-
CodeNode item = children.get(i);
|
|
423
|
-
item.walk();
|
|
424
|
-
}
|
|
425
|
-
if ( expression ) {
|
|
426
|
-
System.out.println(String.valueOf( ")" ) );
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
public void writeCode( CodeWriter wr ) {
|
|
431
|
-
switch (value_type ) {
|
|
432
|
-
case 2 :
|
|
433
|
-
wr.out(String.valueOf(double_value ), false);
|
|
434
|
-
break;
|
|
435
|
-
case 4 :
|
|
436
|
-
wr.out((((new String( Character.toChars(34)))) + string_value) + ((new String( Character.toChars(34)))), false);
|
|
437
|
-
break;
|
|
438
|
-
case 3 :
|
|
439
|
-
wr.out("" + int_value, false);
|
|
440
|
-
break;
|
|
441
|
-
case 5 :
|
|
442
|
-
if ( boolean_value ) {
|
|
443
|
-
wr.out("true", false);
|
|
444
|
-
} else {
|
|
445
|
-
wr.out("false", false);
|
|
446
|
-
}
|
|
447
|
-
break;
|
|
448
|
-
case 9 :
|
|
449
|
-
wr.out(vref, false);
|
|
450
|
-
break;
|
|
451
|
-
case 7 :
|
|
452
|
-
wr.out(vref, false);
|
|
453
|
-
wr.out((((":[" + key_type) + ":") + array_type) + "]", false);
|
|
454
|
-
break;
|
|
455
|
-
case 6 :
|
|
456
|
-
wr.out(vref, false);
|
|
457
|
-
wr.out((":[" + array_type) + "]", false);
|
|
458
|
-
break;
|
|
459
|
-
}
|
|
460
|
-
if ( expression ) {
|
|
461
|
-
wr.out("(", false);
|
|
462
|
-
for ( int i = 0; i < children.size(); i++) {
|
|
463
|
-
CodeNode ch = children.get(i);
|
|
464
|
-
ch.writeCode(wr);
|
|
465
|
-
}
|
|
466
|
-
wr.out(")", false);
|
|
467
|
-
}
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
public String getCode() {
|
|
471
|
-
final CodeWriter wr = new CodeWriter();
|
|
472
|
-
this.writeCode(wr);
|
|
473
|
-
return wr.getCode();
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
public CodeNode rebuildWithType( RangerArgMatch match , boolean changeVref ) {
|
|
477
|
-
final CodeNode newNode = new CodeNode(code.get(), sp, ep);
|
|
478
|
-
newNode.has_operator = has_operator;
|
|
479
|
-
newNode.op_index = op_index;
|
|
480
|
-
newNode.mutable_def = mutable_def;
|
|
481
|
-
newNode.expression = expression;
|
|
482
|
-
if ( changeVref ) {
|
|
483
|
-
newNode.vref = match.getTypeName(vref);
|
|
484
|
-
} else {
|
|
485
|
-
newNode.vref = vref;
|
|
486
|
-
}
|
|
487
|
-
newNode.is_block_node = is_block_node;
|
|
488
|
-
newNode.type_type = match.getTypeName(type_type);
|
|
489
|
-
newNode.type_name = match.getTypeName(type_name);
|
|
490
|
-
newNode.key_type = match.getTypeName(key_type);
|
|
491
|
-
newNode.array_type = match.getTypeName(array_type);
|
|
492
|
-
newNode.value_type = value_type;
|
|
493
|
-
if ( has_vref_annotation ) {
|
|
494
|
-
newNode.has_vref_annotation = true;
|
|
495
|
-
final Optional<CodeNode> ann = vref_annotation;
|
|
496
|
-
newNode.vref_annotation = Optional.of(ann.get().rebuildWithType(match, true));
|
|
497
|
-
}
|
|
498
|
-
if ( has_type_annotation ) {
|
|
499
|
-
newNode.has_type_annotation = true;
|
|
500
|
-
final Optional<CodeNode> t_ann = type_annotation;
|
|
501
|
-
newNode.type_annotation = Optional.of(t_ann.get().rebuildWithType(match, true));
|
|
502
|
-
}
|
|
503
|
-
for ( int i = 0; i < ns.size(); i++) {
|
|
504
|
-
String n = ns.get(i);
|
|
505
|
-
if ( changeVref ) {
|
|
506
|
-
final String new_ns = match.getTypeName(n);
|
|
507
|
-
newNode.ns.add(new_ns);
|
|
508
|
-
} else {
|
|
509
|
-
newNode.vref = vref;
|
|
510
|
-
newNode.ns.add(n);
|
|
511
|
-
}
|
|
512
|
-
}
|
|
513
|
-
switch (value_type ) {
|
|
514
|
-
case 2 :
|
|
515
|
-
newNode.double_value = double_value;
|
|
516
|
-
break;
|
|
517
|
-
case 4 :
|
|
518
|
-
newNode.string_value = string_value;
|
|
519
|
-
break;
|
|
520
|
-
case 3 :
|
|
521
|
-
newNode.int_value = int_value;
|
|
522
|
-
break;
|
|
523
|
-
case 5 :
|
|
524
|
-
newNode.boolean_value = boolean_value;
|
|
525
|
-
break;
|
|
526
|
-
case 15 :
|
|
527
|
-
if ( expression_value.isPresent() ) {
|
|
528
|
-
newNode.expression_value = Optional.of(expression_value.get().rebuildWithType(match, changeVref));
|
|
529
|
-
}
|
|
530
|
-
break;
|
|
531
|
-
}
|
|
532
|
-
for ( int i_1 = 0; i_1 < prop_keys.size(); i_1++) {
|
|
533
|
-
String key = prop_keys.get(i_1);
|
|
534
|
-
newNode.prop_keys.add(key);
|
|
535
|
-
final Optional<CodeNode> oldp = Optional.ofNullable(props.get(key));
|
|
536
|
-
final CodeNode np = oldp.get().rebuildWithType(match, changeVref);
|
|
537
|
-
newNode.props.put(key, np);
|
|
538
|
-
}
|
|
539
|
-
for ( int i_2 = 0; i_2 < children.size(); i_2++) {
|
|
540
|
-
CodeNode ch = children.get(i_2);
|
|
541
|
-
final CodeNode newCh = ch.rebuildWithType(match, changeVref);
|
|
542
|
-
newCh.parent = Optional.of(newNode);
|
|
543
|
-
newNode.children.add(newCh);
|
|
544
|
-
}
|
|
545
|
-
return newNode;
|
|
546
|
-
}
|
|
547
|
-
|
|
548
|
-
public String buildTypeSignatureUsingMatch( RangerArgMatch match ) {
|
|
549
|
-
final String tName = match.getTypeName(type_name);
|
|
550
|
-
switch (tName ) {
|
|
551
|
-
case "double" :
|
|
552
|
-
return "double";
|
|
553
|
-
case "string" :
|
|
554
|
-
return "string";
|
|
555
|
-
case "integer" :
|
|
556
|
-
return "int";
|
|
557
|
-
case "boolean" :
|
|
558
|
-
return "boolean";
|
|
559
|
-
}
|
|
560
|
-
String s = "";
|
|
561
|
-
if ( value_type == 6 ) {
|
|
562
|
-
s = s + "[";
|
|
563
|
-
s = s + match.getTypeName(array_type);
|
|
564
|
-
s = s + this.getTypeSignatureWithMatch(match);
|
|
565
|
-
s = s + "]";
|
|
566
|
-
return s;
|
|
567
|
-
}
|
|
568
|
-
if ( value_type == 7 ) {
|
|
569
|
-
s = s + "[";
|
|
570
|
-
s = s + match.getTypeName(key_type);
|
|
571
|
-
s = s + ":";
|
|
572
|
-
s = s + match.getTypeName(array_type);
|
|
573
|
-
s = s + this.getTypeSignatureWithMatch(match);
|
|
574
|
-
s = s + "]";
|
|
575
|
-
return s;
|
|
576
|
-
}
|
|
577
|
-
s = match.getTypeName(type_name);
|
|
578
|
-
s = s + this.getVRefSignatureWithMatch(match);
|
|
579
|
-
return s;
|
|
580
|
-
}
|
|
581
|
-
|
|
582
|
-
public String buildTypeSignature() {
|
|
583
|
-
switch (value_type ) {
|
|
584
|
-
case 2 :
|
|
585
|
-
return "double";
|
|
586
|
-
case 4 :
|
|
587
|
-
return "string";
|
|
588
|
-
case 3 :
|
|
589
|
-
return "int";
|
|
590
|
-
case 5 :
|
|
591
|
-
return "boolean";
|
|
592
|
-
case 12 :
|
|
593
|
-
return "char";
|
|
594
|
-
case 13 :
|
|
595
|
-
return "charbuffer";
|
|
596
|
-
}
|
|
597
|
-
String s = "";
|
|
598
|
-
if ( value_type == 6 ) {
|
|
599
|
-
s = s + "[";
|
|
600
|
-
s = s + array_type;
|
|
601
|
-
s = s + this.getTypeSignature();
|
|
602
|
-
s = s + "]";
|
|
603
|
-
return s;
|
|
604
|
-
}
|
|
605
|
-
if ( value_type == 7 ) {
|
|
606
|
-
s = s + "[";
|
|
607
|
-
s = s + key_type;
|
|
608
|
-
s = s + ":";
|
|
609
|
-
s = s + array_type;
|
|
610
|
-
s = s + this.getTypeSignature();
|
|
611
|
-
s = s + "]";
|
|
612
|
-
return s;
|
|
613
|
-
}
|
|
614
|
-
s = type_name;
|
|
615
|
-
return s;
|
|
616
|
-
}
|
|
617
|
-
|
|
618
|
-
public String getVRefSignatureWithMatch( RangerArgMatch match ) {
|
|
619
|
-
if ( has_vref_annotation ) {
|
|
620
|
-
final CodeNode nn = vref_annotation.get().rebuildWithType(match, true);
|
|
621
|
-
return "@" + nn.getCode();
|
|
622
|
-
}
|
|
623
|
-
return "";
|
|
624
|
-
}
|
|
625
|
-
|
|
626
|
-
public String getVRefSignature() {
|
|
627
|
-
if ( has_vref_annotation ) {
|
|
628
|
-
return "@" + vref_annotation.get().getCode();
|
|
629
|
-
}
|
|
630
|
-
return "";
|
|
631
|
-
}
|
|
632
|
-
|
|
633
|
-
public String getTypeSignatureWithMatch( RangerArgMatch match ) {
|
|
634
|
-
if ( has_type_annotation ) {
|
|
635
|
-
final CodeNode nn = type_annotation.get().rebuildWithType(match, true);
|
|
636
|
-
return "@" + nn.getCode();
|
|
637
|
-
}
|
|
638
|
-
return "";
|
|
639
|
-
}
|
|
640
|
-
|
|
641
|
-
public String getTypeSignature() {
|
|
642
|
-
if ( has_type_annotation ) {
|
|
643
|
-
return "@" + type_annotation.get().getCode();
|
|
644
|
-
}
|
|
645
|
-
return "";
|
|
646
|
-
}
|
|
647
|
-
|
|
648
|
-
public int typeNameAsType( RangerAppWriterContext ctx ) {
|
|
649
|
-
switch (type_name ) {
|
|
650
|
-
case "double" :
|
|
651
|
-
return 2;
|
|
652
|
-
case "int" :
|
|
653
|
-
return 3;
|
|
654
|
-
case "string" :
|
|
655
|
-
return 4;
|
|
656
|
-
case "boolean" :
|
|
657
|
-
return 5;
|
|
658
|
-
case "char" :
|
|
659
|
-
return 12;
|
|
660
|
-
case "charbuffer" :
|
|
661
|
-
return 13;
|
|
662
|
-
default:
|
|
663
|
-
if ( true == expression ) {
|
|
664
|
-
return 15;
|
|
665
|
-
}
|
|
666
|
-
if ( value_type == 9 ) {
|
|
667
|
-
if ( ctx.isEnumDefined(type_name) ) {
|
|
668
|
-
return 11;
|
|
669
|
-
}
|
|
670
|
-
if ( ctx.isDefinedClass(type_name) ) {
|
|
671
|
-
return 8;
|
|
672
|
-
}
|
|
673
|
-
}
|
|
674
|
-
break;
|
|
675
|
-
}
|
|
676
|
-
return value_type;
|
|
677
|
-
}
|
|
678
|
-
|
|
679
|
-
public void copyEvalResFrom( CodeNode node ) {
|
|
680
|
-
if ( node.hasParamDesc ) {
|
|
681
|
-
hasParamDesc = node.hasParamDesc;
|
|
682
|
-
paramDesc = node.paramDesc;
|
|
683
|
-
}
|
|
684
|
-
if ( node.typeClass.isPresent() ) {
|
|
685
|
-
typeClass = node.typeClass;
|
|
686
|
-
}
|
|
687
|
-
eval_type = node.eval_type;
|
|
688
|
-
eval_type_name = node.eval_type_name;
|
|
689
|
-
if ( node.hasFlag("optional") ) {
|
|
690
|
-
this.setFlag("optional");
|
|
691
|
-
}
|
|
692
|
-
if ( node.value_type == 7 ) {
|
|
693
|
-
eval_key_type = node.eval_key_type;
|
|
694
|
-
eval_array_type = node.eval_array_type;
|
|
695
|
-
eval_type = 7;
|
|
696
|
-
}
|
|
697
|
-
if ( node.value_type == 6 ) {
|
|
698
|
-
eval_key_type = node.eval_key_type;
|
|
699
|
-
eval_array_type = node.eval_array_type;
|
|
700
|
-
eval_type = 6;
|
|
701
|
-
}
|
|
702
|
-
if ( node.value_type == 15 ) {
|
|
703
|
-
eval_type = 15;
|
|
704
|
-
eval_function = node.eval_function;
|
|
705
|
-
}
|
|
706
|
-
}
|
|
707
|
-
|
|
708
|
-
public void defineNodeTypeTo( CodeNode node , RangerAppWriterContext ctx ) {
|
|
709
|
-
switch (type_name ) {
|
|
710
|
-
case "double" :
|
|
711
|
-
node.value_type = 2;
|
|
712
|
-
node.eval_type = 2;
|
|
713
|
-
node.eval_type_name = "double";
|
|
714
|
-
break;
|
|
715
|
-
case "int" :
|
|
716
|
-
node.value_type = 3;
|
|
717
|
-
node.eval_type = 3;
|
|
718
|
-
node.eval_type_name = "int";
|
|
719
|
-
break;
|
|
720
|
-
case "char" :
|
|
721
|
-
node.value_type = 12;
|
|
722
|
-
node.eval_type = 12;
|
|
723
|
-
node.eval_type_name = "char";
|
|
724
|
-
break;
|
|
725
|
-
case "charbuffer" :
|
|
726
|
-
node.value_type = 13;
|
|
727
|
-
node.eval_type = 13;
|
|
728
|
-
node.eval_type_name = "charbuffer";
|
|
729
|
-
break;
|
|
730
|
-
case "string" :
|
|
731
|
-
node.value_type = 4;
|
|
732
|
-
node.eval_type = 4;
|
|
733
|
-
node.eval_type_name = "string";
|
|
734
|
-
break;
|
|
735
|
-
case "boolean" :
|
|
736
|
-
node.value_type = 5;
|
|
737
|
-
node.eval_type = 5;
|
|
738
|
-
node.eval_type_name = "string";
|
|
739
|
-
break;
|
|
740
|
-
default:
|
|
741
|
-
if ( true == expression ) {
|
|
742
|
-
node.value_type = 15;
|
|
743
|
-
node.eval_type = 15;
|
|
744
|
-
node.expression = true;
|
|
745
|
-
}
|
|
746
|
-
if ( value_type == 6 ) {
|
|
747
|
-
node.value_type = 6;
|
|
748
|
-
node.eval_type = 6;
|
|
749
|
-
node.eval_type_name = type_name;
|
|
750
|
-
node.eval_array_type = array_type;
|
|
751
|
-
}
|
|
752
|
-
if ( value_type == 7 ) {
|
|
753
|
-
node.value_type = 7;
|
|
754
|
-
node.eval_type = 7;
|
|
755
|
-
node.eval_type_name = type_name;
|
|
756
|
-
node.eval_array_type = array_type;
|
|
757
|
-
node.key_type = key_type;
|
|
758
|
-
}
|
|
759
|
-
if ( value_type == 11 ) {
|
|
760
|
-
node.value_type = 11;
|
|
761
|
-
node.eval_type = 11;
|
|
762
|
-
node.eval_type_name = type_name;
|
|
763
|
-
}
|
|
764
|
-
if ( value_type == 9 ) {
|
|
765
|
-
if ( ctx.isEnumDefined(type_name) ) {
|
|
766
|
-
node.value_type = 11;
|
|
767
|
-
node.eval_type = 11;
|
|
768
|
-
node.eval_type_name = type_name;
|
|
769
|
-
}
|
|
770
|
-
if ( ctx.isDefinedClass(type_name) ) {
|
|
771
|
-
node.value_type = 8;
|
|
772
|
-
node.eval_type = 8;
|
|
773
|
-
node.eval_type_name = type_name;
|
|
774
|
-
}
|
|
775
|
-
}
|
|
776
|
-
break;
|
|
777
|
-
}
|
|
778
|
-
}
|
|
779
|
-
|
|
780
|
-
public void ifNoTypeSetToVoid() {
|
|
781
|
-
if ( (((type_name.length()) == 0) && ((key_type.length()) == 0)) && ((array_type.length()) == 0) ) {
|
|
782
|
-
type_name = "void";
|
|
783
|
-
}
|
|
784
|
-
}
|
|
785
|
-
|
|
786
|
-
public boolean ifNoTypeSetToEvalTypeOf( CodeNode node ) {
|
|
787
|
-
if ( (((type_name.length()) == 0) && ((key_type.length()) == 0)) && ((array_type.length()) == 0) ) {
|
|
788
|
-
type_name = node.eval_type_name;
|
|
789
|
-
array_type = node.eval_array_type;
|
|
790
|
-
key_type = node.eval_key_type;
|
|
791
|
-
value_type = node.eval_type;
|
|
792
|
-
eval_type = node.eval_type;
|
|
793
|
-
eval_type_name = node.eval_type_name;
|
|
794
|
-
eval_array_type = node.eval_array_type;
|
|
795
|
-
eval_key_type = node.eval_key_type;
|
|
796
|
-
if ( node.value_type == 15 ) {
|
|
797
|
-
if ( !expression_value.isPresent() ) {
|
|
798
|
-
final CodeNode copyOf = node.rebuildWithType(new RangerArgMatch(), false);
|
|
799
|
-
copyOf.children.remove(copyOf.children.size() - 1);
|
|
800
|
-
expression_value = Optional.of(copyOf);
|
|
801
|
-
}
|
|
802
|
-
}
|
|
803
|
-
return true;
|
|
804
|
-
}
|
|
805
|
-
return false;
|
|
806
|
-
}
|
|
807
|
-
}
|