Skip to content

Commit db967a5

Browse files
committed
add ctrl+c handing
1 parent b759ddc commit db967a5

File tree

2 files changed

+17
-10
lines changed

2 files changed

+17
-10
lines changed

csbuild/ecs_bootstrap.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"Name": "ecs_bootstrap",
44
"Info": "Extended CovScript(ECS Lang) Bootstrap",
55
"Author": "Michael Lee",
6-
"Version": "1.5.2",
6+
"Version": "1.5.3",
77
"Target": "imports/ecs_bootstrap.csp",
88
"Dependencies": [
99
"parsergen",

imports/ecs_bootstrap.csp

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Bootstrap of Extended Covariant Script Generator v1.5.2
1+
# Bootstrap of Extended Covariant Script Generator v1.5.3
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -23,7 +23,7 @@ package ecs_bootstrap
2323
import parsergen, ecs_parser, ecs_generator, codec, regex
2424
import sdk_extension as sdk
2525

26-
var wrapper_ver = "1.5.2"
26+
var wrapper_ver = "1.5.3"
2727

2828
function show_version_simple()
2929
@begin
@@ -45,7 +45,7 @@ class repl_instance
4545
function on_eof_hook(parser)
4646
var tokens = null
4747
loop
48-
tokens = this.readline("..> ")
48+
tokens = this.readline(".. ")
4949
until tokens != null
5050
foreach it in tokens do parser.lex.push_back(it)
5151
return true
@@ -57,10 +57,13 @@ class repl_instance
5757
codegen.minmal = true
5858
end
5959
function readline(prompt)
60-
if !silent
61-
system.out.print(prompt)
62-
end
63-
var line = repl_impl.readline()
60+
var line = null
61+
loop
62+
if !silent
63+
system.out.print(prompt)
64+
end
65+
line = repl_impl.readline()
66+
until line != null
6467
code_buff.push_back(line)
6568
if line == "@exit"
6669
system.exit(0)
@@ -96,7 +99,7 @@ class repl_instance
9699
loop
97100
var tokens = null
98101
loop
99-
tokens = this.readline("> ")
102+
tokens = this.readline(">> ")
100103
until tokens != null
101104
if parser.run(ecs_parser.grammar.stx, tokens)
102105
var ast = parser.production()
@@ -107,9 +110,13 @@ class repl_instance
107110
try
108111
foreach line in code
109112
if !repl_impl.exec(line)
110-
system.exit(0)
113+
repl_impl.reset()
114+
break
111115
end
112116
end
117+
if repl_impl.has_exited()
118+
system.exit(0)
119+
end
113120
catch e
114121
system.out.println(e.what)
115122
repl_impl.reset()

0 commit comments

Comments
 (0)