src/Expression.cc

changeset 106
9174be9ac686
parent 105
6dbac3305614
child 107
55c2bcd8ed5c
--- a/src/Expression.cc	Sun Feb 09 21:27:55 2014 +0200
+++ b/src/Expression.cc	Sun Feb 09 22:43:58 2014 +0200
@@ -47,8 +47,11 @@
 	while ((sym = ParseSymbol()) != null)
 		mSymbols << sym;
 
+	// If we were unable to get any expression symbols, something's wonky with
+	// the script. Report an error. mBadTokenText is set to the token that
+	// ParseSymbol ends at when it returns false.
 	if (mSymbols.IsEmpty())
-		Error ("Expected expression");
+		Error ("unknown identifier '%1'", mBadTokenText);
 
 	AdjustOperators();
 	Verify();
@@ -173,6 +176,7 @@
 	catch (ELocalException&)
 	{
 		// We use a local enum here since catch(...) would catch Error() calls.
+		mBadTokenText = mLexer->GetToken()->text;
 		mLexer->SetPosition (pos);
 		delete op;
 		return null;

mercurial