src/Expression.cc

changeset 106
9174be9ac686
parent 105
6dbac3305614
child 107
55c2bcd8ed5c
equal deleted inserted replaced
105:6dbac3305614 106:9174be9ac686
45 ExpressionSymbol* sym; 45 ExpressionSymbol* sym;
46 46
47 while ((sym = ParseSymbol()) != null) 47 while ((sym = ParseSymbol()) != null)
48 mSymbols << sym; 48 mSymbols << sym;
49 49
50 // If we were unable to get any expression symbols, something's wonky with
51 // the script. Report an error. mBadTokenText is set to the token that
52 // ParseSymbol ends at when it returns false.
50 if (mSymbols.IsEmpty()) 53 if (mSymbols.IsEmpty())
51 Error ("Expected expression"); 54 Error ("unknown identifier '%1'", mBadTokenText);
52 55
53 AdjustOperators(); 56 AdjustOperators();
54 Verify(); 57 Verify();
55 Evaluate(); 58 Evaluate();
56 } 59 }
171 throw failed; 174 throw failed;
172 } 175 }
173 catch (ELocalException&) 176 catch (ELocalException&)
174 { 177 {
175 // We use a local enum here since catch(...) would catch Error() calls. 178 // We use a local enum here since catch(...) would catch Error() calls.
179 mBadTokenText = mLexer->GetToken()->text;
176 mLexer->SetPosition (pos); 180 mLexer->SetPosition (pos);
177 delete op; 181 delete op;
178 return null; 182 return null;
179 } 183 }
180 184

mercurial