ranger-compiler 2.1.69 → 3.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +103 -0
- package/README.md +991 -96
- 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/{bin/output.js → dist/rgrc.js} +15377 -7935
- package/dist/stdops.rgr +168 -0
- package/package.json +196 -38
- 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/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 -800
- 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 -1042
- 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/api.js.map +0 -1
- package/dist/bin/compiler.d.ts +0 -1638
- package/dist/bin/compiler.js +0 -32444
- package/dist/bin/compiler.js.map +0 -1
- 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/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,1109 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
Import "ng_RangerFlowParser.clj"
|
|
3
|
-
Import "ng_CodeNodeCompilerExtensions.clj"
|
|
4
|
-
Import "ng_RangerLanguageWriters.clj"
|
|
5
|
-
Import "ng_RangerActiveOperators.clj"
|
|
6
|
-
|
|
7
|
-
extension RangerAppWriterContext {
|
|
8
|
-
def rootFile:string "--not-defined--"
|
|
9
|
-
fn getRootFile:string () {
|
|
10
|
-
def root:RangerAppWriterContext (this.getRoot())
|
|
11
|
-
return root.rootFile
|
|
12
|
-
}
|
|
13
|
-
fn setRootFile:void (file_name:string) {
|
|
14
|
-
def root:RangerAppWriterContext (this.getRoot())
|
|
15
|
-
root.rootFile = file_name
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
class LiveCompiler {
|
|
20
|
-
|
|
21
|
-
def parser@(weak):RangerFlowParser
|
|
22
|
-
def langWriter:RangerGenericClassWriter
|
|
23
|
-
def hasCreatedPolyfill:[string:boolean]
|
|
24
|
-
def lastProcessedNode@(weak):CodeNode
|
|
25
|
-
def repeat_index:int 0
|
|
26
|
-
def installedFile:[string:boolean]
|
|
27
|
-
|
|
28
|
-
fn initWriter:void (ctx:RangerAppWriterContext) {
|
|
29
|
-
if (!null? langWriter) {
|
|
30
|
-
return
|
|
31
|
-
}
|
|
32
|
-
; def root:RangerAppWriterContext (ctx.getRoot())
|
|
33
|
-
def langName (ctx.getTargetLang())
|
|
34
|
-
print "Livecompiler starting with language => " + langName
|
|
35
|
-
switch langName {
|
|
36
|
-
case "go" {
|
|
37
|
-
langWriter = (new RangerGolangClassWriter ())
|
|
38
|
-
}
|
|
39
|
-
case "scala" {
|
|
40
|
-
langWriter = (new RangerScalaClassWriter ())
|
|
41
|
-
}
|
|
42
|
-
case "java7" {
|
|
43
|
-
langWriter = (new RangerJava7ClassWriter ())
|
|
44
|
-
}
|
|
45
|
-
case "swift3" {
|
|
46
|
-
langWriter = (new RangerSwift3ClassWriter ())
|
|
47
|
-
}
|
|
48
|
-
case "kotlin" {
|
|
49
|
-
langWriter = (new RangerKotlinClassWriter ())
|
|
50
|
-
}
|
|
51
|
-
case "php" {
|
|
52
|
-
langWriter = (new RangerPHPClassWriter ())
|
|
53
|
-
}
|
|
54
|
-
case "cpp" {
|
|
55
|
-
langWriter = (new RangerCppClassWriter())
|
|
56
|
-
}
|
|
57
|
-
case "csharp" {
|
|
58
|
-
langWriter = (new RangerCSharpClassWriter ())
|
|
59
|
-
}
|
|
60
|
-
case "es6" {
|
|
61
|
-
langWriter = (new RangerJavaScriptClassWriter ())
|
|
62
|
-
}
|
|
63
|
-
case "ranger" {
|
|
64
|
-
langWriter = (new RangerRangerClassWriter ())
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
if (!null? langWriter) {
|
|
68
|
-
langWriter.compiler = this
|
|
69
|
-
} {
|
|
70
|
-
langWriter = (new RangerGenericClassWriter ())
|
|
71
|
-
langWriter.compiler = this
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
fn EncodeString:string (node:CodeNode ctx:RangerAppWriterContext wr:CodeWriter) {
|
|
75
|
-
|
|
76
|
-
; TODO: check the encoding rules for the language...
|
|
77
|
-
|
|
78
|
-
def encoded_str:string ""
|
|
79
|
-
def str_length:int (strlen node.string_value)
|
|
80
|
-
|
|
81
|
-
def encoded_str:string ""
|
|
82
|
-
|
|
83
|
-
def ii:int 0
|
|
84
|
-
|
|
85
|
-
while (< ii str_length) {
|
|
86
|
-
|
|
87
|
-
def ch:int (charAt node.string_value ii)
|
|
88
|
-
def cc:int ch
|
|
89
|
-
|
|
90
|
-
switch cc {
|
|
91
|
-
case 8 {
|
|
92
|
-
encoded_str = encoded_str + (strfromcode 92 ) + (strfromcode 98 )
|
|
93
|
-
}
|
|
94
|
-
case 9 {
|
|
95
|
-
encoded_str = encoded_str + (strfromcode 92 ) + (strfromcode 116 )
|
|
96
|
-
}
|
|
97
|
-
case 10 {
|
|
98
|
-
( = encoded_str ( encoded_str + (strfromcode 92 ) + (strfromcode 110 ) ) )
|
|
99
|
-
}
|
|
100
|
-
case 12 {
|
|
101
|
-
( = encoded_str ( encoded_str + (strfromcode 92 ) + (strfromcode 102 ) ) )
|
|
102
|
-
}
|
|
103
|
-
case 13 {
|
|
104
|
-
( = encoded_str ( encoded_str + (strfromcode 92 ) + (strfromcode 114 ) ) )
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
case 34 {
|
|
108
|
-
( = encoded_str ( encoded_str + (strfromcode 92 ) + (strfromcode 34 ) ) )
|
|
109
|
-
}
|
|
110
|
-
case 92 {
|
|
111
|
-
= encoded_str ( encoded_str + (strfromcode 92 ) + (strfromcode 92 ) )
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
default {
|
|
115
|
-
( = encoded_str ( encoded_str + (strfromcode ch) ) )
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
ii = ii + 1
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
return encoded_str
|
|
122
|
-
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
fn WriteScalarValue:void (node:CodeNode ctx:RangerAppWriterContext wr:CodeWriter) {
|
|
126
|
-
langWriter.WriteScalarValue(node ctx wr)
|
|
127
|
-
}
|
|
128
|
-
fn adjustType:string (tn:string) {
|
|
129
|
-
if (tn == "this") {
|
|
130
|
-
return "self"
|
|
131
|
-
}
|
|
132
|
-
return tn
|
|
133
|
-
}
|
|
134
|
-
fn WriteVRef:void (node:CodeNode ctx:RangerAppWriterContext wr:CodeWriter) {
|
|
135
|
-
langWriter.WriteVRef(node ctx wr)
|
|
136
|
-
}
|
|
137
|
-
fn writeTypeDef:void (node:CodeNode ctx:RangerAppWriterContext wr:CodeWriter) {
|
|
138
|
-
langWriter.writeTypeDef(node ctx wr)
|
|
139
|
-
}
|
|
140
|
-
fn CreateLambdaCall:void (node:CodeNode ctx:RangerAppWriterContext wr:CodeWriter) {
|
|
141
|
-
langWriter.CreateLambdaCall(node ctx wr)
|
|
142
|
-
}
|
|
143
|
-
fn CreateCallExpression:void (node:CodeNode ctx:RangerAppWriterContext wr:CodeWriter) {
|
|
144
|
-
langWriter.CreateCallExpression(node ctx wr)
|
|
145
|
-
}
|
|
146
|
-
fn CreateLambda:void (node:CodeNode ctx:RangerAppWriterContext wr:CodeWriter) {
|
|
147
|
-
langWriter.CreateLambda(node ctx wr)
|
|
148
|
-
}
|
|
149
|
-
fn getTypeString:string (str:string ctx:RangerAppWriterContext) {
|
|
150
|
-
return ""
|
|
151
|
-
}
|
|
152
|
-
fn createPolyfill ( code:string ctx:RangerAppWriterContext wr:CodeWriter ) {
|
|
153
|
-
def p_write:CodeWriter (wr.getTag("utilities"))
|
|
154
|
-
if ((has p_write.compiledTags code) == false) {
|
|
155
|
-
p_write.raw(code true)
|
|
156
|
-
set p_write.compiledTags code true
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
fn installFile (filename:string ctx:RangerAppWriterContext wr:CodeWriter) {
|
|
160
|
-
if( has installedFile filename ) {
|
|
161
|
-
return
|
|
162
|
-
}
|
|
163
|
-
def env (unwrap (ctx.getEnv()))
|
|
164
|
-
set installedFile filename true
|
|
165
|
-
def fName ( (install_directory env) + "/" + filename) )
|
|
166
|
-
if( (file_exists env ( (install_directory env ) + "/") filename ) ) {
|
|
167
|
-
def fileData (read_file ( (install_directory env ) + "/") filename)
|
|
168
|
-
if(!null? fileData) {
|
|
169
|
-
def file_wr:CodeWriter ( wr.getFileWriter("." (filename)))
|
|
170
|
-
file_wr.raw( (unwrap fileData) false )
|
|
171
|
-
} {
|
|
172
|
-
print "did not get contents of " + (filename)
|
|
173
|
-
}
|
|
174
|
-
} {
|
|
175
|
-
print "did not find installed file " + (install_directory env) + (filename)
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
fn findOpCode:void (op:CodeNode node:CodeNode ctx:RangerAppWriterContext wr:CodeWriter) {
|
|
179
|
-
def fnName@(lives):CodeNode (itemAt op.children 1)
|
|
180
|
-
def args:CodeNode (itemAt op.children 2)
|
|
181
|
-
|
|
182
|
-
if ( (array_length op.children ) > 3 ) {
|
|
183
|
-
def details:CodeNode (itemAt op.children 3)
|
|
184
|
-
for details.children det:CodeNode i {
|
|
185
|
-
if ( (array_length det.children ) > 0 ) {
|
|
186
|
-
def fc:CodeNode (itemAt det.children 0)
|
|
187
|
-
if (fc.vref == "code") {
|
|
188
|
-
def match:RangerArgMatch (new RangerArgMatch ())
|
|
189
|
-
def all_matched:boolean (match.matchArguments(args node ctx 1))
|
|
190
|
-
if (all_matched == false) {
|
|
191
|
-
return
|
|
192
|
-
}
|
|
193
|
-
def origCode:CodeNode (itemAt det.children 1)
|
|
194
|
-
def theCode@(lives):CodeNode (origCode.rebuildWithType(match true))
|
|
195
|
-
def appCtx:RangerAppWriterContext (ctx.getRoot())
|
|
196
|
-
def stdFnName:string (appCtx.createSignature(fnName.vref (fnName.vref + (theCode.getCode()))))
|
|
197
|
-
def stdClass:RangerAppClassDesc (ctx.findClass("RangerStaticMethods"))
|
|
198
|
-
def runCtx:RangerAppWriterContext (appCtx.fork())
|
|
199
|
-
def b_failed:boolean false
|
|
200
|
-
if (false == (has stdClass.defined_static_methods stdFnName)) {
|
|
201
|
-
runCtx.setInMethod()
|
|
202
|
-
def m@(lives):RangerAppFunctionDesc (new RangerAppFunctionDesc ())
|
|
203
|
-
m.name = stdFnName
|
|
204
|
-
m.node = op
|
|
205
|
-
m.is_static = true
|
|
206
|
-
m.nameNode = fnName
|
|
207
|
-
m.fnBody = theCode
|
|
208
|
-
for args.children arg@(lives):CodeNode ii {
|
|
209
|
-
def p:RangerAppParamDesc (new RangerAppParamDesc ())
|
|
210
|
-
p.name = arg.vref
|
|
211
|
-
p.value_type = arg.value_type
|
|
212
|
-
p.node = arg
|
|
213
|
-
p.nameNode = arg
|
|
214
|
-
p.refType = RangerNodeRefType.Weak
|
|
215
|
-
p.varType = RangerContextVarType.FunctionParameter
|
|
216
|
-
push m.params p
|
|
217
|
-
arg.hasParamDesc = true
|
|
218
|
-
arg.paramDesc = p
|
|
219
|
-
arg.eval_type = arg.value_type
|
|
220
|
-
arg.eval_type_name = arg.type_name
|
|
221
|
-
runCtx.defineVariable(p.name p)
|
|
222
|
-
}
|
|
223
|
-
stdClass.addStaticMethod(m)
|
|
224
|
-
def err_cnt:int (array_length ctx.compilerErrors)
|
|
225
|
-
def flowParser:RangerFlowParser (new RangerFlowParser ())
|
|
226
|
-
def TmpWr:CodeWriter (new CodeWriter ())
|
|
227
|
-
flowParser.WalkNode(theCode runCtx TmpWr)
|
|
228
|
-
runCtx.unsetInMethod()
|
|
229
|
-
def err_delta:int ((array_length ctx.compilerErrors) - err_cnt)
|
|
230
|
-
if (err_delta > 0) {
|
|
231
|
-
b_failed = true
|
|
232
|
-
print "Had following compiler errors:"
|
|
233
|
-
for ctx.compilerErrors e:RangerCompilerMessage i {
|
|
234
|
-
if (i < err_cnt) {
|
|
235
|
-
continue _
|
|
236
|
-
}
|
|
237
|
-
def line_index:int (e.node.getLine())
|
|
238
|
-
print ((e.node.getFilename()) + " Line: " + line_index)
|
|
239
|
-
print e.description
|
|
240
|
-
print (e.node.getLineString(line_index))
|
|
241
|
-
}
|
|
242
|
-
} {
|
|
243
|
-
print 'no errors found'
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
if b_failed {
|
|
247
|
-
wr.out('/* custom operator compilation failed */ ' false)
|
|
248
|
-
} {
|
|
249
|
-
wr.out((('RangerStaticMethods.' + stdFnName) + '(') false)
|
|
250
|
-
for node.children cc:CodeNode i {
|
|
251
|
-
if (i == 0) {
|
|
252
|
-
continue _
|
|
253
|
-
}
|
|
254
|
-
if (i > 1) {
|
|
255
|
-
wr.out(', ' false)
|
|
256
|
-
}
|
|
257
|
-
this.WalkNode(cc ctx wr)
|
|
258
|
-
}
|
|
259
|
-
wr.out(')' false)
|
|
260
|
-
}
|
|
261
|
-
return
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
fn findOpTemplate@(weak optional):CodeNode (op:CodeNode node:CodeNode ctx:RangerAppWriterContext wr:CodeWriter) {
|
|
268
|
-
def fnName:CodeNode (itemAt op.children 1)
|
|
269
|
-
def root:RangerAppWriterContext (ctx.getRoot())
|
|
270
|
-
def langName:string (ctx.getTargetLang())
|
|
271
|
-
def rv@(optional):CodeNode
|
|
272
|
-
def opDef op
|
|
273
|
-
if ( (array_length op.children ) > 3) {
|
|
274
|
-
def details:CodeNode (itemAt op.children 3)
|
|
275
|
-
for details.children det:CodeNode i {
|
|
276
|
-
if ( (array_length det.children ) > 0) {
|
|
277
|
-
def fc:CodeNode (itemAt det.children 0)
|
|
278
|
-
if (fc.vref == "templates") {
|
|
279
|
-
def tplList:CodeNode (itemAt det.children 1)
|
|
280
|
-
for tplList.children tpl:CodeNode i {
|
|
281
|
-
def tplName:CodeNode (tpl.getFirst())
|
|
282
|
-
def tplImpl@(optional):CodeNode
|
|
283
|
-
tplImpl = (tpl.getSecond())
|
|
284
|
-
|
|
285
|
-
def is_ts (ctx.hasCompilerFlag('typescript'))
|
|
286
|
-
if( is_ts && ( tplName.vref == 'typescript' || tplName.vref == 'ts') ) {
|
|
287
|
-
rv = tplImpl
|
|
288
|
-
return rv
|
|
289
|
-
}
|
|
290
|
-
if ((tplName.vref != "*") && (tplName.vref != langName)) {
|
|
291
|
-
continue _
|
|
292
|
-
}
|
|
293
|
-
if (tplName.hasFlag("mutable")) {
|
|
294
|
-
if (false == (node.hasFlag("mutable"))) {
|
|
295
|
-
continue _
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
rv = tplImpl
|
|
299
|
-
return rv
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
if(langName == 'ranger') {
|
|
303
|
-
def opNameNode (opDef.getFirst())
|
|
304
|
-
def opArgs (opDef.getThird())
|
|
305
|
-
def rangerTpl (r.expression (r.value ('(' + opNameNode.vref + ' ' ) ) ) )
|
|
306
|
-
def cnt 1
|
|
307
|
-
opArgs.children.forEach({
|
|
308
|
-
if(item.type_name == 'block') {
|
|
309
|
-
push rangerTpl.children (r.expression (r.vref 'block') (r.value cnt ))
|
|
310
|
-
} {
|
|
311
|
-
push rangerTpl.children (r.expression (r.vref 'e') (r.value cnt ))
|
|
312
|
-
}
|
|
313
|
-
cnt = cnt + 1
|
|
314
|
-
})
|
|
315
|
-
push rangerTpl.children (r.value ')')
|
|
316
|
-
rv = rangerTpl
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
return rv
|
|
324
|
-
}
|
|
325
|
-
fn localCall:boolean (node:CodeNode ctx:RangerAppWriterContext wr:CodeWriter) {
|
|
326
|
-
if node.hasFnCall {
|
|
327
|
-
if (!null? langWriter) {
|
|
328
|
-
langWriter.writeFnCall(node ctx wr)
|
|
329
|
-
return true
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
if node.hasNewOper {
|
|
333
|
-
langWriter.writeNewCall(node ctx wr)
|
|
334
|
-
return true
|
|
335
|
-
}
|
|
336
|
-
if node.hasVarDef {
|
|
337
|
-
if node.disabled_node {
|
|
338
|
-
langWriter.disabledVarDef(node ctx wr)
|
|
339
|
-
} {
|
|
340
|
-
langWriter.writeVarDef(node ctx wr)
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
return true
|
|
344
|
-
}
|
|
345
|
-
if node.hasClassDescription {
|
|
346
|
-
langWriter.writeClass(node ctx wr)
|
|
347
|
-
return true
|
|
348
|
-
}
|
|
349
|
-
return false
|
|
350
|
-
}
|
|
351
|
-
fn WalkNode:void (node:CodeNode in_ctx:RangerAppWriterContext wr:CodeWriter) {
|
|
352
|
-
|
|
353
|
-
this.initWriter(in_ctx)
|
|
354
|
-
|
|
355
|
-
if(node.disabled_node) {
|
|
356
|
-
return
|
|
357
|
-
}
|
|
358
|
-
def ctx (in_ctx)
|
|
359
|
-
|
|
360
|
-
if(!null? node.evalCtx) {
|
|
361
|
-
ctx = (unwrap node.evalCtx)
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
; if! node.flow_done {
|
|
365
|
-
; print "^^ flow not done here"
|
|
366
|
-
; }
|
|
367
|
-
; if(node.hasFnCall) {
|
|
368
|
-
; print "^ 3rd has hasFnCall " + (node.getCode())
|
|
369
|
-
; }
|
|
370
|
-
|
|
371
|
-
; if( (ctx.hasCompilerFlag('new')) ) {
|
|
372
|
-
if(has node.register_name ) {
|
|
373
|
-
if( (ctx.expressionLevel()) > 0) {
|
|
374
|
-
if( has node.reg_compiled_name ) {
|
|
375
|
-
wr.out(node.reg_compiled_name false)
|
|
376
|
-
} {
|
|
377
|
-
print "Could not find compiled name for " + node.register_name + " at " + (node.getCode())
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
return
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
; if( (ctx.hasCompilerFlag('new')) ) {
|
|
384
|
-
def liveNodes@(weak):[CodeNode]
|
|
385
|
-
def rootItem node
|
|
386
|
-
if( has node.register_expressions) {
|
|
387
|
-
node.register_expressions.forEach({
|
|
388
|
-
; print (item.getCode())
|
|
389
|
-
push liveNodes item
|
|
390
|
-
})
|
|
391
|
-
}
|
|
392
|
-
liveNodes.forEach({
|
|
393
|
-
if( item.register_set == false ) {
|
|
394
|
-
item.register_set = true
|
|
395
|
-
this.WalkNode(item ctx wr)
|
|
396
|
-
}
|
|
397
|
-
})
|
|
398
|
-
clear liveNodes
|
|
399
|
-
; }
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
if(node.value_type == RangerNodeType.Comment) {
|
|
403
|
-
return
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
if (node.isPrimitive()) {
|
|
407
|
-
this.WriteScalarValue(node ctx wr)
|
|
408
|
-
return
|
|
409
|
-
}
|
|
410
|
-
this.lastProcessedNode = node
|
|
411
|
-
|
|
412
|
-
if(node.isFirstVref('property')) {
|
|
413
|
-
langWriter.CreatePropertyGet( node ctx wr)
|
|
414
|
-
return
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
if( node.is_plugin ) {
|
|
418
|
-
return
|
|
419
|
-
}
|
|
420
|
-
if( node.is_array_literal ) {
|
|
421
|
-
langWriter.writeArrayLiteral( node ctx wr)
|
|
422
|
-
return
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
if (node.value_type == RangerNodeType.VRef || node.value_type == RangerNodeType.Hash || node.value_type == RangerNodeType.Array) {
|
|
426
|
-
this.WriteVRef(node ctx wr)
|
|
427
|
-
return
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
if (node.value_type == RangerNodeType.Lambda) {
|
|
431
|
-
this.WriteVRef(node ctx wr)
|
|
432
|
-
return
|
|
433
|
-
}
|
|
434
|
-
if ((array_length node.children) > 0) {
|
|
435
|
-
if node.has_operator {
|
|
436
|
-
def op:CodeNode (ctx.findOperator(node))
|
|
437
|
-
def fc:CodeNode (op.getFirst())
|
|
438
|
-
def tplImpl@(optional):CodeNode (this.findOpTemplate(op node ctx wr))
|
|
439
|
-
def evalCtx:RangerAppWriterContext ctx
|
|
440
|
-
if (!null? node.evalCtx) {
|
|
441
|
-
evalCtx = (unwrap node.evalCtx)
|
|
442
|
-
}
|
|
443
|
-
if (!null? tplImpl) {
|
|
444
|
-
def opName:CodeNode (op.getSecond())
|
|
445
|
-
if (opName.hasFlag("returns")) {
|
|
446
|
-
langWriter.release_local_vars(node evalCtx wr)
|
|
447
|
-
}
|
|
448
|
-
this.walkCommandList( (unwrap tplImpl) node evalCtx wr)
|
|
449
|
-
} {
|
|
450
|
-
this.findOpCode(op node evalCtx wr)
|
|
451
|
-
}
|
|
452
|
-
return
|
|
453
|
-
}
|
|
454
|
-
if( node.is_direct_method_call) {
|
|
455
|
-
langWriter.CreateMethodCall(node ctx wr)
|
|
456
|
-
return
|
|
457
|
-
}
|
|
458
|
-
if (node.has_lambda) {
|
|
459
|
-
this.CreateLambda(node ctx wr)
|
|
460
|
-
return
|
|
461
|
-
}
|
|
462
|
-
if (node.has_lambda_call) {
|
|
463
|
-
this.CreateLambdaCall(node ctx wr)
|
|
464
|
-
return
|
|
465
|
-
}
|
|
466
|
-
; skip elents which are part of the chain...
|
|
467
|
-
if(node.is_part_of_chain) {
|
|
468
|
-
return
|
|
469
|
-
}
|
|
470
|
-
if (node.has_call) {
|
|
471
|
-
this.CreateCallExpression(node ctx wr)
|
|
472
|
-
return
|
|
473
|
-
}
|
|
474
|
-
if ((array_length node.children) > 1) {
|
|
475
|
-
if (this.localCall(node ctx wr)) {
|
|
476
|
-
return
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
def fc:CodeNode (node.getFirst())
|
|
480
|
-
}
|
|
481
|
-
if node.expression {
|
|
482
|
-
|
|
483
|
-
; wr.out( ("/* did return at index == " + node.didReturnAtIndex + "*/" ) false)
|
|
484
|
-
for node.children item:CodeNode i {
|
|
485
|
-
if ((node.didReturnAtIndex >= 0) && (node.didReturnAtIndex < i)) {
|
|
486
|
-
break _
|
|
487
|
-
}
|
|
488
|
-
; if( (ctx.hasCompilerFlag('new')) ) {
|
|
489
|
-
if(node.is_block_node) {
|
|
490
|
-
def liveNodes@(weak):[CodeNode]
|
|
491
|
-
def rootItem item
|
|
492
|
-
if( has item.register_expressions) {
|
|
493
|
-
item.register_expressions.forEach({
|
|
494
|
-
push liveNodes item
|
|
495
|
-
})
|
|
496
|
-
}
|
|
497
|
-
item.walkTreeUntil({
|
|
498
|
-
if(item.is_block_node) {
|
|
499
|
-
return false
|
|
500
|
-
}
|
|
501
|
-
return true
|
|
502
|
-
})
|
|
503
|
-
liveNodes.forEach({
|
|
504
|
-
if( item.register_set == false ) {
|
|
505
|
-
item.register_set = true
|
|
506
|
-
this.WalkNode(item ctx wr)
|
|
507
|
-
}
|
|
508
|
-
})
|
|
509
|
-
}
|
|
510
|
-
; }
|
|
511
|
-
this.WalkNode(item ctx wr)
|
|
512
|
-
}
|
|
513
|
-
} {
|
|
514
|
-
; print "no expression, exiting"
|
|
515
|
-
if(node.value_type == RangerNodeType.ExpressionType) {
|
|
516
|
-
this.WriteVRef(node ctx wr)
|
|
517
|
-
}
|
|
518
|
-
|
|
519
|
-
}
|
|
520
|
-
}
|
|
521
|
-
fn walkCommandList:void (cmd:CodeNode node:CodeNode ctx:RangerAppWriterContext wr:CodeWriter) {
|
|
522
|
-
if ((ctx.expressionLevel()) == 0) {
|
|
523
|
-
wr.newline()
|
|
524
|
-
if( (ctx.getTargetLang()) == 'swift3') {
|
|
525
|
-
def opn (unwrap node.operator_node)
|
|
526
|
-
def nn (opn.getSecond())
|
|
527
|
-
|
|
528
|
-
if( nn.type_name != 'void' ) {
|
|
529
|
-
wr.out('_ = ' false)
|
|
530
|
-
}
|
|
531
|
-
; def cmdNode
|
|
532
|
-
;
|
|
533
|
-
}
|
|
534
|
-
}
|
|
535
|
-
if ((ctx.expressionLevel()) > 1) {
|
|
536
|
-
wr.out('(' false)
|
|
537
|
-
}
|
|
538
|
-
for cmd.children c:CodeNode i {
|
|
539
|
-
this.walkCommand(c node ctx wr)
|
|
540
|
-
}
|
|
541
|
-
if ((ctx.expressionLevel()) > 1) {
|
|
542
|
-
wr.out(')' false)
|
|
543
|
-
}
|
|
544
|
-
if ((ctx.expressionLevel()) == 0) {
|
|
545
|
-
wr.line_end( (langWriter.lineEnding()) )
|
|
546
|
-
wr.newline()
|
|
547
|
-
}
|
|
548
|
-
}
|
|
549
|
-
fn walkCommand:void (cmd:CodeNode node:CodeNode ctx:RangerAppWriterContext wr:CodeWriter) {
|
|
550
|
-
if ( cmd.expression ) {
|
|
551
|
-
|
|
552
|
-
if( ( array_length cmd.children) < 2) {
|
|
553
|
-
ctx.addError( node "Invalid command")
|
|
554
|
-
ctx.addError( cmd "Invalid command")
|
|
555
|
-
return
|
|
556
|
-
}
|
|
557
|
-
|
|
558
|
-
def cmdE:CodeNode (cmd.getFirst())
|
|
559
|
-
def cmdArg@(lives):CodeNode (cmd.getSecond())
|
|
560
|
-
switch cmdE.vref {
|
|
561
|
-
case "service_id" {
|
|
562
|
-
def idx:int cmdArg.int_value
|
|
563
|
-
if ((array_length node.children) >= idx) {
|
|
564
|
-
def arg:CodeNode (itemAt node.children idx)
|
|
565
|
-
def root (ctx.getRoot())
|
|
566
|
-
def sNode (get root.appServices arg.vref)
|
|
567
|
-
if(!null? sNode) {
|
|
568
|
-
wr.out( sNode.appGUID false)
|
|
569
|
-
} {
|
|
570
|
-
ctx.addError( arg "Service not found")
|
|
571
|
-
}
|
|
572
|
-
} {
|
|
573
|
-
ctx.addError( node "Service not found")
|
|
574
|
-
}
|
|
575
|
-
}
|
|
576
|
-
|
|
577
|
-
case "log" {
|
|
578
|
-
print cmdArg.string_value
|
|
579
|
-
}
|
|
580
|
-
case "str" {
|
|
581
|
-
def idx:int cmdArg.int_value
|
|
582
|
-
if ((array_length node.children) > idx) {
|
|
583
|
-
def arg:CodeNode (itemAt node.children idx)
|
|
584
|
-
wr.out(arg.string_value false)
|
|
585
|
-
}
|
|
586
|
-
}
|
|
587
|
-
case "block" {
|
|
588
|
-
def idx:int cmdArg.int_value
|
|
589
|
-
if ((array_length node.children) > idx) {
|
|
590
|
-
def arg:CodeNode (itemAt node.children idx)
|
|
591
|
-
def sCtx (ctx.fork())
|
|
592
|
-
sCtx.restartExpressionLevel()
|
|
593
|
-
this.WalkNode(arg sCtx wr)
|
|
594
|
-
}
|
|
595
|
-
}
|
|
596
|
-
case "varname" {
|
|
597
|
-
if (ctx.isVarDefined(cmdArg.vref)) {
|
|
598
|
-
def p:RangerAppParamDesc (ctx.getVariableDef(cmdArg.vref))
|
|
599
|
-
wr.out(p.compiledName false)
|
|
600
|
-
}
|
|
601
|
-
}
|
|
602
|
-
case "defvar" {
|
|
603
|
-
def p@(lives):RangerAppParamDesc (new RangerAppParamDesc ())
|
|
604
|
-
p.name = cmdArg.vref
|
|
605
|
-
p.value_type = cmdArg.value_type
|
|
606
|
-
p.node = cmdArg
|
|
607
|
-
p.nameNode = cmdArg
|
|
608
|
-
p.is_optional = false
|
|
609
|
-
ctx.defineVariable(p.name p)
|
|
610
|
-
}
|
|
611
|
-
case "cc" {
|
|
612
|
-
def idx:int cmdArg.int_value
|
|
613
|
-
if ((array_length node.children) > idx) {
|
|
614
|
-
def arg:CodeNode (itemAt node.children idx)
|
|
615
|
-
def cc:char (charcode arg.string_value)
|
|
616
|
-
wr.out(("" + (to_int cc)) false)
|
|
617
|
-
}
|
|
618
|
-
}
|
|
619
|
-
case "optional_option" {
|
|
620
|
-
def idx:int cmdArg.int_value
|
|
621
|
-
if ((array_length node.children) > idx) {
|
|
622
|
-
def arg:CodeNode (itemAt node.children idx)
|
|
623
|
-
if( ctx.hasCompilerSetting(arg.string_value) ) {
|
|
624
|
-
def setting (ctx.getCompilerSetting(arg.string_value))
|
|
625
|
-
wr.out( setting false)
|
|
626
|
-
}
|
|
627
|
-
}
|
|
628
|
-
}
|
|
629
|
-
case "required_option" {
|
|
630
|
-
def idx:int cmdArg.int_value
|
|
631
|
-
if ((array_length node.children) > idx) {
|
|
632
|
-
def arg:CodeNode (itemAt node.children idx)
|
|
633
|
-
if( ctx.hasCompilerSetting(arg.string_value) ) {
|
|
634
|
-
def setting (ctx.getCompilerSetting(arg.string_value))
|
|
635
|
-
wr.out( setting false)
|
|
636
|
-
} {
|
|
637
|
-
ctx.addError( node ("This source code requires compiler option -" + arg.string_value + "=<> to be set ") )
|
|
638
|
-
}
|
|
639
|
-
}
|
|
640
|
-
}
|
|
641
|
-
case "java_case" {
|
|
642
|
-
def idx:int cmdArg.int_value
|
|
643
|
-
if ((array_length node.children) > idx) {
|
|
644
|
-
def arg:CodeNode (itemAt node.children idx)
|
|
645
|
-
this.WalkNode(arg ctx wr)
|
|
646
|
-
if (arg.didReturnAtIndex < 0) {
|
|
647
|
-
wr.newline()
|
|
648
|
-
wr.out("break;" true)
|
|
649
|
-
}
|
|
650
|
-
}
|
|
651
|
-
}
|
|
652
|
-
|
|
653
|
-
; fn addPluginNode ( name:string op@(temp):CodeNode ) {
|
|
654
|
-
case 'plugin' {
|
|
655
|
-
; --> (plugin 'maven')
|
|
656
|
-
if( (size cmd.children) > 2) {
|
|
657
|
-
def cmdData@(lives):CodeNode (cmd.getThird())
|
|
658
|
-
def name cmdArg.string_value
|
|
659
|
-
ctx.addPluginNode( name cmdData)
|
|
660
|
-
}
|
|
661
|
-
}
|
|
662
|
-
|
|
663
|
-
case "lambda" {
|
|
664
|
-
def idx:int cmdArg.int_value
|
|
665
|
-
if ((array_length node.children) > idx) {
|
|
666
|
-
def arg:CodeNode (itemAt node.children idx)
|
|
667
|
-
ctx.setInExpr()
|
|
668
|
-
this.WalkNode(arg ctx wr)
|
|
669
|
-
ctx.unsetInExpr()
|
|
670
|
-
}
|
|
671
|
-
}
|
|
672
|
-
case "e" {
|
|
673
|
-
def idx:int cmdArg.int_value
|
|
674
|
-
if ((array_length node.children) > idx) {
|
|
675
|
-
def arg:CodeNode (itemAt node.children idx)
|
|
676
|
-
ctx.setInExpr()
|
|
677
|
-
this.WalkNode(arg ctx wr)
|
|
678
|
-
ctx.unsetInExpr()
|
|
679
|
-
}
|
|
680
|
-
}
|
|
681
|
-
case "goset" {
|
|
682
|
-
def idx:int cmdArg.int_value
|
|
683
|
-
if ((array_length node.children) > idx) {
|
|
684
|
-
def arg:CodeNode (itemAt node.children idx)
|
|
685
|
-
ctx.setInExpr()
|
|
686
|
-
langWriter.WriteSetterVRef(arg ctx wr)
|
|
687
|
-
ctx.unsetInExpr()
|
|
688
|
-
}
|
|
689
|
-
}
|
|
690
|
-
case "pe" {
|
|
691
|
-
def idx:int cmdArg.int_value
|
|
692
|
-
if ((array_length node.children) > idx) {
|
|
693
|
-
def arg:CodeNode (itemAt node.children idx)
|
|
694
|
-
this.WalkNode(arg ctx wr)
|
|
695
|
-
}
|
|
696
|
-
}
|
|
697
|
-
case "ptr" {
|
|
698
|
-
def idx:int cmdArg.int_value
|
|
699
|
-
if ((array_length node.children) > idx) {
|
|
700
|
-
def arg:CodeNode (itemAt node.children idx)
|
|
701
|
-
if arg.hasParamDesc {
|
|
702
|
-
if ((arg.paramDesc.nameNode.isAPrimitiveType()) == false) {
|
|
703
|
-
wr.out("*" false)
|
|
704
|
-
}
|
|
705
|
-
} {
|
|
706
|
-
if ((arg.isAPrimitiveType()) == false) {
|
|
707
|
-
wr.out("*" false)
|
|
708
|
-
}
|
|
709
|
-
}
|
|
710
|
-
}
|
|
711
|
-
}
|
|
712
|
-
case "ptrsrc" {
|
|
713
|
-
def idx:int cmdArg.int_value
|
|
714
|
-
if ((array_length node.children) > idx) {
|
|
715
|
-
def arg:CodeNode (itemAt node.children idx)
|
|
716
|
-
if (((arg.isPrimitiveType()) == false) && ((arg.isPrimitive()) == false)) {
|
|
717
|
-
wr.out("&" false)
|
|
718
|
-
}
|
|
719
|
-
}
|
|
720
|
-
}
|
|
721
|
-
case "nameof" {
|
|
722
|
-
def idx:int cmdArg.int_value
|
|
723
|
-
if ((array_length node.children) > idx) {
|
|
724
|
-
def arg:CodeNode (itemAt node.children idx)
|
|
725
|
-
wr.out(arg.vref false)
|
|
726
|
-
}
|
|
727
|
-
}
|
|
728
|
-
case "list" {
|
|
729
|
-
def idx:int cmdArg.int_value
|
|
730
|
-
if ((array_length node.children) > idx) {
|
|
731
|
-
def arg:CodeNode (itemAt node.children idx)
|
|
732
|
-
for arg.children ch:CodeNode i {
|
|
733
|
-
if (i > 0) {
|
|
734
|
-
wr.out(' ' false)
|
|
735
|
-
}
|
|
736
|
-
ctx.setInExpr()
|
|
737
|
-
this.WalkNode(ch ctx wr)
|
|
738
|
-
ctx.unsetInExpr()
|
|
739
|
-
}
|
|
740
|
-
}
|
|
741
|
-
}
|
|
742
|
-
|
|
743
|
-
case "repeat" {
|
|
744
|
-
def idx:int cmdArg.int_value
|
|
745
|
-
repeat_index = idx
|
|
746
|
-
if ((array_length node.children) >= idx) {
|
|
747
|
-
def cmdToRepeat@(lives):CodeNode (cmd.getThird())
|
|
748
|
-
def i:int (idx)
|
|
749
|
-
while ( i < (array_length node.children)) {
|
|
750
|
-
if(i >= idx) {
|
|
751
|
-
for cmdToRepeat.children cc:CodeNode ii {
|
|
752
|
-
if( (array_length cc.children ) > 0) {
|
|
753
|
-
def fc (cc.getFirst())
|
|
754
|
-
if(fc.vref == "e") {
|
|
755
|
-
def dc (cc.getSecond())
|
|
756
|
-
dc.int_value = i
|
|
757
|
-
}
|
|
758
|
-
if(fc.vref == "block") {
|
|
759
|
-
def dc (cc.getSecond())
|
|
760
|
-
dc.int_value = i
|
|
761
|
-
}
|
|
762
|
-
}
|
|
763
|
-
}
|
|
764
|
-
this.walkCommandList(cmdToRepeat node ctx wr)
|
|
765
|
-
; if( (i + 1 ) < (array_length node.children)) {
|
|
766
|
-
; wr.out("," false)
|
|
767
|
-
; }
|
|
768
|
-
}
|
|
769
|
-
i = i + 1
|
|
770
|
-
}
|
|
771
|
-
}
|
|
772
|
-
}
|
|
773
|
-
|
|
774
|
-
case "repeat_from" {
|
|
775
|
-
def idx:int cmdArg.int_value
|
|
776
|
-
repeat_index = idx
|
|
777
|
-
if ((array_length node.children) >= idx) {
|
|
778
|
-
def cmdToRepeat@(lives):CodeNode (cmd.getThird())
|
|
779
|
-
def i:int (idx)
|
|
780
|
-
while ( i < (array_length node.children)) {
|
|
781
|
-
if(i >= idx) {
|
|
782
|
-
for cmdToRepeat.children cc:CodeNode ii {
|
|
783
|
-
if( (array_length cc.children ) > 0) {
|
|
784
|
-
def fc (cc.getFirst())
|
|
785
|
-
if(fc.vref == "e") {
|
|
786
|
-
def dc (cc.getSecond())
|
|
787
|
-
dc.int_value = i
|
|
788
|
-
}
|
|
789
|
-
if(fc.vref == "block") {
|
|
790
|
-
def dc (cc.getSecond())
|
|
791
|
-
dc.int_value = i
|
|
792
|
-
}
|
|
793
|
-
}
|
|
794
|
-
}
|
|
795
|
-
this.walkCommandList(cmdToRepeat node ctx wr)
|
|
796
|
-
if( (i + 1 ) < (array_length node.children)) {
|
|
797
|
-
wr.out("," false)
|
|
798
|
-
}
|
|
799
|
-
}
|
|
800
|
-
i = i + 1
|
|
801
|
-
}
|
|
802
|
-
}
|
|
803
|
-
}
|
|
804
|
-
case "comma" {
|
|
805
|
-
def idx:int cmdArg.int_value
|
|
806
|
-
if ((array_length node.children) > idx) {
|
|
807
|
-
def arg:CodeNode (itemAt node.children idx)
|
|
808
|
-
for arg.children ch:CodeNode i {
|
|
809
|
-
if (i > 0) {
|
|
810
|
-
wr.out("," false)
|
|
811
|
-
}
|
|
812
|
-
ctx.setInExpr()
|
|
813
|
-
this.WalkNode(ch ctx wr)
|
|
814
|
-
ctx.unsetInExpr()
|
|
815
|
-
}
|
|
816
|
-
}
|
|
817
|
-
}
|
|
818
|
-
case "swift_rc" {
|
|
819
|
-
def idx:int cmdArg.int_value
|
|
820
|
-
if ((array_length node.children) > idx) {
|
|
821
|
-
def arg:CodeNode (itemAt node.children idx)
|
|
822
|
-
if arg.hasParamDesc {
|
|
823
|
-
if (arg.paramDesc.ref_cnt == 0) {
|
|
824
|
-
wr.out("_" false)
|
|
825
|
-
} {
|
|
826
|
-
def p:RangerAppParamDesc (ctx.getVariableDef(arg.vref))
|
|
827
|
-
wr.out(p.compiledName false)
|
|
828
|
-
}
|
|
829
|
-
} {
|
|
830
|
-
wr.out(arg.vref false)
|
|
831
|
-
}
|
|
832
|
-
}
|
|
833
|
-
}
|
|
834
|
-
case "r_ktype" {
|
|
835
|
-
def idx:int cmdArg.int_value
|
|
836
|
-
if ((array_length node.children) > idx) {
|
|
837
|
-
def arg:CodeNode (itemAt node.children idx)
|
|
838
|
-
if arg.hasParamDesc {
|
|
839
|
-
def ss:string (langWriter.getObjectTypeString(arg.paramDesc.nameNode.key_type ctx))
|
|
840
|
-
wr.out(ss false)
|
|
841
|
-
} {
|
|
842
|
-
def ss:string (langWriter.getObjectTypeString(arg.key_type ctx))
|
|
843
|
-
wr.out(ss false)
|
|
844
|
-
}
|
|
845
|
-
}
|
|
846
|
-
}
|
|
847
|
-
case "r_atype" {
|
|
848
|
-
def idx:int cmdArg.int_value
|
|
849
|
-
if ((array_length node.children) > idx) {
|
|
850
|
-
def arg:CodeNode (itemAt node.children idx)
|
|
851
|
-
if arg.hasParamDesc {
|
|
852
|
-
def ss:string (langWriter.getObjectTypeString(arg.paramDesc.nameNode.array_type ctx))
|
|
853
|
-
wr.out(ss false)
|
|
854
|
-
} {
|
|
855
|
-
def ss:string (langWriter.getObjectTypeString(arg.array_type ctx))
|
|
856
|
-
wr.out(ss false)
|
|
857
|
-
}
|
|
858
|
-
}
|
|
859
|
-
}
|
|
860
|
-
case "r_atype_fname" {
|
|
861
|
-
def idx:int cmdArg.int_value
|
|
862
|
-
if ((array_length node.children) > idx) {
|
|
863
|
-
def arg:CodeNode (itemAt node.children idx)
|
|
864
|
-
if arg.hasParamDesc {
|
|
865
|
-
def ss:string (langWriter.getObjectTypeString(arg.paramDesc.nameNode.array_type ctx))
|
|
866
|
-
if(ss == "interface{}") {
|
|
867
|
-
ss = "interface"
|
|
868
|
-
}
|
|
869
|
-
wr.out(ss false)
|
|
870
|
-
} {
|
|
871
|
-
def ss:string (langWriter.getObjectTypeString(arg.array_type ctx))
|
|
872
|
-
if(ss == "interface{}") {
|
|
873
|
-
ss = "interface"
|
|
874
|
-
}
|
|
875
|
-
wr.out(ss false)
|
|
876
|
-
}
|
|
877
|
-
}
|
|
878
|
-
}
|
|
879
|
-
|
|
880
|
-
case "custom" {
|
|
881
|
-
langWriter.CustomOperator(node ctx wr)
|
|
882
|
-
}
|
|
883
|
-
|
|
884
|
-
case "arraytype" {
|
|
885
|
-
def idx:int cmdArg.int_value
|
|
886
|
-
if ((array_length node.children) > idx) {
|
|
887
|
-
def arg:CodeNode (itemAt node.children idx)
|
|
888
|
-
if arg.hasParamDesc {
|
|
889
|
-
langWriter.writeArrayTypeDef( (unwrap arg.paramDesc.nameNode) ctx wr)
|
|
890
|
-
} {
|
|
891
|
-
langWriter.writeArrayTypeDef(arg ctx wr)
|
|
892
|
-
}
|
|
893
|
-
}
|
|
894
|
-
}
|
|
895
|
-
|
|
896
|
-
case "java_class" {
|
|
897
|
-
; (java_class 'className' '<code>')
|
|
898
|
-
try {
|
|
899
|
-
def fName (cmdArg.string_value + ".java")
|
|
900
|
-
def p_write:CodeWriter (wr.getTag("utilities"))
|
|
901
|
-
if ((has p_write.compiledTags fName) == false) {
|
|
902
|
-
def code (cmd.getThird())
|
|
903
|
-
def classWr (wr.getFileWriter( "." fName))
|
|
904
|
-
if( has (classWr.getCode())) {
|
|
905
|
-
|
|
906
|
-
} {
|
|
907
|
-
def package_name (ctx.getCompilerSetting("package"))
|
|
908
|
-
classWr.out("package " + package_name + ";" , true)
|
|
909
|
-
classWr.raw( code.string_value false)
|
|
910
|
-
set p_write.compiledTags fName true
|
|
911
|
-
}
|
|
912
|
-
}
|
|
913
|
-
} {
|
|
914
|
-
|
|
915
|
-
}
|
|
916
|
-
}
|
|
917
|
-
|
|
918
|
-
case "rawtype" {
|
|
919
|
-
def idx:int cmdArg.int_value
|
|
920
|
-
if ((array_length node.children) > idx) {
|
|
921
|
-
def arg:CodeNode (itemAt node.children idx)
|
|
922
|
-
if arg.hasParamDesc {
|
|
923
|
-
langWriter.writeRawTypeDef( (unwrap arg.paramDesc.nameNode) ctx wr)
|
|
924
|
-
} {
|
|
925
|
-
langWriter.writeRawTypeDef(arg ctx wr)
|
|
926
|
-
}
|
|
927
|
-
}
|
|
928
|
-
}
|
|
929
|
-
case "macro" {
|
|
930
|
-
; compiledTags
|
|
931
|
-
|
|
932
|
-
def p_write:CodeWriter (wr.getTag("utilities"))
|
|
933
|
-
def newWriter:CodeWriter (new CodeWriter ())
|
|
934
|
-
def testCtx:RangerAppWriterContext (ctx.fork())
|
|
935
|
-
testCtx.restartExpressionLevel()
|
|
936
|
-
testCtx.targetLangName = "ranger"
|
|
937
|
-
|
|
938
|
-
this.walkCommandList(cmdArg node testCtx newWriter)
|
|
939
|
-
def p_str:string (newWriter.getCode())
|
|
940
|
-
def root:RangerAppWriterContext (ctx.getRoot())
|
|
941
|
-
|
|
942
|
-
if ((has p_write.compiledTags p_str) == false) {
|
|
943
|
-
set p_write.compiledTags p_str true
|
|
944
|
-
|
|
945
|
-
def mCtx:RangerAppWriterContext (ctx.fork())
|
|
946
|
-
mCtx.restartExpressionLevel()
|
|
947
|
-
mCtx.targetLangName = "ranger"
|
|
948
|
-
this.walkCommandList(cmdArg node mCtx p_write)
|
|
949
|
-
|
|
950
|
-
}
|
|
951
|
-
}
|
|
952
|
-
case "install_file" {
|
|
953
|
-
this.installFile( cmdArg.string_value ctx wr)
|
|
954
|
-
}
|
|
955
|
-
case "create_polyfill" {
|
|
956
|
-
this.createPolyfill( cmdArg.string_value ctx wr)
|
|
957
|
-
}
|
|
958
|
-
case "typeof" {
|
|
959
|
-
def idx:int cmdArg.int_value
|
|
960
|
-
if ((array_length node.children) >= idx) {
|
|
961
|
-
def arg:CodeNode (itemAt node.children idx)
|
|
962
|
-
if arg.hasParamDesc {
|
|
963
|
-
this.writeTypeDef( (unwrap arg.paramDesc.nameNode) ctx wr)
|
|
964
|
-
} {
|
|
965
|
-
this.writeTypeDef(arg ctx wr)
|
|
966
|
-
}
|
|
967
|
-
}
|
|
968
|
-
}
|
|
969
|
-
case "imp" {
|
|
970
|
-
langWriter.import_lib(cmdArg.string_value ctx wr)
|
|
971
|
-
}
|
|
972
|
-
case "atype" {
|
|
973
|
-
def idx:int cmdArg.int_value
|
|
974
|
-
if ((array_length node.children) >= idx) {
|
|
975
|
-
def arg:CodeNode (itemAt node.children idx)
|
|
976
|
-
def p@(optional):RangerAppParamDesc (this.findParamDesc( arg ctx wr))
|
|
977
|
-
def nameNode:CodeNode (unwrap p.nameNode)
|
|
978
|
-
|
|
979
|
-
def tn:string nameNode.array_type
|
|
980
|
-
wr.out((this.getTypeString(tn ctx)) false)
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
}
|
|
984
|
-
}
|
|
985
|
-
}
|
|
986
|
-
} {
|
|
987
|
-
if (cmd.value_type == RangerNodeType.VRef) {
|
|
988
|
-
switch cmd.vref {
|
|
989
|
-
case "nl" {
|
|
990
|
-
wr.newline()
|
|
991
|
-
}
|
|
992
|
-
case 'space' {
|
|
993
|
-
wr.out(' ' false)
|
|
994
|
-
}
|
|
995
|
-
case 'I' {
|
|
996
|
-
wr.indent(1)
|
|
997
|
-
}
|
|
998
|
-
case 'i' {
|
|
999
|
-
wr.indent(-1)
|
|
1000
|
-
}
|
|
1001
|
-
case 'op' {
|
|
1002
|
-
def fc:CodeNode (node.getFirst())
|
|
1003
|
-
wr.out(fc.vref false)
|
|
1004
|
-
}
|
|
1005
|
-
}
|
|
1006
|
-
} {
|
|
1007
|
-
if (cmd.value_type == RangerNodeType.String) {
|
|
1008
|
-
wr.out(cmd.string_value false)
|
|
1009
|
-
}
|
|
1010
|
-
}
|
|
1011
|
-
}
|
|
1012
|
-
}
|
|
1013
|
-
fn compile:void (node:CodeNode ctx:RangerAppWriterContext wr:CodeWriter) {
|
|
1014
|
-
}
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
fn findParamDesc@(weak optional):RangerAppParamDesc (obj:CodeNode ctx:RangerAppWriterContext wr:CodeWriter) {
|
|
1018
|
-
def varDesc@(lives):RangerAppParamDesc
|
|
1019
|
-
def set_nsp:boolean false
|
|
1020
|
-
def classDesc@(lives optional):RangerAppClassDesc
|
|
1021
|
-
if (0 == (array_length obj.nsp)) {
|
|
1022
|
-
set_nsp = true
|
|
1023
|
-
}
|
|
1024
|
-
if (obj.vref != "this") {
|
|
1025
|
-
if ((array_length obj.ns) > 1) {
|
|
1026
|
-
def cnt:int (array_length obj.ns)
|
|
1027
|
-
def classRefDesc@(lives):RangerAppParamDesc
|
|
1028
|
-
for obj.ns strname:string i {
|
|
1029
|
-
if (i == 0) {
|
|
1030
|
-
|
|
1031
|
-
if (strname == "this") {
|
|
1032
|
-
classDesc = (ctx.getCurrentClass())
|
|
1033
|
-
if set_nsp {
|
|
1034
|
-
push obj.nsp (unwrap classDesc)
|
|
1035
|
-
}
|
|
1036
|
-
} {
|
|
1037
|
-
if (ctx.isDefinedClass(strname)) {
|
|
1038
|
-
classDesc = (ctx.findClass(strname))
|
|
1039
|
-
if set_nsp {
|
|
1040
|
-
push obj.nsp (unwrap classDesc)
|
|
1041
|
-
}
|
|
1042
|
-
continue _
|
|
1043
|
-
}
|
|
1044
|
-
classRefDesc = (ctx.getVariableDef(strname))
|
|
1045
|
-
if (null? classRefDesc) {
|
|
1046
|
-
ctx.addError(obj ('Error, no description for called object: ' + strname))
|
|
1047
|
-
break _
|
|
1048
|
-
}
|
|
1049
|
-
if set_nsp {
|
|
1050
|
-
push obj.nsp (unwrap classRefDesc)
|
|
1051
|
-
}
|
|
1052
|
-
classRefDesc.ref_cnt = (1 + classRefDesc.ref_cnt)
|
|
1053
|
-
classDesc = (ctx.findClass(classRefDesc.nameNode.type_name))
|
|
1054
|
-
}
|
|
1055
|
-
} {
|
|
1056
|
-
if (i < (cnt - 1)) {
|
|
1057
|
-
varDesc = (classDesc.findVariable(strname))
|
|
1058
|
-
if (null? varDesc) {
|
|
1059
|
-
ctx.addError(obj ('Error, no description for refenced obj: ' + strname))
|
|
1060
|
-
}
|
|
1061
|
-
def subClass:string (varDesc.getTypeName())
|
|
1062
|
-
classDesc = (ctx.findClass(subClass))
|
|
1063
|
-
if set_nsp {
|
|
1064
|
-
push obj.nsp (unwrap varDesc)
|
|
1065
|
-
}
|
|
1066
|
-
continue _
|
|
1067
|
-
}
|
|
1068
|
-
if (!null? classDesc) {
|
|
1069
|
-
varDesc = (classDesc.findVariable(strname))
|
|
1070
|
-
if (null? varDesc) {
|
|
1071
|
-
def classMethod@(lives optional):RangerAppFunctionDesc (classDesc.findMethod(strname))
|
|
1072
|
-
if (null? classMethod) {
|
|
1073
|
-
classMethod = (classDesc.findStaticMethod(strname))
|
|
1074
|
-
if (null? classMethod) {
|
|
1075
|
-
ctx.addError(obj ('variable not found ' + strname))
|
|
1076
|
-
}
|
|
1077
|
-
}
|
|
1078
|
-
if (!null? classMethod) {
|
|
1079
|
-
if set_nsp {
|
|
1080
|
-
push obj.nsp (unwrap classMethod)
|
|
1081
|
-
}
|
|
1082
|
-
return classMethod
|
|
1083
|
-
}
|
|
1084
|
-
}
|
|
1085
|
-
if set_nsp {
|
|
1086
|
-
push obj.nsp (unwrap varDesc)
|
|
1087
|
-
}
|
|
1088
|
-
}
|
|
1089
|
-
}
|
|
1090
|
-
}
|
|
1091
|
-
return varDesc
|
|
1092
|
-
}
|
|
1093
|
-
varDesc = (ctx.getVariableDef(obj.vref))
|
|
1094
|
-
if (!null? varDesc.nameNode) {
|
|
1095
|
-
} {
|
|
1096
|
-
print ('findParamDesc : description not found for ' + obj.vref)
|
|
1097
|
-
if (!null? varDesc) {
|
|
1098
|
-
print ('Vardesc was found though...' + varDesc.name)
|
|
1099
|
-
}
|
|
1100
|
-
ctx.addError(obj ('Error, no description for called object: ' + obj.vref))
|
|
1101
|
-
}
|
|
1102
|
-
return varDesc
|
|
1103
|
-
}
|
|
1104
|
-
def cc@(optional):RangerAppClassDesc (ctx.getCurrentClass())
|
|
1105
|
-
return cc
|
|
1106
|
-
}
|
|
1107
|
-
|
|
1108
|
-
}
|
|
1109
|
-
|