/// <summary> /// Initializes the contents of the class. /// </summary> private void Initialize() { FromToken fromToken = this.FindFirstChild <FromToken>(); if (fromToken == null) { throw new SyntaxException(this.Document, this.LineNumber); } this.rangeVariable.Value = ExtractQueryVariable(fromToken.FindNextSiblingToken(), true, false); if (this.rangeVariable.Value == null) { throw new SyntaxException(this.Document, this.LineNumber); } InToken @in = fromToken.FindNextSibling <InToken>(); if (@in == null) { throw new SyntaxException(this.Document, this.LineNumber); } this.expression.Value = @in.FindNextSiblingExpression(); if (this.expression.Value == null) { throw new SyntaxException(this.Document, this.LineNumber); } }
/// <summary> /// Initializes the contents of the statement. /// </summary> private void Initialize() { OpenParenthesisToken openParen = this.FindFirstChild <OpenParenthesisToken>(); if (openParen == null) { throw new SyntaxException(this.Document, this.LineNumber); } this.iterationVariable.Value = openParen.FindNextSibling <VariableDeclarationExpression>(); if (this.iterationVariable.Value == null) { throw new SyntaxException(this.Document, this.LineNumber); } InToken @in = openParen.FindNextSibling <InToken>(); if (@in == null) { throw new SyntaxException(this.Document, this.LineNumber); } this.collection.Value = @in.FindNextSiblingExpression(); if (this.collection.Value == null) { throw new SyntaxException(this.Document, this.LineNumber); } CloseParenthesisToken closeParen = this.collection.Value.FindNextSibling <CloseParenthesisToken>(); if (closeParen == null) { throw new SyntaxException(this.Document, this.LineNumber); } this.body.Value = closeParen.FindNextSiblingStatement(); if (this.body.Value == null) { throw new SyntaxException(this.Document, this.LineNumber); } }
/// <summary> /// Initializes the contents of the class. /// </summary> private void Initialize() { JoinToken @join = this.FindFirstChild <JoinToken>(); if (@join == null) { throw new SyntaxException(this.Document, this.LineNumber); } Token token = @join.FindNextSiblingToken(); if (token == null) { throw new SyntaxException(this.Document, this.LineNumber); } this.rangeVariable.Value = ExtractQueryVariable(token, true, false); if (this.rangeVariable.Value == null) { throw new SyntaxException(this.Document, this.LineNumber); } InToken @in = token.FindNextSibling <InToken>(); if (@in == null) { throw new SyntaxException(this.Document, this.LineNumber); } this.inExpression.Value = @in.FindNextSiblingExpression(); if (this.inExpression.Value == null) { throw new SyntaxException(this.Document, this.LineNumber); } OnToken @on = this.inExpression.Value.FindNextSibling <OnToken>(); if (@on == null) { throw new SyntaxException(this.Document, this.LineNumber); } this.onKeyExpression.Value = @on.FindNextSiblingExpression(); if (this.onKeyExpression.Value == null) { throw new SyntaxException(this.Document, this.LineNumber); } EqualsToken equals = this.onKeyExpression.Value.FindNextSibling <EqualsToken>(); if (equals == null) { throw new SyntaxException(this.Document, this.LineNumber); } this.equalsKeyExpression.Value = equals.FindNextSiblingExpression(); if (this.equalsKeyExpression.Value == null) { throw new SyntaxException(this.Document, this.LineNumber); } this.intoVariable.Value = null; for (CodeUnit c = this.equalsKeyExpression.Value.FindNextSibling(); c != null; c = c.FindNextSibling()) { if (c.Is(TokenType.Into)) { token = c.FindNextSiblingToken(); if (token == null) { throw new SyntaxException(this.Document, this.LineNumber); } this.intoVariable.Value = ExtractQueryVariable(token, true, false); if (this.intoVariable.Value == null) { throw new SyntaxException(this.Document, this.LineNumber); } break; } else if (!c.Is(CodeUnitType.LexicalElement) || c.Is(LexicalElementType.Token)) { break; } } }