Пример #1
0
        /// <summary>
        /// Initializes the contents of the expression.
        /// </summary>
        private void Initialize()
        {
            OpenParenthesisToken openParen = this.FindFirstChild <OpenParenthesisToken>();

            if (openParen == null)
            {
                throw new SyntaxException(this.Document, this.LineNumber);
            }

            LiteralExpression literal = openParen.FindNextSibling <LiteralExpression>();

            if (literal == null)
            {
                throw new SyntaxException(this.Document, this.LineNumber);
            }

            this.type.Value = CodeParser.ExtractTypeTokenFromLiteralExpression(literal);

            CloseParenthesisToken closeParen = literal.FindNextSibling <CloseParenthesisToken>();

            if (closeParen == null)
            {
                throw new SyntaxException(this.Document, this.LineNumber);
            }

            this.castedExpression.Value = closeParen.FindNextSibling <Expression>();
            if (this.castedExpression.Value == null)
            {
                throw new SyntaxException(this.Document, this.LineNumber);
            }
        }
Пример #2
0
        /// <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.fixedVariable.Value = openParen.FindNextSibling <VariableDeclarationExpression>();
            if (this.fixedVariable.Value == null)
            {
                throw new SyntaxException(this.Document, this.LineNumber);
            }

            CloseParenthesisToken closeParen = this.fixedVariable.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);
            }
        }
Пример #3
0
        /// <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.initializers.Value = this.FindInitializers(openParen);
            if (this.initializers.Value == null)
            {
                throw new SyntaxException(this.Document, this.LineNumber);
            }

            SemicolonToken semicolon = openParen.FindNextSibling <SemicolonToken>();

            if (semicolon == null)
            {
                throw new SyntaxException(this.Document, this.LineNumber);
            }

            this.condition.Value = this.FindCondition(semicolon);

            semicolon = semicolon.FindNextSibling <SemicolonToken>();
            if (semicolon == null)
            {
                throw new SyntaxException(this.Document, this.LineNumber);
            }

            this.iterators.Value = this.FindIterators(semicolon);
            if (this.iterators.Value == null)
            {
                throw new SyntaxException(this.Document, this.LineNumber);
            }

            CloseParenthesisToken closeParen = semicolon.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);
            }
        }