protected void ParseStatements(Token endToken) { FilePosition fp; bool allowEmpty = false; do { ParseStatement(allowEmpty); allowEmpty = true; fp = _lexer.TokenStartPosition; if (Accept(Token.Eof)) { // Don't loop forever AddErrorAtLastParsedPosition(string.Format( "Unexpected end of file looking for {0}.", Lexer.TokenName(endToken))); return; } }while (Accept(Token.ChrSemicolon)); if (!Accept(endToken)) { AddErrorAtTokenStart("Expecting ';'."); // Missing semicolon caused us to exit the loop above. SkipToNextEnd(); } MethodGenerator.EmitNonCodeLineInfo(new SourceRange(fp, _lastParsedPosition)); }
protected void Expect(Token token) { if (!Accept(token)) { AddErrorAtTokenStart(string.Format("Expecting {0}.", Lexer.TokenName(token))); } }