/// <summary> /// Initializes the contents of the class. /// </summary> private void Initialize() { // Find the 'let' keyword. LetToken let = this.FindFirstChild <LetToken>(); if (let == null) { throw new SyntaxException(this.Document, this.LineNumber); } Token type = let.FindNextSiblingToken(); if (type == null) { throw new SyntaxException(this.Document, this.LineNumber); } this.rangeVariable.Value = ExtractQueryVariable(type, true, true); EqualsOperator equals = type.FindNextSibling <EqualsOperator>(); if (equals == null) { throw new SyntaxException(this.Document, this.LineNumber); } this.expression.Value = equals.FindNextSiblingExpression(); if (this.expression.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; } } }