-
Notifications
You must be signed in to change notification settings - Fork 2
/
Option.go
796 lines (699 loc) · 30.5 KB
/
Option.go
1
2
3
4
5
6
7
8
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
// This code is transcompiled by LuneScript.
package lnsc
import . "github.com/ifritJP/LuneScript/src/lune/base/runtime_go"
var init_Option bool
var Option__mod__ string
// decl enum -- ModeKind
type Option_ModeKind = string
const Option_ModeKind__Ast = "ast"
const Option_ModeKind__BootC = "bootC"
const Option_ModeKind__Builtin = "builtin"
const Option_ModeKind__Complete = "comp"
const Option_ModeKind__Diag = "diag"
const Option_ModeKind__Exec = "exe"
const Option_ModeKind__Format = "format"
const Option_ModeKind__Glue = "glue"
const Option_ModeKind__Inquire = "inq"
const Option_ModeKind__Lua = "lua"
const Option_ModeKind__LuaMeta = "LUA"
const Option_ModeKind__MkMain = "mkmain"
const Option_ModeKind__Save = "save"
const Option_ModeKind__SaveMeta = "SAVE"
const Option_ModeKind__Shebang = "shebang"
const Option_ModeKind__Token = "token"
const Option_ModeKind__Unknown = ""
var Option_ModeKindList_ = NewLnsList( []LnsAny {
Option_ModeKind__Unknown,
Option_ModeKind__Token,
Option_ModeKind__Ast,
Option_ModeKind__Diag,
Option_ModeKind__Complete,
Option_ModeKind__Lua,
Option_ModeKind__LuaMeta,
Option_ModeKind__Save,
Option_ModeKind__SaveMeta,
Option_ModeKind__Exec,
Option_ModeKind__Glue,
Option_ModeKind__BootC,
Option_ModeKind__Format,
Option_ModeKind__Builtin,
Option_ModeKind__Inquire,
Option_ModeKind__MkMain,
Option_ModeKind__Shebang,
})
func Option_ModeKind_get__allList() *LnsList{
return Option_ModeKindList_
}
var Option_ModeKindMap_ = map[string]string {
Option_ModeKind__Ast: "ModeKind.Ast",
Option_ModeKind__BootC: "ModeKind.BootC",
Option_ModeKind__Builtin: "ModeKind.Builtin",
Option_ModeKind__Complete: "ModeKind.Complete",
Option_ModeKind__Diag: "ModeKind.Diag",
Option_ModeKind__Exec: "ModeKind.Exec",
Option_ModeKind__Format: "ModeKind.Format",
Option_ModeKind__Glue: "ModeKind.Glue",
Option_ModeKind__Inquire: "ModeKind.Inquire",
Option_ModeKind__Lua: "ModeKind.Lua",
Option_ModeKind__LuaMeta: "ModeKind.LuaMeta",
Option_ModeKind__MkMain: "ModeKind.MkMain",
Option_ModeKind__Save: "ModeKind.Save",
Option_ModeKind__SaveMeta: "ModeKind.SaveMeta",
Option_ModeKind__Shebang: "ModeKind.Shebang",
Option_ModeKind__Token: "ModeKind.Token",
Option_ModeKind__Unknown: "ModeKind.Unknown",
}
func Option_ModeKind__from(arg1 string) LnsAny{
if _, ok := Option_ModeKindMap_[arg1]; ok { return arg1 }
return nil
}
func Option_ModeKind_getTxt(arg1 string) string {
return Option_ModeKindMap_[arg1];
}
// decl enum -- Int2strMode
type Option_Int2strMode = LnsInt
const Option_Int2strMode__Int2strModeDepend = 0
const Option_Int2strMode__Int2strModeNeed0 = 1
const Option_Int2strMode__Int2strModeUnneed0 = 2
var Option_Int2strModeList_ = NewLnsList( []LnsAny {
Option_Int2strMode__Int2strModeDepend,
Option_Int2strMode__Int2strModeNeed0,
Option_Int2strMode__Int2strModeUnneed0,
})
func Option_Int2strMode_get__allList() *LnsList{
return Option_Int2strModeList_
}
var Option_Int2strModeMap_ = map[LnsInt]string {
Option_Int2strMode__Int2strModeDepend: "Int2strMode.Int2strModeDepend",
Option_Int2strMode__Int2strModeNeed0: "Int2strMode.Int2strModeNeed0",
Option_Int2strMode__Int2strModeUnneed0: "Int2strMode.Int2strModeUnneed0",
}
func Option_Int2strMode__from(arg1 LnsInt) LnsAny{
if _, ok := Option_Int2strModeMap_[arg1]; ok { return arg1 }
return nil
}
func Option_Int2strMode_getTxt(arg1 LnsInt) string {
return Option_Int2strModeMap_[arg1];
}
// for 39
func Option_convExp60(arg1 []LnsAny) LnsAny {
return Lns_getFromMulti( arg1, 0 )
}
// for 308
func Option_convExp799(arg1 []LnsAny) LnsAny {
return Lns_getFromMulti( arg1, 0 )
}
// for 303
func Option_convExp801(arg1 []LnsAny) LnsAny {
return Lns_getFromMulti( arg1, 0 )
}
// for 201
func Option_convExp599(arg1 []LnsAny) LnsAny {
return Lns_getFromMulti( arg1, 0 )
}
// 48: decl @lune.@base.@Option.getBuildCount
func Option_getBuildCount_1015_() LnsInt {
return 7162
}
// 75: decl @lune.@base.@Option.getRuntimeModule
func Option_getRuntimeModule() string {
return Lns_getVM().String_format("lune.base.runtime%d", []LnsAny{Ver_luaModVersion})
}
// 194: decl @lune.@base.@Option.outputLuneMod
func Option_outputLuneMod(path LnsAny) LnsAny {
var lune_path string
lune_path = "runtime.lua"
if path != nil{
path_2505 := path.(string)
if path_2505 != ""{
lune_path = path_2505
}
}
var fileObj Lns_luaStream
{
_fileObj := Option_convExp599(Lns_2DDD(Lns_io_open(lune_path, "w")))
if _fileObj == nil{
return Lns_getVM().String_format("failed to open -- %s", []LnsAny{lune_path})
} else {
fileObj = _fileObj.(Lns_luaStream)
}
}
fileObj.Write("--[[\nMIT License\n\nCopyright (c) 2018,2019 ifritJP\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n]]\n")
for _, _kind := range( LuaMod_CodeKind_get__allList().Items ) {
kind := _kind.(LnsInt)
fileObj.Write(LuaMod_getCode(kind))
}
fileObj.Close()
return nil
}
// 241: decl @lune.@base.@Option.analyze.printUsage
func analyze__printUsage_1097_(code LnsInt) {
Lns_print([]LnsAny{"usage:\n <type1> [-prof] [-r] src.lns mode [mode-option]\n <type2> -mklunemod path\n <type3> -shebang path\n <type4> --version\n\n* type1\n - src.lns [common_op] ast\n - src.lns [common_op] comp [-i] module line column\n - src.lns [common_op] inq [-i] module line column\n - src.lns [common_op] [-ol ver] [-ob<0|1>] [-dmr] <lua|LUA>\n - src.lns [common_op] [-ol ver] [-ob<0|1>] [-dmr] [--depends dependfile] <save|SAVE> output-dir\n - src.lns [common_op] exe\n\n -r: use 'require( \"lune.base.runtime\" )'\n -ol: output lua version. ver = 51 or 52 or 53.\n -ob: output bytecompiled-code.\n -ob0 is without debug information.\n -ob1 is with debug information.\n -langC: transcompile to c-lang.\n -langGo: transcompile to golang.\n -oc: output path of the source code transcompiled to c-lang .\n --depends: output dependfile\n --int2str mode: mode of int to str.\n - depend: depends the lua version.\n - need0: with '.0'.\n - unneed0: without '.0'.\n\n common_op:\n -u: update meta and lua on load.\n -Werror: error by warrning.\n --log <mode>: set log level.\n mode: fatal, error, warn, log, info, debug, trace\n --warning-shadowing: shadowing error convert to warning.\n --compat-comment: backward compatibility to process the comment.\n --disable-checking-define-abbr: disable checking for ##.\n --uptodate <mode>: checking uptodate mode.\n mode: skip check.\n none: skip process when file is uptodate.\n touch: touch meta file when file is uptodate. (default)\n --use-ipairs: use ipairs for foreach with List value.\n --default-lazy: set lazy-loading at default.\n --valid-luaval: enable luaval when transcompie to lua.\n --package <name>: set the package name for the go-lang.\n --app <name>: set the application name for the go-lang.\n\n* type2\n path: output file path.\n"})
Lns_getVM().OS_exit(code)
}
// 239: decl @lune.@base.@Option.analyze
func Option_analyze(argList *LnsList) *Option_Option {
__func__ := "@lune.@base.@Option.analyze"
var option *Option_Option
option = NewOption_Option()
var useStdInFlag bool
useStdInFlag = false
var lineNo LnsAny
lineNo = nil
var column LnsAny
column = nil
var index LnsInt
index = 1
{
_file := Option_convExp801(Lns_2DDD(Lns_io_open("lune.js", "r")))
if _file != nil {
file := _file.(Lns_luaStream)
{
_projInfo := Option_convExp799(Lns_2DDD(Option_ProjInfo1100__fromStem_1121_(Lns_car(Json_fromStr(Lns_GetEnv().PopVal( Lns_GetEnv().IncStack() ||
Lns_GetEnv().SetStackVal( file.Read("*a")) ||
Lns_GetEnv().SetStackVal( "") ).(string))),nil)))
if _projInfo != nil {
projInfo := _projInfo.(*Option_ProjInfo1100)
var workArgList *LnsList
workArgList = NewLnsList([]LnsAny{})
for _, _arg := range( projInfo.Cmd_option.Items ) {
arg := _arg.(string)
workArgList.Insert(arg)
}
for _, _arg := range( argList.Items ) {
arg := _arg.(string)
workArgList.Insert(arg)
}
argList = workArgList
}
}
}
}
var getNextOp func() LnsAny
getNextOp = func() LnsAny {
if argList.Len() <= index{
return nil
}
index = index + 1
return argList.GetAt(index).(string)
}
Util_setDebugFlag(false)
for argList.Len() >= index {
var arg string
arg = argList.GetAt(index).(string)
if Lns_isCondTrue( Lns_car(Lns_getVM().String_find(arg,"^-", nil, nil))){
if option.Mode != Option_ModeKind__Shebang{
if _switch1612 := (arg); _switch1612 == "-i" {
useStdInFlag = true
} else if _switch1612 == "-prof" {
option.ValidProf = true
} else if _switch1612 == "--nodebug" {
Util_setDebugFlag(false)
} else if _switch1612 == "--debug" {
Util_setDebugFlag(true)
} else if _switch1612 == "-shebang" {
option.Mode = Option_ModeKind__Shebang
} else if _switch1612 == "--version" {
Lns_print([]LnsAny{Lns_getVM().String_format("LuneScript: version %s (%d:Lua%s) [%s]", []LnsAny{Ver_version, Option_getBuildCount_1015_(), Depend_getLuaVersion(), Ver_metaVersion})})
Lns_getVM().OS_exit(0)
} else if _switch1612 == "--builtin" {
{
__collection1004 := Ast_getBuiltInTypeIdMap()
__sorted1004 := __collection1004.CreateKeyListInt()
__sorted1004.Sort( LnsItemKindInt, nil )
for _, _typeId := range( __sorted1004.Items ) {
typeInfo := __collection1004.Items[ _typeId ].(Ast_TypeInfoDownCast).ToAst_TypeInfo()
typeId := _typeId.(LnsInt)
Lns_print([]LnsAny{typeId, typeInfo.FP.GetTxt(nil, nil, nil)})
}
}
Lns_getVM().OS_exit(0)
} else if _switch1612 == "-mklunemod" {
var path LnsAny
path = getNextOp()
{
_mess := Option_outputLuneMod(path)
if _mess != nil {
mess := _mess.(string)
Util_errorLog(mess)
Lns_getVM().OS_exit(1)
}
}
Lns_getVM().OS_exit(0)
} else if _switch1612 == "--mkbuiltin" {
var path string
{
_path := getNextOp()
if _path == nil{
path = "."
} else {
path = _path.(string)
}
}
option.ScriptPath = path + "/lns_builtin.lns"
option.Mode = Option_ModeKind__Builtin
} else if _switch1612 == "-r" {
option.UseLuneModule = Option_getRuntimeModule()
} else if _switch1612 == "--runtime" {
option.UseLuneModule = getNextOp()
} else if _switch1612 == "-oc" {
option.BootPath = getNextOp()
} else if _switch1612 == "-u" {
option.UpdateOnLoad = true
} else if _switch1612 == "-Werror" {
option.TransCtrlInfo.StopByWarning = true
} else if _switch1612 == "--disable-checking-define-abbr" {
option.TransCtrlInfo.CheckingDefineAbbr = false
} else if _switch1612 == "--compat-comment" {
option.TransCtrlInfo.CompatComment = true
} else if _switch1612 == "--warning-shadowing" {
option.TransCtrlInfo.WarningShadowing = true
} else if _switch1612 == "--valid-luaval" {
option.TransCtrlInfo.ValidLuaval = true
} else if _switch1612 == "--default-lazy" {
option.TransCtrlInfo.DefaultLazy = true
} else if _switch1612 == "--package" {
option.PackageName = getNextOp()
} else if _switch1612 == "--int2str" {
var opt LnsAny
opt = getNextOp()
if _switch1306 := opt; _switch1306 == "depend" {
option.FP.Get_runtimeOpt().int2strMode = Option_Int2strMode__Int2strModeDepend
} else if _switch1306 == "need0" {
option.FP.Get_runtimeOpt().int2strMode = Option_Int2strMode__Int2strModeNeed0
} else if _switch1306 == "unneed0" {
option.FP.Get_runtimeOpt().int2strMode = Option_Int2strMode__Int2strModeUnneed0
} else {
Util_errorLog(Lns_getVM().String_format("unknown mode -- %s", []LnsAny{opt}))
Lns_getVM().OS_exit(1)
}
} else if _switch1612 == "--app" {
{
__exp := getNextOp()
if __exp != nil {
_exp := __exp.(string)
option.AppName = _exp
}
}
} else if _switch1612 == "--main" {
{
__exp := getNextOp()
if __exp != nil {
_exp := __exp.(string)
option.MainModule = _exp
}
}
} else if _switch1612 == "--log" {
{
_txt := getNextOp()
if _txt != nil {
txt := _txt.(string)
{
_level := Log_str2level(txt)
if _level != nil {
level := _level.(LnsInt)
Log_setLevel(level)
} else {
Util_errorLog(Lns_getVM().String_format("illegal level -- %s", []LnsAny{txt}))
}
}
}
}
} else if _switch1612 == "--testing" {
option.Testing = true
} else if _switch1612 == "--depends" {
option.DependsPath = getNextOp()
} else if _switch1612 == "--use-ipairs" {
option.UseIpairs = true
} else if _switch1612 == "--uptodate" {
{
_txt := getNextOp()
if _txt != nil {
txt := _txt.(string)
{
_mode := Types_CheckingUptodateMode__from(txt)
if _mode != nil {
mode := _mode.(string)
option.TransCtrlInfo.UptodateMode = mode
} else {
Util_errorLog("illegal mode -- " + txt)
}
}
}
}
} else if _switch1612 == "-langC" {
option.ConvTo = Types_Lang__C
option.TransCtrlInfo.ValidLuaval = true
} else if _switch1612 == "-langGo" {
option.ConvTo = Types_Lang__Go
option.TransCtrlInfo.ValidLuaval = true
} else if _switch1612 == "-ol" {
{
_txt := getNextOp()
if _txt != nil {
txt := _txt.(string)
if _switch1556 := txt; _switch1556 == "51" {
option.TargetLuaVer = LuaVer_ver51
} else if _switch1556 == "52" {
option.TargetLuaVer = LuaVer_ver52
} else if _switch1556 == "53" {
option.TargetLuaVer = LuaVer_ver53
}
}
}
} else if _switch1612 == "-ob0" || _switch1612 == "-ob1" {
option.ByteCompile = true
if arg == "-ob0"{
option.StripDebugInfo = true
}
} else {
Util_log(Lns_getVM().String_format("unknown option -- '%s'", []LnsAny{arg}))
Lns_getVM().OS_exit(1)
}
} else {
if option.ShebangArgList.Len() == 0{
option.ShebangArgList.Insert(option.ScriptPath)
}
option.ShebangArgList.Insert(arg)
}
} else {
if option.ScriptPath == ""{
option.ScriptPath = arg
if option.Mode == Option_ModeKind__Shebang{
option.ShebangArgList.Insert(option.ScriptPath)
}
} else if option.Mode == ""{
{
_mode := Option_ModeKind__from(arg)
if _mode != nil {
mode := _mode.(string)
option.Mode = mode
} else {
Util_err(Lns_getVM().String_format("unknown mode -- %s", []LnsAny{arg}))
}
}
} else {
if _switch1897 := (option.Mode); _switch1897 == Option_ModeKind__Complete || _switch1897 == Option_ModeKind__Inquire {
if Lns_op_not(option.AnalyzeModule){
option.AnalyzeModule = arg
} else if Lns_op_not(lineNo){
lineNo = Lns_forceCastInt((Lns_unwrapDefault( Lns_tonumber(arg, nil), 0)))
} else if Lns_op_not(column){
column = Lns_forceCastInt((Lns_unwrapDefault( Lns_tonumber(arg, nil), 0)))
option.AnalyzePos = NewTypes_Position(Lns_unwrap( lineNo).(LnsInt), Lns_unwrap( column).(LnsInt), Util_scriptPath2Module(option.ScriptPath))
}
} else if _switch1897 == Option_ModeKind__Save || _switch1897 == Option_ModeKind__SaveMeta || _switch1897 == Option_ModeKind__Glue {
option.OutputDir = arg
} else if _switch1897 == Option_ModeKind__Shebang {
if option.ShebangArgList.Len() == 0{
option.ShebangArgList.Insert(option.ScriptPath)
}
option.ShebangArgList.Insert(arg)
} else {
option.OutputPath = arg
}
}
}
index = index + 1
}
if option.Mode != Option_ModeKind__Builtin{
if Lns_GetEnv().PopVal( Lns_GetEnv().IncStack() ||
Lns_GetEnv().SetStackVal( option.ScriptPath == "") ||
Lns_GetEnv().SetStackVal( option.Mode == Option_ModeKind__Unknown) ).(bool){
analyze__printUsage_1097_(Lns_GetEnv().PopVal( Lns_GetEnv().IncStack() ||
Lns_GetEnv().SetStackVal( (Lns_GetEnv().PopVal( Lns_GetEnv().IncStack() ||
Lns_GetEnv().SetStackVal( argList.Len() == 0) ||
Lns_GetEnv().SetStackVal( argList.GetAt(1).(string) == "") ).(bool))) &&
Lns_GetEnv().SetStackVal( 0) ||
Lns_GetEnv().SetStackVal( 1) ).(LnsInt))
}
}
if useStdInFlag{
if Lns_isCondTrue( option.AnalyzeModule){
Parser_StreamParser_setStdinStream(Lns_unwrap( option.AnalyzeModule).(string))
} else {
if option.ScriptPath != ""{
Parser_StreamParser_setStdinStream(Util_scriptPath2Module(option.ScriptPath))
}
}
}
Log_log(Log_Level__Log, __func__, 579, Log_CreateMessage(func() string {
return Lns_getVM().String_format("mode is '%s'", []LnsAny{Option_ModeKind_getTxt( option.Mode)})
}))
return option
}
// 584: decl @lune.@base.@Option.createDefaultOption
func Option_createDefaultOption(path string) *Option_Option {
var option *Option_Option
option = NewOption_Option()
option.ScriptPath = path
option.UseLuneModule = Option_getRuntimeModule()
option.UseIpairs = true
return option
}
// declaration Class -- RuntimeOpt
type Option_RuntimeOptMtd interface {
Get_int2strMode() LnsInt
}
type Option_RuntimeOpt struct {
int2strMode LnsInt
FP Option_RuntimeOptMtd
}
func Option_RuntimeOpt2Stem( obj LnsAny ) LnsAny {
if obj == nil {
return nil
}
return obj.(*Option_RuntimeOpt).FP
}
type Option_RuntimeOptDownCast interface {
ToOption_RuntimeOpt() *Option_RuntimeOpt
}
func Option_RuntimeOptDownCastF( multi ...LnsAny ) LnsAny {
if len( multi ) == 0 { return nil }
obj := multi[ 0 ]
if ddd, ok := multi[ 0 ].([]LnsAny); ok { obj = ddd[0] }
work, ok := obj.(Option_RuntimeOptDownCast)
if ok { return work.ToOption_RuntimeOpt() }
return nil
}
func (obj *Option_RuntimeOpt) ToOption_RuntimeOpt() *Option_RuntimeOpt {
return obj
}
func NewOption_RuntimeOpt() *Option_RuntimeOpt {
obj := &Option_RuntimeOpt{}
obj.FP = obj
obj.InitOption_RuntimeOpt()
return obj
}
func (self *Option_RuntimeOpt) Get_int2strMode() LnsInt{ return self.int2strMode }
// 92: DeclConstr
func (self *Option_RuntimeOpt) InitOption_RuntimeOpt() {
self.int2strMode = Option_Int2strMode__Int2strModeDepend
}
// declaration Class -- Option
type Option_OptionMtd interface {
Get_runtimeOpt() *Option_RuntimeOpt
OpenDepend(arg1 LnsAny) LnsAny
}
type Option_Option struct {
Mode string
AnalyzeModule LnsAny
AnalyzePos LnsAny
OutputDir LnsAny
ScriptPath string
ValidProf bool
UseLuneModule LnsAny
DependsPath LnsAny
UpdateOnLoad bool
ByteCompile bool
StripDebugInfo bool
TargetLuaVer *LuaVer_LuaVerInfo
BootPath LnsAny
UseIpairs bool
PackageName LnsAny
AppName LnsAny
MainModule string
TransCtrlInfo *Types_TransCtrlInfo
ConvTo LnsAny
Testing bool
OutputPath LnsAny
ShebangArgList *LnsList
runtimeOpt *Option_RuntimeOpt
FP Option_OptionMtd
}
func Option_Option2Stem( obj LnsAny ) LnsAny {
if obj == nil {
return nil
}
return obj.(*Option_Option).FP
}
type Option_OptionDownCast interface {
ToOption_Option() *Option_Option
}
func Option_OptionDownCastF( multi ...LnsAny ) LnsAny {
if len( multi ) == 0 { return nil }
obj := multi[ 0 ]
if ddd, ok := multi[ 0 ].([]LnsAny); ok { obj = ddd[0] }
work, ok := obj.(Option_OptionDownCast)
if ok { return work.ToOption_Option() }
return nil
}
func (obj *Option_Option) ToOption_Option() *Option_Option {
return obj
}
func NewOption_Option() *Option_Option {
obj := &Option_Option{}
obj.FP = obj
obj.InitOption_Option()
return obj
}
func (self *Option_Option) Get_runtimeOpt() *Option_RuntimeOpt{ return self.runtimeOpt }
// 147: DeclConstr
func (self *Option_Option) InitOption_Option() {
self.runtimeOpt = NewOption_RuntimeOpt()
self.ShebangArgList = NewLnsList([]LnsAny{})
self.OutputPath = nil
self.MainModule = ""
self.AppName = nil
self.PackageName = nil
self.Testing = false
self.ConvTo = nil
self.ValidProf = false
self.Mode = Option_ModeKind__Unknown
self.ScriptPath = ""
self.UseLuneModule = nil
self.UpdateOnLoad = false
self.ByteCompile = false
self.StripDebugInfo = false
self.TargetLuaVer = LuaVer_getCurVer()
self.TransCtrlInfo = Types_TransCtrlInfo_create_normal()
self.BootPath = nil
self.UseIpairs = false
self.AnalyzeModule = nil
self.OutputDir = nil
self.AnalyzePos = nil
self.DependsPath = nil
}
// 173: decl @lune.@base.@Option.Option.openDepend
func (self *Option_Option) OpenDepend(relPath LnsAny) LnsAny {
{
_path := self.DependsPath
if _path != nil {
path := _path.(string)
var filePath string
if relPath != nil{
relPath_2493 := relPath.(string)
if Lns_isCondTrue( Lns_car(Lns_getVM().String_find(path,"/$", nil, nil))){
filePath = Lns_getVM().String_format("%s%s", []LnsAny{path, relPath_2493})
} else {
filePath = Lns_getVM().String_format("%s/%s", []LnsAny{path, relPath_2493})
}
} else {
filePath = path
}
return Lns_car(Lns_io_open(filePath, "w"))
}
}
{
_path := self.DependsPath
if _path != nil {
path := _path.(string)
return Lns_car(Lns_io_open(path, "w"))
}
}
return nil
}
// declaration Class -- ProjInfo
type Option_ProjInfo1100Mtd interface {
ToMap() *LnsMap
}
type Option_ProjInfo1100 struct {
Cmd_option *LnsList
FP Option_ProjInfo1100Mtd
}
func Option_ProjInfo11002Stem( obj LnsAny ) LnsAny {
if obj == nil {
return nil
}
return obj.(*Option_ProjInfo1100).FP
}
type Option_ProjInfo1100DownCast interface {
ToOption_ProjInfo1100() *Option_ProjInfo1100
}
func Option_ProjInfo1100DownCastF( multi ...LnsAny ) LnsAny {
if len( multi ) == 0 { return nil }
obj := multi[ 0 ]
if ddd, ok := multi[ 0 ].([]LnsAny); ok { obj = ddd[0] }
work, ok := obj.(Option_ProjInfo1100DownCast)
if ok { return work.ToOption_ProjInfo1100() }
return nil
}
func (obj *Option_ProjInfo1100) ToOption_ProjInfo1100() *Option_ProjInfo1100 {
return obj
}
func NewOption_ProjInfo1100(arg1 *LnsList) *Option_ProjInfo1100 {
obj := &Option_ProjInfo1100{}
obj.FP = obj
obj.InitOption_ProjInfo1100(arg1)
return obj
}
func (self *Option_ProjInfo1100) InitOption_ProjInfo1100(arg1 *LnsList) {
self.Cmd_option = arg1
}
func (self *Option_ProjInfo1100) ToMapSetup( obj *LnsMap ) *LnsMap {
obj.Items["cmd_option"] = Lns_ToCollection( self.Cmd_option )
return obj
}
func (self *Option_ProjInfo1100) ToMap() *LnsMap {
return self.ToMapSetup( NewLnsMap( map[LnsAny]LnsAny{} ) )
}
func Option_ProjInfo1100__fromMap_1118_(arg1 LnsAny, paramList []Lns_ToObjParam)(LnsAny, LnsAny){
return Option_ProjInfo1100_FromMap( arg1, paramList )
}
func Option_ProjInfo1100__fromStem_1121_(arg1 LnsAny, paramList []Lns_ToObjParam)(LnsAny, LnsAny){
return Option_ProjInfo1100_FromMap( arg1, paramList )
}
func Option_ProjInfo1100_FromMap( obj LnsAny, paramList []Lns_ToObjParam ) (LnsAny, LnsAny) {
_,conv,mess := Option_ProjInfo1100_FromMapSub(obj,false, paramList);
return conv,mess
}
func Option_ProjInfo1100_FromMapSub( obj LnsAny, nilable bool, paramList []Lns_ToObjParam ) (bool, LnsAny, LnsAny) {
var objMap *LnsMap
if work, ok := obj.(*LnsMap); !ok {
return false, nil, "no map -- " + Lns_ToString(obj)
} else {
objMap = work
}
newObj := &Option_ProjInfo1100{}
newObj.FP = newObj
return Option_ProjInfo1100_FromMapMain( newObj, objMap, paramList )
}
func Option_ProjInfo1100_FromMapMain( newObj *Option_ProjInfo1100, objMap *LnsMap, paramList []Lns_ToObjParam ) (bool, LnsAny, LnsAny) {
if ok,conv,mess := Lns_ToListSub( objMap.Items["cmd_option"], false, []Lns_ToObjParam{Lns_ToObjParam{
Lns_ToStrSub, false,nil}}); !ok {
return false,nil,"cmd_option:" + mess.(string)
} else {
newObj.Cmd_option = conv.(*LnsList)
}
return true, newObj, nil
}
func Lns_Option_init() {
if init_Option { return }
init_Option = true
Option__mod__ = "@lune.@base.@Option"
Lns_InitMod()
Lns_Types_init()
Lns_Parser_init()
Lns_Json_init()
Lns_Util_init()
Lns_LuaMod_init()
Lns_Ver_init()
Lns_LuaVer_init()
Lns_LuaVer_init()
Lns_Depend_init()
Lns_Log_init()
Lns_Ast_init()
}
func init() {
init_Option = false
}