// Begin ISTypeCast
        bool IsTypeCast()
        {
            if (la.kind != Tokens.OpenParenthesis)
            {
                return(false);
            }
            bool isPossibleExpression = true;

            lexer.StartPeek();
            Token pt = lexer.Peek();

            if (!IsTypeNameOrKWForTypeCast(ref pt, ref isPossibleExpression))
            {
                return(false);
            }

            // ")"
            if (pt.kind != Tokens.CloseParenthesis)
            {
                return(false);
            }
            if (isPossibleExpression)
            {
                // check successor
                pt = lexer.Peek();
                return(Tokens.CastFollower[pt.kind]);
            }
            else
            {
                // not possibly an expression: don't check cast follower
                return(true);
            }
        }
示例#2
0
        // "(" ( typeKW [ "[" {","} "]" | "*" ] | void  ( "[" {","} "]" | "*" ) ) ")"
        // only for built-in types, all others use GuessTypeCast!
        bool IsSimpleTypeCast()
        {
            // assert: la.kind == _lpar
            lexer.StartPeek();
            Token pt = lexer.Peek();

            if (!IsTypeKWForTypeCast(ref pt))
            {
                return(false);
            }
            if (pt.kind == Tokens.Question)
            {
                pt = lexer.Peek();
            }
            return(pt.kind == Tokens.CloseParenthesis);
        }