public override LuaStatement Parse(INextAwareEnumerator<Token> reader, IParserContext context) { var scope = context.AcquireScope(); reader.VerifyExpectedToken(Keywords.Do); reader.MoveNext(); var statements = new List<LuaStatement>(); while (reader.Current.Value != Keywords.End) statements.Add(SyntaxParser.ReadStatement(reader, context)); reader.VerifyExpectedTokenAndMoveNext(Keywords.End); context.ReleaseScope(scope); return new DoEndBlock(new StatementBlock(statements)); }
public LuaStatement Parse(INextAwareEnumerator <Token> reader, IParserContext context) { var scope = context.AcquireScope(); reader.VerifyExpectedToken(Keywords.Do); reader.MoveNext(); var statements = new List <LuaStatement>(); while (reader.Current.Value != Keywords.End) { statements.Add(SyntaxParser.ReadStatement(reader, context)); } reader.VerifyExpectedTokenAndMoveNext(Keywords.End); context.ReleaseScope(scope); return(new DoEndBlock(new StatementBlock(statements))); }
public override LuaStatement Parse(INextAwareEnumerator<Token> reader, IParserContext context) { reader.VerifyExpectedTokenAndMoveNext(Keywords.For); var scope = context.AcquireScope(); reader.VerifyIsIdentifier(); var forVariableName = reader.GetAndMoveNext(); reader.VerifyExpectedTokenAndMoveNext(LuaToken.EqualsSign); var conditionsParser = new ExpressionListParser(); var conditions = conditionsParser.Parse(reader, context).ToList(); reader.VerifyExpectedTokenAndMoveNext(Keywords.Do); var statementsParser = new StatementBlockParser(Keywords.End); var bodyBlock = statementsParser.ParseBlock(reader, context); context.ReleaseScope(scope); return new ForStatement(conditions,bodyBlock); }
public LuaStatement Parse(INextAwareEnumerator <Token> reader, IParserContext context) { reader.VerifyExpectedTokenAndMoveNext(Keywords.For); var scope = context.AcquireScope(); reader.VerifyIsIdentifier(); var forVariableName = reader.GetAndMoveNext(); reader.VerifyExpectedTokenAndMoveNext(LuaToken.EqualsSign); var conditionsParser = new ExpressionListParser(); var conditions = conditionsParser.Parse(reader, context).ToList(); reader.VerifyExpectedTokenAndMoveNext(Keywords.Do); var statementsParser = new StatementBlockParser(Keywords.End); var bodyBlock = statementsParser.ParseBlock(reader, context); context.ReleaseScope(scope); return(new ForStatement(conditions, bodyBlock)); }