ranger-compiler 2.1.70 → 3.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +103 -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
package/dist/stdops.rgr
ADDED
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
|
|
2
|
+
operators {
|
|
3
|
+
ret _:[T] ( a:[T] ) {
|
|
4
|
+
templates {
|
|
5
|
+
* ( (e 1) )
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
ret _:T ( a:T ) {
|
|
9
|
+
templates {
|
|
10
|
+
* ( (e 1) )
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
defn Print (x) (print '' + x)
|
|
16
|
+
defn Print (x) (print x)
|
|
17
|
+
|
|
18
|
+
defn Range (from to) {
|
|
19
|
+
def res:[int]
|
|
20
|
+
def f from
|
|
21
|
+
while ( f < to ) {
|
|
22
|
+
push res f
|
|
23
|
+
f = f + 1
|
|
24
|
+
}
|
|
25
|
+
ret res
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
defn ForEach (list f) {
|
|
30
|
+
def cnt (size list)
|
|
31
|
+
def i 0
|
|
32
|
+
while(i < cnt) {
|
|
33
|
+
f (at list i)
|
|
34
|
+
i = i + 1
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
defn Compose (f1 f2) (fn:? (x:?) {
|
|
40
|
+
return (f1 ( (f2 (x) ) ) )
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
defn Map ( list f ) {
|
|
44
|
+
def cnt (size list)
|
|
45
|
+
def res:[?]
|
|
46
|
+
def i 0
|
|
47
|
+
while(i < cnt) {
|
|
48
|
+
def myItem (at list i)
|
|
49
|
+
def item ( f myItem )
|
|
50
|
+
push res item
|
|
51
|
+
i = i + 1
|
|
52
|
+
}
|
|
53
|
+
ret res
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
defn Reduce ( list theFn initial) {
|
|
57
|
+
def cnt (size list)
|
|
58
|
+
def acc@(weak temp) initial
|
|
59
|
+
def i 0
|
|
60
|
+
while (i < cnt) {
|
|
61
|
+
def myItem (at list i)
|
|
62
|
+
acc = ( theFn acc myItem )
|
|
63
|
+
i = i + 1
|
|
64
|
+
}
|
|
65
|
+
ret acc
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
defn Reduce ( list2 theFn initial) {
|
|
69
|
+
def cnt (size list2)
|
|
70
|
+
def acc@(weak temp) initial
|
|
71
|
+
def i 0
|
|
72
|
+
while (i < cnt) {
|
|
73
|
+
def myItem (at list2 i)
|
|
74
|
+
acc = ( theFn (acc myItem ) )
|
|
75
|
+
i = i + 1
|
|
76
|
+
}
|
|
77
|
+
ret acc
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
defn Filter ( list f ) {
|
|
81
|
+
def cnt (size list)
|
|
82
|
+
def res:[?]
|
|
83
|
+
def i 0
|
|
84
|
+
while(i < cnt) {
|
|
85
|
+
def myItem (at list i)
|
|
86
|
+
if( f myItem ) {
|
|
87
|
+
push res myItem
|
|
88
|
+
}
|
|
89
|
+
i = i + 1
|
|
90
|
+
}
|
|
91
|
+
ret res
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
defn Filter ( list f ) {
|
|
95
|
+
def cnt (size list)
|
|
96
|
+
def res:[?]
|
|
97
|
+
def i 0
|
|
98
|
+
while(i < cnt) {
|
|
99
|
+
def myItem (at list i)
|
|
100
|
+
if( f (myItem ) ) {
|
|
101
|
+
push res myItem
|
|
102
|
+
}
|
|
103
|
+
i = i + 1
|
|
104
|
+
}
|
|
105
|
+
ret res
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
defn Revert (list) {
|
|
109
|
+
def cnt (size list)
|
|
110
|
+
def i 0
|
|
111
|
+
def end (cnt - 1)
|
|
112
|
+
def res (clone list)
|
|
113
|
+
while(i < end) {
|
|
114
|
+
def v1 (at list i)
|
|
115
|
+
def v2 (at list end)
|
|
116
|
+
set res end v1
|
|
117
|
+
set res i v2
|
|
118
|
+
i = i + 1
|
|
119
|
+
end = end - 1
|
|
120
|
+
}
|
|
121
|
+
ret res
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
defn ForEach (list f) {
|
|
126
|
+
def cnt (size list)
|
|
127
|
+
def i 0
|
|
128
|
+
while(i < cnt) {
|
|
129
|
+
f ( (at list i) )
|
|
130
|
+
i = i + 1
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
defn ForEach (list f) {
|
|
135
|
+
def keyList (keys list)
|
|
136
|
+
def cnt (size keyList)
|
|
137
|
+
def i 0
|
|
138
|
+
while(i < cnt) {
|
|
139
|
+
def k (at keyList i)
|
|
140
|
+
f (unwrap (get list k))
|
|
141
|
+
i = i + 1
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
defn ConCat (left right) {
|
|
146
|
+
def results:[Any]
|
|
147
|
+
forEach left {
|
|
148
|
+
def tmp@(temp) item
|
|
149
|
+
push results tmp
|
|
150
|
+
}
|
|
151
|
+
forEach right {
|
|
152
|
+
def tmp@(temp) item
|
|
153
|
+
push results tmp
|
|
154
|
+
}
|
|
155
|
+
ret results
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
defn ShowAny (anyItem) {
|
|
159
|
+
case anyItem str:string {
|
|
160
|
+
print 'string: ' + str
|
|
161
|
+
}
|
|
162
|
+
case anyItem i:int {
|
|
163
|
+
print " int : " + i
|
|
164
|
+
}
|
|
165
|
+
case anyItem b:boolean {
|
|
166
|
+
print " boolean : " + (? b 'true' 'false')
|
|
167
|
+
}
|
|
168
|
+
}
|
package/package.json
CHANGED
|
@@ -1,39 +1,196 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "ranger-compiler",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "Ranger
|
|
5
|
-
"main": "dist/
|
|
6
|
-
"types": "dist/
|
|
7
|
-
"bin": {
|
|
8
|
-
"ranger-compiler": "
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
"
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
"
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
"
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
"
|
|
38
|
-
|
|
39
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "ranger-compiler",
|
|
3
|
+
"version": "3.0.3",
|
|
4
|
+
"description": "Ranger cross-language compiler - compile once, run anywhere",
|
|
5
|
+
"main": "dist/api.js",
|
|
6
|
+
"types": "dist/api.d.ts",
|
|
7
|
+
"bin": {
|
|
8
|
+
"ranger-compiler": "dist/rgrc.js",
|
|
9
|
+
"rgrc": "dist/rgrc.js"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dist/",
|
|
13
|
+
"README.md",
|
|
14
|
+
"CHANGELOG.md",
|
|
15
|
+
"LICENSE"
|
|
16
|
+
],
|
|
17
|
+
"publishConfig": {
|
|
18
|
+
"access": "public",
|
|
19
|
+
"registry": "https://registry.npmjs.org/"
|
|
20
|
+
},
|
|
21
|
+
"engines": {
|
|
22
|
+
"node": ">=18.0.0"
|
|
23
|
+
},
|
|
24
|
+
"scripts": {
|
|
25
|
+
"build:dist": "npm run compile && npm run build:dist:copy",
|
|
26
|
+
"build:dist:copy": "cp ./bin/output.js ./dist/rgrc.js && cp ./bin/Lang.rgr ./dist/Lang.rgr && cp ./bin/stdops.rgr ./dist/stdops.rgr && cp -r ./lib ./dist/lib",
|
|
27
|
+
"build:dist:module": "node bin/output.js -nodemodule -es6 -typescript ./compiler/ng_Compiler.rgr -d=./compiler/bin -o=api.ts && tsc --declaration --module commonjs --target es2015 --moduleResolution node --outDir ./dist ./compiler/bin/api.ts",
|
|
28
|
+
"prepublishOnly": "npm run build:dist && npm test",
|
|
29
|
+
"test-any-ts": "node bin/testcomp.js ./features/any/test_any.rgr -es6 -typescript",
|
|
30
|
+
"test-any-csharp": "node bin/testcomp.js ./features/any/test_any.rgr -l=csharp",
|
|
31
|
+
"test-any": "npm run testcompiler && node bin/testcomp.js -es6 ./features/any/test_any.rgr -es6 -o=test_any.js",
|
|
32
|
+
"example-svgpath": "rgrc -es6 ./examples/SVGPath/SVGPath.rgr -es6 -typescript -o=SVGPath.ts",
|
|
33
|
+
"testcompiler": "rgrc -es6 ./compiler/ng_Compiler.rgr -nodecli -d=./bin -o=testcomp.js",
|
|
34
|
+
"compileg": "rgrc -es6 ./compiler/ng_Compiler.rgr -nodecli",
|
|
35
|
+
"compile": "cross-env RANGER_LIB=./compiler/Lang.rgr:./lib/stdops.rgr node bin/output.js -es6 ./compiler/ng_Compiler.rgr -nodecli -d=./bin -o=output.js && npm run compile:fixcrlf && npm run compile:copylibs",
|
|
36
|
+
"compile:fixcrlf": "sed -i '' 's/\\r$//' bin/output.js || sed -i 's/\\r$//' bin/output.js || true",
|
|
37
|
+
"compile:copylibs": "cp ./compiler/Lang.rgr ./bin/Lang.rgr && cp ./lib/stdops.rgr ./bin/stdops.rgr",
|
|
38
|
+
"compile:win": "cross-env RANGER_LIB=./compiler/Lang.rgr;./lib/stdops.rgr node bin/output.js -es6 ./compiler/ng_Compiler.rgr -nodecli -d=./bin -o=output.js && copy .\\compiler\\Lang.rgr .\\bin\\Lang.rgr && copy .\\lib\\stdops.rgr .\\bin\\stdops.rgr",
|
|
39
|
+
"compile:langserver": "cross-env RANGER_LIB=./compiler/Lang.rgr:./lib/stdops.rgr node bin/output.js -es6 -nodemodule ./compiler/VirtualCompiler.rgr -d=./ranger-vscode-extension/compiler -o=output.js",
|
|
40
|
+
"test:error": "node bin/output.js ./tests/cli/test_error.rgr -o=test_error.js",
|
|
41
|
+
"try": "node bin/output.js -es6 ./compiler/ng_Compiler.rgr -nodecli -o=try.js",
|
|
42
|
+
"compilets": "node bin/output.js -es6 -typescript ./compiler/ng_Compiler.rgr -d=./compiler/bin -o=compiler.ts -nodecli && tsc --module commonjs --target es2015 --moduleResolution node --outDir ./dist ./compiler/bin/compiler.ts",
|
|
43
|
+
"module": "npm run build:dist:module",
|
|
44
|
+
"evalvalue:module": "cross-env RANGER_LIB=./compiler/Lang.rgr node bin/output.js -es6 -nodemodule ./gallery/pdf_writer/src/tools/eval_value_module.rgr -d=./gallery/pdf_writer/bin -o=eval_value_module.cjs",
|
|
45
|
+
"test:evalvalue": "npm run evalvalue:module && vitest run --config gallery/pdf_writer/vitest.config.js",
|
|
46
|
+
"test": "cross-env NODE_OPTIONS=--max-old-space-size=8192 vitest run --config tests/vitest.config.ts",
|
|
47
|
+
"test:es6": "vitest run --config tests/vitest.config.ts compiler.test.ts",
|
|
48
|
+
"test:go": "vitest run --config tests/vitest.config.ts compiler-go.test.ts",
|
|
49
|
+
"test:python": "vitest run --config tests/vitest.config.ts compiler-python.test.ts",
|
|
50
|
+
"test:rust": "vitest run --config tests/vitest.config.ts compiler-rust.test.ts",
|
|
51
|
+
"test:kotlin": "vitest run --config tests/vitest.config.ts compiler-kotlin.test.ts",
|
|
52
|
+
"test:tsparser": "cross-env NODE_OPTIONS=--max-old-space-size=8192 vitest run --config tests/vitest.config.ts ts-lexer.test.ts",
|
|
53
|
+
"test:watch": "vitest --config tests/vitest.config.ts",
|
|
54
|
+
"gen:simple": "cross-env RANGER_LIB=./compiler/Lang.rgr node bin/output.js -es6 ./generated/SimpleChessBoard.rgr -d=./generated/output -o=SimpleChessBoard.js -nodecli",
|
|
55
|
+
"gen:simple:run": "npm run gen:simple && node ./generated/output/SimpleChessBoard.js",
|
|
56
|
+
"gen:chess": "cross-env RANGER_LIB=./compiler/Lang.rgr node bin/output.js -es6 ./generated/ChessBoard.rgr -d=./generated/output -o=ChessBoard.js -nodecli",
|
|
57
|
+
"gen:chess:run": "npm run gen:chess && node ./generated/output/ChessBoard.js",
|
|
58
|
+
"gen:chess:rust": "cross-env RANGER_LIB=./compiler/Lang.rgr node bin/output.js -l=rust ./generated/ChessBoard.rgr -d=./generated/bin -o=chessboard.rs -nodecli",
|
|
59
|
+
"gen:chess:rust:build": "npm run gen:chess:rust && rustc ./generated/bin/chessboard.rs -o ./generated/bin/chessboard.exe",
|
|
60
|
+
"gen:chess:rust:run": "npm run gen:chess:rust:build && ./generated/bin/chessboard.exe",
|
|
61
|
+
"gen:chess:swift": "cross-env RANGER_LIB=./compiler/Lang.rgr node bin/output.js -l=swift3 ./generated/ChessBoard.rgr -d=./generated/bin -o=chessboard.swift -nodecli",
|
|
62
|
+
"gen:all": "npm run gen:simple && npm run gen:chess",
|
|
63
|
+
"gen:test": "npm run gen:simple:run",
|
|
64
|
+
"game:compile": "cross-env RANGER_LIB=./compiler/Lang.rgr:./lib/stdops.rgr node bin/output.js -es6 ./gallery/invaders/invaders.rgr -d=./gallery/invaders -o=invaders.js -nodecli",
|
|
65
|
+
"game:compile:rust": "cross-env RANGER_LIB=./compiler/Lang.rgr:./lib/stdops.rgr node bin/output.js -l=rust ./gallery/invaders/invaders.rgr -d=./gallery/invaders -o=invaders.rs -nodecli",
|
|
66
|
+
"game:compile:go": "cross-env RANGER_LIB=./compiler/Lang.rgr:./lib/stdops.rgr node bin/output.js -l=go ./gallery/invaders/invaders.rgr -d=./gallery/invaders -o=invaders.go -nodecli",
|
|
67
|
+
"game:compile:swift": "cross-env RANGER_LIB=./compiler/Lang.rgr:./lib/stdops.rgr node bin/output.js -l=swift6 ./gallery/invaders/invaders.rgr -d=./gallery/invaders -o=invaders.swift -nodecli",
|
|
68
|
+
"game:compile:cpp": "cross-env RANGER_LIB=./compiler/Lang.rgr:./lib/stdops.rgr node bin/output.js -l=cpp ./gallery/invaders/invaders.rgr -d=./gallery/invaders -o=invaders.cpp -nodecli",
|
|
69
|
+
"game:compile:kotlin": "cross-env RANGER_LIB=./compiler/Lang.rgr:./lib/stdops.rgr node bin/output.js -l=kotlin ./gallery/invaders/invaders.rgr -d=./gallery/invaders -o=invaders.kt -nodecli",
|
|
70
|
+
"game:compile:python": "cross-env RANGER_LIB=./compiler/Lang.rgr:./lib/stdops.rgr node bin/output.js -l=python ./gallery/invaders/invaders.rgr -d=./gallery/invaders -o=invaders.py -nodecli",
|
|
71
|
+
"game:build:rust": "npm run game:compile:rust && rustc gallery/invaders/invaders.rs -o gallery/invaders/invaders_rust.exe",
|
|
72
|
+
"game:build:go": "npm run game:compile:go && cd gallery/invaders && go build -o invaders_go.exe invaders.go",
|
|
73
|
+
"game:build:swift": "npm run game:compile:swift && swiftc -parse-as-library gallery/invaders/invaders.swift -o gallery/invaders/invaders_swift.exe",
|
|
74
|
+
"game:build:cpp": "npm run game:compile:cpp && g++ -std=c++17 -pthread gallery/invaders/invaders.cpp -o gallery/invaders/invaders_cpp.exe",
|
|
75
|
+
"game:build:kotlin": "npm run game:compile:kotlin && kotlinc gallery/invaders/invaders.kt -include-runtime -d gallery/invaders/invaders.jar",
|
|
76
|
+
"game:build:all": "npm run game:compile && npm run game:build:rust && npm run game:build:go",
|
|
77
|
+
"game:run": "node ./gallery/invaders/invaders.js",
|
|
78
|
+
"game:run:rust": "./gallery/invaders/invaders_rust.exe",
|
|
79
|
+
"game:run:go": "./gallery/invaders/invaders_go.exe",
|
|
80
|
+
"game:run:swift": "./gallery/invaders/invaders_swift.exe",
|
|
81
|
+
"game:run:cpp": "./gallery/invaders/invaders_cpp.exe",
|
|
82
|
+
"game:run:kotlin": "java -jar ./gallery/invaders/invaders.jar",
|
|
83
|
+
"game": "npm run game:compile && npm run game:run",
|
|
84
|
+
"jsparser:compile": "cross-env RANGER_LIB=./compiler/Lang.rgr node bin/output.js -es6 ./gallery/js_parser/js_parser_main.rgr -d=./gallery/js_parser -o=js_parser.js -nodecli",
|
|
85
|
+
"jsparser:compile:cpp": "cross-env RANGER_LIB=./compiler/Lang.rgr node bin/output.js -l=cpp ./gallery/js_parser/js_parser_main.rgr -d=./gallery/js_parser -o=js_parser -nodecli",
|
|
86
|
+
"jsparser:compile:swift": "cross-env RANGER_LIB=./compiler/Lang.rgr node bin/output.js -l=swift6 ./gallery/js_parser/js_parser_main.rgr -d=./gallery/js_parser -o=js_parser -nodecli",
|
|
87
|
+
"jsparser:compile:go": "cross-env RANGER_LIB=./compiler/Lang.rgr node bin/output.js -l=go ./gallery/js_parser/js_parser_main.rgr -d=./gallery/js_parser -o=js_parser.js -nodecli",
|
|
88
|
+
"jsparser:module": "cross-env RANGER_LIB=./compiler/Lang.rgr node bin/output.js -es6 -nodemodule ./gallery/js_parser/js_parser_main.rgr -d=./gallery/js_parser/benchmark -o=js_parser_module.cjs",
|
|
89
|
+
"jsparser:compile:rust": "cross-env RANGER_LIB=./compiler/Lang.rgr node bin/output.js -l=rust ./gallery/js_parser/js_parser_main.rgr -d=./gallery/js_parser -o=js_parser -nodecli",
|
|
90
|
+
"jsparser:build:rust": "npm run jsparser:compile:rust && rustc -O gallery/js_parser/js_parser.rs -o gallery/js_parser/js_parser_rust.exe",
|
|
91
|
+
"jsparser:build:cpp": "wsl x86_64-w64-mingw32-g++-posix -std=c++17 -static -O3 gallery/js_parser/js_parser.cpp -o gallery/js_parser/js_parser_cpp.exe",
|
|
92
|
+
"jsparser:build:swift": "swiftc -O -parse-as-library gallery/js_parser/js_parser.swift -o gallery/js_parser/js_parser_swift.exe",
|
|
93
|
+
"jsparser:compile:all": "npm run jsparser:compile:cpp && npm run jsparser:compile:rust && npm run jsparser:compile:swift",
|
|
94
|
+
"jsparser:build:all": "npm run jsparser:compile:all && npm run jsparser:build:cpp && npm run jsparser:build:rust && npm run jsparser:build:swift",
|
|
95
|
+
"jsparser:run": "node ./gallery/js_parser/js_parser.js",
|
|
96
|
+
"jsparser:run:rust": "./gallery/js_parser/js_parser_rust",
|
|
97
|
+
"jsparser:test": "node ./gallery/js_parser/js_parser.js ./gallery/js_parser/test.js",
|
|
98
|
+
"jsparser": "npm run jsparser:compile && npm run jsparser:run",
|
|
99
|
+
"tsparser:compile": "cross-env RANGER_LIB=./compiler/Lang.rgr node bin/output.js -es6 ./gallery/ts_parser/ts_parser_main.rgr -d=./gallery/ts_parser/bin -o=ts_parser_main.js -nodecli",
|
|
100
|
+
"tsparser:compile:rust": "cross-env RANGER_LIB=./compiler/Lang.rgr node bin/output.js -l=rust ./gallery/ts_parser/ts_parser_main.rgr -d=./gallery/ts_parser/bin -o=ts_parser_main.rs -nodecli",
|
|
101
|
+
"tsparser:compile:go": "cross-env RANGER_LIB=./compiler/Lang.rgr node bin/output.js -l=go ./gallery/ts_parser/ts_parser_main.rgr -d=./gallery/ts_parser/bin -o=ts_parser_main.go -nodecli",
|
|
102
|
+
"tsparser:compile:swift": "cross-env RANGER_LIB=./compiler/Lang.rgr node bin/output.js -l=swift6 ./gallery/ts_parser/ts_parser_main.rgr -d=./gallery/ts_parser/bin -o=ts_parser_main.swift -nodecli",
|
|
103
|
+
"tsparser:compile:cpp": "cross-env RANGER_LIB=./compiler/Lang.rgr node bin/output.js -l=cpp ./gallery/ts_parser/ts_parser_main.rgr -d=./gallery/ts_parser/bin -o=ts_parser_main.cpp -nodecli",
|
|
104
|
+
"tsparser:compile:all": "npm run tsparser:compile && npm run tsparser:compile:rust && npm run tsparser:compile:go && npm run tsparser:compile:swift && npm run tsparser:compile:cpp",
|
|
105
|
+
"tsparser:module": "cross-env RANGER_LIB=./compiler/Lang.rgr node bin/output.js -es6 -nodemodule ./gallery/ts_parser/ts_parser_main.rgr -d=./gallery/ts_parser/benchmark -o=ts_parser_module.cjs",
|
|
106
|
+
"tsparser:module:esm": "cross-env RANGER_LIB=./compiler/Lang.rgr node bin/output.js -es6 -esm ./gallery/ts_parser/ts_parser_main.rgr -d=./gallery/ts_parser/benchmark -o=ts_parser_module.mjs",
|
|
107
|
+
"tsparser:build:rust": "npm run tsparser:compile:rust && rustc -O gallery/ts_parser/bin/ts_parser_main.rs -o gallery/ts_parser/bin/ts_parser_rust.exe",
|
|
108
|
+
"tsparser:build:go": "npm run tsparser:compile:go && cd gallery/ts_parser/bin && go build -o ts_parser_go.exe ts_parser_main.go",
|
|
109
|
+
"tsparser:build:swift": "npm run tsparser:compile:swift && swiftc -O -parse-as-library gallery/ts_parser/bin/ts_parser_main.swift -o gallery/ts_parser/bin/ts_parser_swift.exe",
|
|
110
|
+
"tsparser:build:cpp": "npm run tsparser:compile:cpp && wsl g++ -std=c++17 -O2 -o gallery/ts_parser/bin/ts_parser_cpp.exe gallery/ts_parser/bin/ts_parser_main.cpp",
|
|
111
|
+
"tsparser:benchmark": "npm run tsparser:module && cd gallery/ts_parser/benchmark && npm run benchmark",
|
|
112
|
+
"tsparser:run": "node ./gallery/ts_parser/bin/ts_parser_main.js -d",
|
|
113
|
+
"tsparser:run:rust": "./gallery/ts_parser/bin/ts_parser_rust.exe -d",
|
|
114
|
+
"tsparser": "npm run tsparser:compile && npm run tsparser:run",
|
|
115
|
+
"pdf:compile": "cross-env RANGER_LIB=./compiler/Lang.rgr node bin/output.js -es6 ./gallery/pdf_writer/src/core/PDFWriter.rgr -d=./gallery/pdf_writer/bin -o=pdf_writer.js -nodecli",
|
|
116
|
+
"pdf:run": "node ./gallery/pdf_writer/bin/pdf_writer.js",
|
|
117
|
+
"pdf": "npm run pdf:compile && npm run pdf:run",
|
|
118
|
+
"jpegmeta:compile": "cross-env RANGER_LIB=./compiler/Lang.rgr node bin/output.js -es6 ./gallery/pdf_writer/src/jpeg/JPEGMetadata.rgr -d=./gallery/pdf_writer/bin -o=jpeg_metadata.js -nodecli",
|
|
119
|
+
"jpegmeta:run": "node ./gallery/pdf_writer/bin/jpeg_metadata.js",
|
|
120
|
+
"jpegmeta": "npm run jpegmeta:compile && npm run jpegmeta:run",
|
|
121
|
+
"jpegdec:compile": "cross-env RANGER_LIB=./compiler/Lang.rgr node bin/output.js -es6 ./gallery/pdf_writer/src/tools/jpeg_decoder_test.rgr -d=./gallery/pdf_writer/bin -o=jpeg_decoder_test.js -nodecli",
|
|
122
|
+
"jpegdec:run": "node ./gallery/pdf_writer/bin/jpeg_decoder_test.js",
|
|
123
|
+
"jpegdec": "npm run jpegdec:compile && npm run jpegdec:run",
|
|
124
|
+
"jpegenc:compile": "cross-env RANGER_LIB=./compiler/Lang.rgr node bin/output.js -es6 ./gallery/pdf_writer/src/tools/jpeg_encoder_test.rgr -d=./gallery/pdf_writer/bin -o=jpeg_encoder_test.js -nodecli",
|
|
125
|
+
"jpegenc:run": "node ./gallery/pdf_writer/bin/jpeg_encoder_test.js",
|
|
126
|
+
"jpegenc": "npm run jpegenc:compile && npm run jpegenc:run",
|
|
127
|
+
"exif:compile": "cross-env RANGER_LIB=./compiler/Lang.rgr node bin/output.js -es6 ./gallery/pdf_writer/src/tools/exif_orientation_test.rgr -d=./gallery/pdf_writer/bin -o=exif_orientation_test.js -nodecli",
|
|
128
|
+
"exif:run": "node ./gallery/pdf_writer/bin/exif_orientation_test.js",
|
|
129
|
+
"exif": "npm run exif:compile && npm run exif:run",
|
|
130
|
+
"jpegscaler:compile:go": "cross-env RANGER_LIB=./compiler/Lang.rgr node bin/output.js -l=go ./gallery/pdf_writer/src/tools/jpeg_scaler.rgr -d=./gallery/pdf_writer/bin -o=jpeg_scaler.go -nodecli",
|
|
131
|
+
"jpegscaler:build:go": "npm run jpegscaler:compile:go && cd gallery/pdf_writer/bin && go build -o jpeg_scaler.exe jpeg_scaler.go",
|
|
132
|
+
"zip:compile": "cross-env RANGER_LIB=./compiler/Lang.rgr node bin/output.js -es6 ./gallery/zip/zip_tool.rgr -d=./gallery/zip/bin -o=zip_tool.js -nodecli",
|
|
133
|
+
"zip:run": "node ./gallery/zip/bin/zip_tool.js",
|
|
134
|
+
"zip": "npm run zip:compile && npm run zip:run",
|
|
135
|
+
"evg:compile": "cross-env RANGER_LIB=./compiler/Lang.rgr node bin/output.js -es6 ./gallery/evg/evg_test.rgr -d=./gallery/evg/bin -o=evg_test.js -nodecli",
|
|
136
|
+
"evg:run": "node ./gallery/evg/bin/evg_test.js",
|
|
137
|
+
"evg": "npm run evg:compile && npm run evg:run",
|
|
138
|
+
"evgpdf:compile": "cross-env RANGER_LIB=./compiler/Lang.rgr node bin/output.js -es6 ./gallery/pdf_writer/src/tools/evg_pdf_tool.rgr -d=./gallery/pdf_writer/bin -o=evg_pdf_tool.js -nodecli",
|
|
139
|
+
"evgpdf:compile:go": "cross-env RANGER_LIB=./compiler/Lang.rgr node bin/output.js -l=go ./gallery/pdf_writer/src/tools/evg_pdf_tool.rgr -d=./gallery/pdf_writer/bin -o=evg_pdf_tool.go -nodecli",
|
|
140
|
+
"evgpdf:build:go": "npm run evgpdf:compile:go && cd gallery/pdf_writer/bin && go build -o evg_pdf_tool.exe evg_pdf_tool.go",
|
|
141
|
+
"evgpdf:run": "node ./gallery/pdf_writer/bin/evg_pdf_tool.js ./gallery/pdf_writer/examples/test_simple.tsx ./gallery/pdf_writer/output/pdfs/sample_output.pdf",
|
|
142
|
+
"evgpdf:test": "npm run evgpdf:compile && npm run evgpdf:run",
|
|
143
|
+
"evgpdf": "npm run evgpdf:compile && npm run evgpdf:run",
|
|
144
|
+
"evghtml:compile": "cross-env RANGER_LIB=./compiler/Lang.rgr node bin/output.js -es6 ./gallery/pdf_writer/src/tools/evg_html_tool.rgr -d=./gallery/pdf_writer/bin -o=evg_html_tool.js -nodecli",
|
|
145
|
+
"evghtml:run": "node ./gallery/pdf_writer/bin/evg_html_tool.js ./gallery/pdf_writer/examples/test_simple.tsx ./gallery/pdf_writer/output/html/sample_output.html",
|
|
146
|
+
"evghtml:test": "npm run evghtml:compile && npm run evghtml:run",
|
|
147
|
+
"evghtml": "npm run evghtml:compile && npm run evghtml:run",
|
|
148
|
+
"evgpreview:compile": "cross-env RANGER_LIB=./compiler/Lang.rgr node bin/output.js -l=go ./gallery/pdf_writer/src/tools/evg_preview_server.rgr -d=./gallery/pdf_writer/bin -o=evg_preview_server.go -nodecli",
|
|
149
|
+
"evgpreview:build": "npm run evgpreview:compile && cd gallery/pdf_writer/bin && go build -o evg_preview_server evg_preview_server.go",
|
|
150
|
+
"evgpreview:start": "./gallery/pdf_writer/bin/evg_preview_server",
|
|
151
|
+
"pdf-tool:module": "cross-env RANGER_LIB=./compiler/Lang.rgr node bin/output.js -es6 -nodemodule ./gallery/pdf_writer/src/lib/ranger_pdf_tool.rgr -d=./gallery/pdf_writer/dist -o=ranger_pdf_tool.js",
|
|
152
|
+
"pdf-tool:cli:pdf": "cross-env RANGER_LIB=./compiler/Lang.rgr node bin/output.js -es6 ./gallery/pdf_writer/src/tools/evg_pdf_tool.rgr -d=./gallery/pdf_writer/bin -o=evg_pdf_tool.js -nodecli",
|
|
153
|
+
"pdf-tool:cli:html": "cross-env RANGER_LIB=./compiler/Lang.rgr node bin/output.js -es6 ./gallery/pdf_writer/src/tools/evg_html_tool.rgr -d=./gallery/pdf_writer/bin -o=evg_html_tool.js -nodecli",
|
|
154
|
+
"pdf-tool:cli:png": "cross-env RANGER_LIB=./compiler/Lang.rgr node bin/output.js -es6 ./gallery/pdf_writer/src/tools/evg_png_tool.rgr -d=./gallery/pdf_writer/bin -o=evg_png_tool.js -nodecli",
|
|
155
|
+
"pdf-tool:server": "cross-env RANGER_LIB=./compiler/Lang.rgr node bin/output.js -es6 ./gallery/pdf_writer/src/lib/express_preview_server.rgr -d=./gallery/pdf_writer/bin -o=evg_preview_server.js -nodecli",
|
|
156
|
+
"pdf-tool:build": "npm run pdf-tool:module && npm run pdf-tool:cli:pdf && npm run pdf-tool:cli:html && npm run pdf-tool:server",
|
|
157
|
+
"evgpreview": "npm run evgpreview:build && npm run evgpreview:start",
|
|
158
|
+
"evgcomp:compile": "cross-env RANGER_LIB=./compiler/Lang.rgr node bin/output.js -es6 ./gallery/pdf_writer/src/tools/evg_component_tool.rgr -d=./gallery/pdf_writer/bin -o=evg_component_tool.js -nodecli",
|
|
159
|
+
"evgcomp:compile:go": "cross-env RANGER_LIB=./compiler/Lang.rgr node bin/output.js -l=go ./gallery/pdf_writer/src/tools/evg_component_tool.rgr -d=./gallery/pdf_writer/bin -o=evg_component_tool.go -nodecli",
|
|
160
|
+
"evgcomp:build:go": "npm run evgcomp:compile:go && cd gallery/pdf_writer/bin && go build -o evg_component_tool.exe evg_component_tool.go",
|
|
161
|
+
"evgcomp:compile:rust": "cross-env RANGER_LIB=./compiler/Lang.rgr node bin/output.js -l=rust ./gallery/pdf_writer/src/tools/evg_component_tool.rgr -d=./gallery/pdf_writer/bin -o=evg_component_tool.rs -nodecli",
|
|
162
|
+
"evgcomp:build:rust": "npm run evgcomp:compile:rust && cd gallery/pdf_writer/bin && rustc -O -o evg_component_tool_rust.exe evg_component_tool.rs",
|
|
163
|
+
"evgcomp:compile:cpp": "cross-env RANGER_LIB=./compiler/Lang.rgr node bin/output.js -l=cpp ./gallery/pdf_writer/src/tools/evg_component_tool.rgr -d=./gallery/pdf_writer/bin -o=evg_component_tool.cpp -nodecli",
|
|
164
|
+
"evgcomp:build:cpp": "npm run evgcomp:compile:cpp && wsl x86_64-w64-mingw32-g++-posix -std=c++17 -static -O3 gallery/pdf_writer/bin/evg_component_tool.cpp -o gallery/pdf_writer/bin/evg_component_tool_cpp.exe",
|
|
165
|
+
"evgcomp:run": "node ./gallery/pdf_writer/bin/evg_component_tool.js ./gallery/pdf_writer/examples/test_component_simple.tsx ./gallery/pdf_writer/output/pdfs/component_output.pdf",
|
|
166
|
+
"evgcomp:test": "npm run evgcomp:compile && npm run evgcomp:run",
|
|
167
|
+
"evgcomp": "npm run evgcomp:compile && npm run evgcomp:run",
|
|
168
|
+
"evg:tool:compile": "cross-env RANGER_LIB=./compiler/Lang.rgr node bin/output.js -es6 ./gallery/pdf_writer/src/tools/evg_tool.rgr -d=./gallery/pdf_writer/bin -o=evg_tool.js -nodecli",
|
|
169
|
+
"evg:tool:compile:go": "cross-env RANGER_LIB=./compiler/Lang.rgr node bin/output.js -l=go ./gallery/pdf_writer/src/tools/evg_tool.rgr -d=./gallery/pdf_writer/bin -o=evg_tool.go -nodecli",
|
|
170
|
+
"evg:tool:build:go": "npm run evg:tool:compile:go && cd gallery/pdf_writer/bin && go build -o evg_tool evg_tool.go",
|
|
171
|
+
"evg:tool:run": "node ./gallery/pdf_writer/bin/evg_tool.js",
|
|
172
|
+
"evg:tool": "npm run evg:tool:compile && npm run evg:tool:run",
|
|
173
|
+
"font:compile": "cross-env RANGER_LIB=./compiler/Lang.rgr node bin/output.js -es6 ./gallery/pdf_writer/src/tools/font_test.rgr -d=./gallery/pdf_writer/bin -o=font_test.js -nodecli",
|
|
174
|
+
"font:run": "node ./gallery/pdf_writer/bin/font_test.js",
|
|
175
|
+
"font": "npm run font:compile && npm run font:run"
|
|
176
|
+
},
|
|
177
|
+
"repository": {
|
|
178
|
+
"type": "git",
|
|
179
|
+
"url": "git+https://github.com/terotests/Ranger.git"
|
|
180
|
+
},
|
|
181
|
+
"keywords": [
|
|
182
|
+
"Compiler"
|
|
183
|
+
],
|
|
184
|
+
"author": "Tero Tolonen",
|
|
185
|
+
"license": "MIT",
|
|
186
|
+
"bugs": {
|
|
187
|
+
"url": "https://github.com/terotests/Ranger/issues"
|
|
188
|
+
},
|
|
189
|
+
"homepage": "https://github.com/terotests/Ranger#readme",
|
|
190
|
+
"devDependencies": {
|
|
191
|
+
"@types/node": "^22.19.2",
|
|
192
|
+
"cross-env": "^10.1.0",
|
|
193
|
+
"typescript": "^5.9.3",
|
|
194
|
+
"vitest": "^1.6.0"
|
|
195
|
+
}
|
|
196
|
+
}
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
#include <memory>
|
|
2
|
-
#include "variant.hpp"
|
|
3
|
-
#include <string>
|
|
4
|
-
#include <vector>
|
|
5
|
-
#include <sstream>
|
|
6
|
-
#include <iterator>
|
|
7
|
-
#include <functional>
|
|
8
|
-
#include <iostream>
|
|
9
|
-
|
|
10
|
-
// define classes here to avoid compiler errors
|
|
11
|
-
class day_one;
|
|
12
|
-
class operatorsOf;
|
|
13
|
-
|
|
14
|
-
typedef mpark::variant<std::shared_ptr<day_one>, int, std::string, bool, double> r_union_Any;
|
|
15
|
-
|
|
16
|
-
std::vector<std::string> r_str_split(std::string data, std::string token) {
|
|
17
|
-
std::vector<std::string> output;
|
|
18
|
-
size_t pos = std::string::npos;
|
|
19
|
-
if(token.length() == 0) {
|
|
20
|
-
for(std::string::iterator it = data.begin(); it != data.end(); ++it) {
|
|
21
|
-
output.push_back( std::string( it, it + 1) );
|
|
22
|
-
}
|
|
23
|
-
return output;
|
|
24
|
-
}
|
|
25
|
-
do
|
|
26
|
-
{
|
|
27
|
-
pos = data.find(token);
|
|
28
|
-
output.push_back(data.substr(0, pos));
|
|
29
|
-
if (std::string::npos != pos)
|
|
30
|
-
data = data.substr(pos + token.size());
|
|
31
|
-
} while (std::string::npos != pos);
|
|
32
|
-
return output;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
template <class T>
|
|
37
|
-
class r_optional_primitive {
|
|
38
|
-
public:
|
|
39
|
-
bool has_value;
|
|
40
|
-
T value;
|
|
41
|
-
r_optional_primitive<T> & operator=(const r_optional_primitive<T> & rhs) {
|
|
42
|
-
has_value = rhs.has_value;
|
|
43
|
-
value = rhs.value;
|
|
44
|
-
return *this;
|
|
45
|
-
}
|
|
46
|
-
r_optional_primitive<T> & operator=(const T a_value) {
|
|
47
|
-
has_value = true;
|
|
48
|
-
value = a_value;
|
|
49
|
-
return *this;
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
r_optional_primitive<int> cpp_str_to_int(std::string s) {
|
|
54
|
-
r_optional_primitive<int> result;
|
|
55
|
-
try {
|
|
56
|
-
result.value = std::stoi(s);
|
|
57
|
-
result.has_value = true;
|
|
58
|
-
} catch (...) {
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
return result;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// header definitions
|
|
65
|
-
class day_one : public std::enable_shared_from_this<day_one> {
|
|
66
|
-
public :
|
|
67
|
-
/* class constructor */
|
|
68
|
-
day_one( );
|
|
69
|
-
/* static methods */
|
|
70
|
-
static void main();
|
|
71
|
-
};
|
|
72
|
-
class operatorsOf : public std::enable_shared_from_this<operatorsOf> {
|
|
73
|
-
public :
|
|
74
|
-
/* class constructor */
|
|
75
|
-
operatorsOf( );
|
|
76
|
-
/* static methods */
|
|
77
|
-
static std::vector<int> map_2( std::vector<std::string> __self , std::function<int(std::string, int)> cb );
|
|
78
|
-
static int reduce_3( std::vector<int> __self , std::function<int(int, int, int)> cb , int initialValue );
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
int __g_argc;
|
|
82
|
-
char **__g_argv;
|
|
83
|
-
day_one::day_one( ) {
|
|
84
|
-
}
|
|
85
|
-
int main(int argc, char* argv[]) {
|
|
86
|
-
__g_argc = argc;
|
|
87
|
-
__g_argv = argv;
|
|
88
|
-
std::string data = std::string("428122498997587283996116951397957933569136949848379417125362532269869461185743113733992331379856446362482129646556286611543756564275715359874924898113424472782974789464348626278532936228881786273586278886575828239366794429223317476722337424399239986153675275924113322561873814364451339186918813451685263192891627186769818128715595715444565444581514677521874935942913547121751851631373316122491471564697731298951989511917272684335463436218283261962158671266625299188764589814518793576375629163896349665312991285776595142146261792244475721782941364787968924537841698538288459355159783985638187254653851864874544584878999193242641611859756728634623853475638478923744471563845635468173824196684361934269459459124269196811512927442662761563824323621758785866391424778683599179447845595931928589255935953295111937431266815352781399967295389339626178664148415561175386725992469782888757942558362117938629369129439717427474416851628121191639355646394276451847131182652486561415942815818785884559193483878139351841633366398788657844396925423217662517356486193821341454889283266691224778723833397914224396722559593959125317175899594685524852419495793389481831354787287452367145661829287518771631939314683137722493531318181315216342994141683484111969476952946378314883421677952397588613562958741328987734565492378977396431481215983656814486518865642645612413945129485464979535991675776338786758997128124651311153182816188924935186361813797251997643992686294724699281969473142721116432968216434977684138184481963845141486793996476793954226225885432422654394439882842163295458549755137247614338991879966665925466545111899714943716571113326479432925939227996799951279485722836754457737668191845914566732285928453781818792236447816127492445993945894435692799839217467253986218213131249786833333936332257795191937942688668182629489191693154184177398186462481316834678733713614889439352976144726162214648922159719979143735815478633912633185334529484779322818611438194522292278787653763328944421516569181178517915745625295158611636365253948455727653672922299582352766484");
|
|
89
|
-
std::vector<int> values = operatorsOf::map_2((r_str_split( data, std::string(""))), [&](std::string item, int index) mutable {
|
|
90
|
-
return /*unwrap int*/(cpp_str_to_int(item)).value;
|
|
91
|
-
});
|
|
92
|
-
std::function<int(std::vector<int>, int)> random_ch = [&](std::vector<int> list, int index) mutable {
|
|
93
|
-
if ( index >= ((int)(list.size())) ) {
|
|
94
|
-
return list.at(0);
|
|
95
|
-
}
|
|
96
|
-
return list.at(index);
|
|
97
|
-
};
|
|
98
|
-
std::cout << std::to_string(operatorsOf::reduce_3(values, [&](int left, int right, int index) mutable {
|
|
99
|
-
return ((right == random_ch(values, (index + 1))) ? (left + right) : left);
|
|
100
|
-
}, 0)) << std::endl;
|
|
101
|
-
return 0;
|
|
102
|
-
}
|
|
103
|
-
operatorsOf::operatorsOf( ) {
|
|
104
|
-
}
|
|
105
|
-
std::vector<int> operatorsOf::map_2( std::vector<std::string> __self , std::function<int(std::string, int)> cb ) {
|
|
106
|
-
/** unused: int __len = (int)(__self.size()) **/ ;
|
|
107
|
-
std::vector<int> res;
|
|
108
|
-
for ( int i = 0; i != (int)(__self.size()); i++) {
|
|
109
|
-
std::string it = __self.at(i);
|
|
110
|
-
res.push_back( cb(it, i) );
|
|
111
|
-
}
|
|
112
|
-
return res;
|
|
113
|
-
}
|
|
114
|
-
int operatorsOf::reduce_3( std::vector<int> __self , std::function<int(int, int, int)> cb , int initialValue ) {
|
|
115
|
-
int len_1 = (int)(__self.size());
|
|
116
|
-
int res_1 = initialValue;
|
|
117
|
-
if ( len_1 >= 1 ) {
|
|
118
|
-
for ( int i_1 = 0; i_1 != (int)(__self.size()); i_1++) {
|
|
119
|
-
int it_1 = __self.at(i_1);
|
|
120
|
-
res_1 = cb(res_1, it_1, i_1);
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
return res_1;
|
|
124
|
-
}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
package main
|
|
2
|
-
import (
|
|
3
|
-
"strings"
|
|
4
|
-
"strconv"
|
|
5
|
-
"fmt"
|
|
6
|
-
)
|
|
7
|
-
|
|
8
|
-
type GoNullable struct {
|
|
9
|
-
value interface{}
|
|
10
|
-
has_value bool
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
func r_str_2_i64(s string) *GoNullable {
|
|
15
|
-
res := new(GoNullable);
|
|
16
|
-
if v, err := strconv.ParseInt(s, 10, 64); err == nil {
|
|
17
|
-
res.has_value = true
|
|
18
|
-
res.value = v
|
|
19
|
-
} else {
|
|
20
|
-
res.has_value = false
|
|
21
|
-
}
|
|
22
|
-
return res
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
type day_one struct {
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
func CreateNew_day_one() *day_one {
|
|
29
|
-
me := new(day_one)
|
|
30
|
-
return me;
|
|
31
|
-
}
|
|
32
|
-
func main() {
|
|
33
|
-
var data string= "428122498997587283996116951397957933569136949848379417125362532269869461185743113733992331379856446362482129646556286611543756564275715359874924898113424472782974789464348626278532936228881786273586278886575828239366794429223317476722337424399239986153675275924113322561873814364451339186918813451685263192891627186769818128715595715444565444581514677521874935942913547121751851631373316122491471564697731298951989511917272684335463436218283261962158671266625299188764589814518793576375629163896349665312991285776595142146261792244475721782941364787968924537841698538288459355159783985638187254653851864874544584878999193242641611859756728634623853475638478923744471563845635468173824196684361934269459459124269196811512927442662761563824323621758785866391424778683599179447845595931928589255935953295111937431266815352781399967295389339626178664148415561175386725992469782888757942558362117938629369129439717427474416851628121191639355646394276451847131182652486561415942815818785884559193483878139351841633366398788657844396925423217662517356486193821341454889283266691224778723833397914224396722559593959125317175899594685524852419495793389481831354787287452367145661829287518771631939314683137722493531318181315216342994141683484111969476952946378314883421677952397588613562958741328987734565492378977396431481215983656814486518865642645612413945129485464979535991675776338786758997128124651311153182816188924935186361813797251997643992686294724699281969473142721116432968216434977684138184481963845141486793996476793954226225885432422654394439882842163295458549755137247614338991879966665925466545111899714943716571113326479432925939227996799951279485722836754457737668191845914566732285928453781818792236447816127492445993945894435692799839217467253986218213131249786833333936332257795191937942688668182629489191693154184177398186462481316834678733713614889439352976144726162214648922159719979143735815478633912633185334529484779322818611438194522292278787653763328944421516569181178517915745625295158611636365253948455727653672922299582352766484";
|
|
34
|
-
var values []int64= operatorsOf_static_map_2((strings.Split(data, "")), func (item string, index int64) int64 {
|
|
35
|
-
return (r_str_2_i64(item)).value.(int64)
|
|
36
|
-
});
|
|
37
|
-
var random_ch func([]int64, int64) int64= func (list []int64, index int64) int64 {
|
|
38
|
-
if index >= (int64(len(list))) {
|
|
39
|
-
return list[int64(0)]
|
|
40
|
-
}
|
|
41
|
-
return list[index]
|
|
42
|
-
};
|
|
43
|
-
fmt.Println( strconv.FormatInt(operatorsOf_static_reduce_3(values, func (left int64, right int64, index int64) int64 {
|
|
44
|
-
return (func() int64 { if (right == random_ch(values, (index + int64(1)))) { return (left + right) } else { return left} }())
|
|
45
|
-
}, int64(0)), 10) )
|
|
46
|
-
}
|
|
47
|
-
type operatorsOf struct {
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
func CreateNew_operatorsOf() *operatorsOf {
|
|
51
|
-
me := new(operatorsOf)
|
|
52
|
-
return me;
|
|
53
|
-
}
|
|
54
|
-
func operatorsOf_static_map_2(__self []string, cb func(string, int64) int64) []int64 {
|
|
55
|
-
/** unused: __len*/
|
|
56
|
-
var res []int64 = make([]int64, 0);
|
|
57
|
-
var i int64 = 0;
|
|
58
|
-
for ; i < int64(len(__self)) ; i++ {
|
|
59
|
-
it := __self[i];
|
|
60
|
-
res = append(res,cb(it, i));
|
|
61
|
-
}
|
|
62
|
-
return res
|
|
63
|
-
}
|
|
64
|
-
func operatorsOf_static_reduce_3(__self []int64, cb func(int64, int64, int64) int64, initialValue int64) int64 {
|
|
65
|
-
var len_1 int64= int64(len(__self));
|
|
66
|
-
var res_1 int64= initialValue;
|
|
67
|
-
if len_1 >= int64(1) {
|
|
68
|
-
var i_1 int64 = 0;
|
|
69
|
-
for ; i_1 < int64(len(__self)) ; i_1++ {
|
|
70
|
-
it_1 := __self[i_1];
|
|
71
|
-
res_1 = cb(res_1, it_1, i_1);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
return res_1
|
|
75
|
-
}
|