1
1
mirror of https://github.com/kanaka/mal.git synced 2024-09-11 13:55:55 +03:00

vbs: rewrite step3 using IOWrap

This commit is contained in:
老刘 2024-08-14 11:12:53 +08:00 committed by Joel Martin
parent e8cf3057cd
commit 176eca9c6a
2 changed files with 5 additions and 6 deletions

View File

@ -6,7 +6,6 @@ Include "Reader.vbs"
Include "Printer.vbs"
Call REPL()
Sub REPL()
Dim strCode
While True

View File

@ -1,5 +1,6 @@
Option Explicit
Include "IO.vbs"
Include "Types.vbs"
Include "Reader.vbs"
Include "Printer.vbs"
@ -103,10 +104,10 @@ Call REPL()
Sub REPL()
Dim strCode, strResult
While True
WScript.StdOut.Write "user> "
IO.Write "user> "
On Error Resume Next
strCode = WScript.StdIn.ReadLine()
strCode = IO.ReadLine()
If Err.Number <> 0 Then WScript.Quit 0
On Error Goto 0
@ -114,11 +115,10 @@ Sub REPL()
On Error Resume Next
strRes = REP(strCode)
If Err.Number <> 0 Then
'WScript.StdOut.WriteLine Err.Source + ": " + Err.Description
WScript.StdOut.WriteLine "Exception: " + Err.Description
IO.WriteErrLine "Exception: " + Err.Description
Else
If strRes <> "" Then
WScript.Echo strRes
IO.WriteLine strRes
End If
End If
On Error Goto 0