2021-01-30 10:38:47 +01:00
|
|
|
# Copyright 2020 Mattia Giambirtone
|
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
|
|
|
|
|
2021-01-29 18:14:57 +01:00
|
|
|
# Just Another Test Runner for running JAPL tests
|
|
|
|
# a testrunner process
|
|
|
|
|
|
|
|
import ../src/vm
|
2021-01-31 10:51:29 +01:00
|
|
|
|
2021-01-29 18:14:57 +01:00
|
|
|
|
|
|
|
var btvm = initVM()
|
2021-01-31 15:06:54 +01:00
|
|
|
|
2021-01-31 16:55:24 +01:00
|
|
|
try:
|
2021-01-31 20:58:24 +01:00
|
|
|
var source: string
|
|
|
|
while true:
|
|
|
|
let ch = stdin.readChar()
|
|
|
|
if ch == char(4):
|
|
|
|
break
|
|
|
|
else:
|
|
|
|
source &= ch
|
|
|
|
discard btvm.interpret(source, "")
|
2021-01-31 16:55:24 +01:00
|
|
|
quit(0)
|
|
|
|
except:
|
|
|
|
let error = getCurrentException()
|
|
|
|
writeLine stderr, error.msg
|
2021-02-09 00:35:40 +01:00
|
|
|
writeLine stderr, error.getStacktrace()
|
2021-01-31 16:55:24 +01:00
|
|
|
quit(1)
|
2021-01-31 15:06:54 +01:00
|
|
|
|