فهرست منبع

Improved error messages for non-ascii symbols.

Brucey 5 سال پیش
والد
کامیت
f0a9898838
1فایلهای تغییر یافته به همراه6 افزوده شده و 2 حذف شده
  1. 6 2
      parser.bmx

+ 6 - 2
parser.bmx

@@ -559,7 +559,11 @@ Type TParser Extends TGenProcessor
 			Case "~n"
 			Case "~n"
 				Return "end-of-line"
 				Return "end-of-line"
 		End Select
 		End Select
-		Return "'" + toke + "'"
+		Local uni:String
+		If toke.length > 0 And toke[0] > 255 Then
+			uni = " (unicode : " + _toker._lastTCHR + ")"
+		End If
+		Return "'" + toke + "'" + uni
 	End Method
 	End Method
 
 
 	Method CParse:Int( toke$ )
 	Method CParse:Int( toke$ )
@@ -580,7 +584,7 @@ Type TParser Extends TGenProcessor
 
 
 	Method Parse( toke$ )
 	Method Parse( toke$ )
 		If Not CParse( toke )
 		If Not CParse( toke )
-			DoErr "Syntax error - expecting '"+toke+"'."
+			DoErr "Syntax error - expecting '"+toke+"' but found " + DescribeToke(toke)
 		EndIf
 		EndIf
 	End Method
 	End Method