Пример #1
0
        public virtual object VisitFixedStatement(FixedStatementStatement fixedStatement, object data)
        {
            stackMap.Push(fixedStatement);
            fixedStatement.LocalPointers.AcceptVisitor(this, data);
            fixedStatement.Statements.AcceptVisitor(this, data);

            stackMap.Pop();
            return(null);
        }
Пример #2
0
        private FixedStatementStatement ParseFixedStatement()
        {
            FixedStatementStatement ret = new FixedStatementStatement(curtok);

            AssertAndAdvance(TokenID.Fixed);
            AssertAndAdvance(TokenID.LParen);

            // parse  pointer-type   fixed-pointer-declarators
            ret.LocalPointers.Type = ParseType(false); // not sure about rank specifiers here...

            //parse 
            //  fixed-pointer-declarators:
            //      fixed-pointer-declarator
            //      fixed-pointer-declarators   ,   fixed-pointer-declarator
            //
            //  fixed-pointer-declarator:
            //      identifier   =   fixed-pointer-initializer
            //
            //  fixed-pointer-initializer:
            //      &   variable-reference
            //      expression

            if (curtok.ID != TokenID.RParen)
            {
                while (true)
                {
                    IdentifierExpression ident = (IdentifierExpression)ParseIdentifierOrKeyword(false, false, false, false, false);

                    AssertAndAdvance(TokenID.Equal);

                    ret.LocalPointers.AddDeclarator(ident, ParseExpression());

                    if (curtok.ID != TokenID.Comma)
                        break;

                    Advance();
                }
            }

            AssertAndAdvance(TokenID.RParen);

            ParseBlock(ret.Statements);

            return ret;
        }
Пример #3
0
        private FixedStatementStatement ParseFixedStatement()
		{
            FixedStatementStatement ret = new FixedStatementStatement(curtok);

            AssertAndAdvance(TokenID.Fixed);
            AssertAndAdvance(TokenID.LParen);

            // parse  pointer-type   fixed-pointer-declarators
            ret.LocalPointers.Type = ParseType();

            //parse 
            //  fixed-pointer-declarators:
            //      fixed-pointer-declarator
            //      fixed-pointer-declarators   ,   fixed-pointer-declarator
            //
            //  fixed-pointer-declarator:
            //      identifier   =   fixed-pointer-initializer
            //
            //  fixed-pointer-initializer:
            //      &   variable-reference
            //      expression

            while (curtok.ID != TokenID.RParen)
            {
                ret.LocalPointers.Identifiers.Expressions.Add( (IdentifierExpression)ParseIdentifierOrKeyword( false, false, false, false ) );

                AssertAndAdvance(TokenID.Equal);

                ret.LocalPointers.RightSide.Expressions.Add(ParseExpression(TokenID.Comma));

                if (curtok.ID == TokenID.Comma)
                {
                    Advance();
                }
            }

            AssertAndAdvance(TokenID.RParen);

            if (curtok.ID != TokenID.RCurly)
            {
                ParseBlock(ret.Statements);
            }
            else
            {
                Advance();
            }

            return ret;
		}
Пример #4
0
        public virtual object VisitFixedStatement(FixedStatementStatement fixedStatement, object data)
        {
            stackMap.Push(fixedStatement);
            fixedStatement.LocalPointers.AcceptVisitor( this, data );
            fixedStatement.Statements.AcceptVisitor( this, data );

            stackMap.Pop();
            return null;

        }