Pārlūkot izejas kodu

Improved identifier error message to include keyword found.

woollybah 7 gadi atpakaļ
vecāks
revīzija
8231497850
1 mainītis faili ar 7 papildinājumiem un 1 dzēšanām
  1. 7 1
      parser.bmx

+ 7 - 1
parser.bmx

@@ -505,7 +505,13 @@ Type TParser Extends TGenProcessor
 		Case "@" NextToke
 		Case "string","object", "self"
 		Default
-			If _tokeType<>TOKE_IDENT Err "Syntax error - expecting identifier."
+			If _tokeType<>TOKE_IDENT Then
+				Local kw:String
+				If _tokeType = TOKE_KEYWORD Then
+					kw = " keyword"
+				End If
+				Err "Syntax error - expecting identifier, but found" + kw + " '" + _toke + "'"
+			End If
 		End Select
 		Local id$=_toke
 		NextToke