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)); }
/// <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; }
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); }