Exemplo n.º 1
0
        /// <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);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes the contents of the expression.
        /// </summary>
        private void Initialize()
        {
            this.identifier.Value = this.FindFirstChild <LiteralExpression>();
            if (this.identifier.Value == null)
            {
                throw new SyntaxException(this.Document, this.LineNumber);
            }

            EqualsOperator equals = this.identifier.Value.FindNextSibling <EqualsOperator>();

            if (equals == null)
            {
                this.initializer.Value = null;
            }
            else
            {
                this.initializer.Value = equals.FindNextSiblingExpression();
                if (this.initializer.Value == null)
                {
                    throw new SyntaxException(this.Document, this.LineNumber);
                }
            }
        }