# HG changeset patch # User Teemu Piippo # Date 1391951582 -7200 # Node ID 62da929f7814deea0a138fd869d2631f37364108 # Parent 48472c0678cc0b79369a94b07a1133e428304811 - minor changes: don't allow any token for labels, run ParseStatement from the next token diff -r 48472c0678cc -r 62da929f7814 src/Parser.cc --- a/src/Parser.cc Sun Feb 09 15:06:37 2014 +0200 +++ b/src/Parser.cc Sun Feb 09 15:13:02 2014 +0200 @@ -201,6 +201,7 @@ } // If nothing else, parse it as a statement + mLexer->Skip (-1); DataBuffer* b = ParseStatement(); if (b == false) @@ -374,7 +375,7 @@ CheckNotToplevel(); // Get the name of the label - mLexer->MustGetNext (tkAny); + mLexer->MustGetNext (tkSymbol); // Find the mark this goto statement points to String target = GetTokenString(); @@ -492,7 +493,6 @@ // Initializer mLexer->MustGetNext (tkParenStart); - mLexer->MustGetNext (tkAny); DataBuffer* init = ParseStatement(); if (init == null) @@ -509,7 +509,6 @@ mLexer->MustGetNext (tkSemicolon); // Incrementor - mLexer->MustGetNext (tkAny); DataBuffer* incr = ParseStatement(); if (incr == null) @@ -1192,7 +1191,7 @@ DataBuffer* BotscriptParser::ParseStatement() { // If it's a variable, expect assignment. - if (TokenIs (tkDollarSign)) + if (mLexer->GetNext (tkDollarSign)) { mLexer->MustGetNext (tkSymbol); ScriptVariable* var = FindGlobalVariable (GetTokenString());