Inheritance: NodeBase
Exemplo n.º 1
0
 protected bool Equals(ForeachNode other)
 {
     return(string.Equals(VariableName, other.VariableName) &&
            Equals(IterableExpression, other.IterableExpression) &&
            Equals(RangeStart, other.RangeStart) &&
            Equals(RangeEnd, other.RangeEnd) &&
            Equals(Body, other.Body));
 }
Exemplo n.º 2
0
        /// <summary>
        /// for_block                                   = "for" identifier "in" line_expr [ ".." line_expr ] "do"
        /// </summary>
        private ForeachNode parseForHeader()
        {
            if (!check(LexemType.For))
                return null;

            var node = new ForeachNode();
            node.VariableName = ensure(LexemType.Identifier, ParserMessages.VarIdentifierExpected).Value;
            ensure(LexemType.In, ParserMessages.SymbolExpected, "in");

            var iter = ensure(parseLineExpr, ParserMessages.SequenceExpected);
            if (check(LexemType.DoubleDot))
            {
                node.RangeStart = iter;
                node.RangeEnd = ensure(parseLineExpr, ParserMessages.RangeEndExpected);
            }
            else
            {
                node.IterableExpression = iter;
            }

            ensure(LexemType.Do, ParserMessages.SymbolExpected, "do");
            return node;
        }
Exemplo n.º 3
0
 protected bool Equals(ForeachNode other)
 {
     return string.Equals(VariableName, other.VariableName)
            && Equals(IterableExpression, other.IterableExpression)
            && Equals(RangeStart, other.RangeStart)
            && Equals(RangeEnd, other.RangeEnd)
            && Equals(Body, other.Body);
 }