1
- # Bootstrap of Extended Covariant Script Generator v1.5.3
1
+ # Bootstrap of Extended Covariant Script Generator v1.5.4
2
2
#
3
3
# Licensed under the Apache License, Version 2.0 (the "License");
4
4
# you may not use this file except in compliance with the License.
@@ -23,7 +23,7 @@ package ecs_bootstrap
23
23
import parsergen, ecs_parser, ecs_generator, codec, regex
24
24
import sdk_extension as sdk
25
25
26
- var wrapper_ver = "1.5.3 "
26
+ var wrapper_ver = "1.5.4 "
27
27
28
28
function show_version_simple()
29
29
@begin
@@ -71,7 +71,6 @@ class repl_instance
71
71
line += "\n"
72
72
var lexer = null
73
73
if unicode_cvt != null
74
- system.out.println("Unicode Enabled")
75
74
lexer = new parsergen.unicode_lexer_type
76
75
lexer.cvt = unicode_cvt
77
76
else
@@ -165,8 +164,8 @@ function show_help()
165
164
" -h Show help information\n" +
166
165
" -v Show version infomation\n" +
167
166
" -u <CHARSET> Set unicode charset\n" +
168
- " CHARSET = {\"UTF8\", \"GBK\"}\n" +
169
- " -i <PATH> Set import path\n"
167
+ " CHARSET = {\"AUTO\", \" UTF8\", \"GBK\"}\n" +
168
+ " -i <PATH> Append import path\n"
170
169
)
171
170
@end
172
171
system.exit(0)
@@ -239,7 +238,10 @@ function process_args(cmd_args)
239
238
system.out.println("Error: Option \"-u\" not completed. Usage: \"ecs -u <CHARSET>\"")
240
239
system.exit(0)
241
240
end
242
- unicode = cmd_args[++index]
241
+ unicode = cmd_args[++index].toupper()
242
+ if unicode == "AUTO"
243
+ unicode = system.is_platform_windows()?"GBK":"UTF8"
244
+ end
243
245
end
244
246
case "-i"
245
247
if index == cmd_args.size - 1
@@ -319,14 +321,18 @@ function main(cmd_args)
319
321
system.exit(0)
320
322
end
321
323
var cvt_name = unicode.toupper()
324
+ if cvt_name == "AUTO"
325
+ cvt_name = system.is_platform_windows()?"GBK":"UTF8"
326
+ end
322
327
if !codecvt_map.exist(cvt_name)
323
328
system.out.println("Error: unknown unicode charset \"" + cvt_name + "\".")
324
329
system.exit(0)
325
330
end
326
331
instance.unicode_cvt = codecvt_map.at(cvt_name)(unicode_ext)
327
- ecs_parser.grammar.lex = ecs_parser.get_lexical([](str)->unicode_ext.build_wregex(instance.unicode_cvt.local2wide(str)))
332
+ ecs_parser.grammar.lex = ecs_parser.get_lexical([](str)->unicode_ext.build_wregex(instance.unicode_cvt.local2wide(str)), cvt_name )
328
333
end
329
334
if csx_path != null
335
+ sdk.set_import_path(runtime.get_import_path() + system.path.delimiter + csx_path)
330
336
instance.codegen.ecsx_path = csx_path.split({system.path.delimiter})
331
337
end
332
338
instance.run(args_arr...)
@@ -366,7 +372,7 @@ function main(cmd_args)
366
372
system.exit(0)
367
373
end
368
374
parser.unicode_cvt = codecvt_map.at(cvt_name)(unicode_ext)
369
- ecs_parser.grammar.lex = ecs_parser.get_lexical([](str)->unicode_ext.build_wregex(parser.unicode_cvt.local2wide(str)))
375
+ ecs_parser.grammar.lex = ecs_parser.get_lexical([](str)->unicode_ext.build_wregex(parser.unicode_cvt.local2wide(str)), cvt_name )
370
376
end
371
377
parser.add_grammar("ecs-lang", ecs_parser.grammar)
372
378
parser.from_file(file_name)
0 commit comments