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

vbs: rewrite step9 using IOWrap

This commit is contained in:
老刘 2024-08-14 11:27:25 +08:00 committed by Joel Martin
parent c6023577eb
commit ca9d6ee043

View File

@ -1,5 +1,6 @@
Option Explicit
Include "IO.vbs"
Include "Types.vbs"
Include "Reader.vbs"
Include "Printer.vbs"
@ -390,12 +391,12 @@ End Sub
Call REPL()
Sub REPL()
Dim strCode, strResult
Dim strCode
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
@ -404,17 +405,15 @@ Sub REPL()
strRes = REP(strCode)
If Err.Number <> 0 Then
If Err.Source = "MThrow" Then
'WScript.StdOut.WriteLine Err.Source + ": " + _
WScript.StdOut.WriteLine "Exception: " + _
IO.WriteErrLine "Exception: " + _
PrintMalType(objExceptions.Item(Err.Description), True)
objExceptions.Remove Err.Description
Else
'WScript.StdOut.WriteLine Err.Source + ": " + Err.Description
WScript.StdOut.WriteLine "Exception: " + Err.Description
IO.WriteErrLine "Exception: " + Err.Description
End If
Else
If strRes <> "" Then
WScript.Echo strRes
IO.WriteLine strRes
End If
End If
On Error Goto 0