コード例 #1
0
        private TreeElement CreateMissingToken()
        {
            var ppDirective = myPreProcessor.GetPPDirectiveAtOffset(myLexer.TokenStart);

            if (ppDirective != null)
            {
                return(ppDirective);
            }

            var tokenType = myLexer.TokenType;

            if (tokenType == ShaderLabTokenType.WHITESPACE)
            {
                return(new Whitespace(WhitespaceIntern.Intern(myLexer)));
            }

            if (tokenType == ShaderLabTokenType.NEW_LINE)
            {
                return(new NewLine(WhitespaceIntern.Intern(myLexer)));
            }

            return(TreeElementFactory.CreateLeafElement(myLexer));
        }
コード例 #2
0
        private TreeElement CreateMissingToken()
        {
            var directive = myPreProcessor.GetPpDirectiveAtOffset(myLexer.TokenStart);

            if (directive != null)
            {
                return(directive);
            }

            var tokenType = myLexer.TokenType;

            if (tokenType == CgTokenNodeTypes.WHITESPACE)
            {
                return(new CgWhitespaceTokenNode(WhitespaceIntern.Intern(myLexer)));
            }

            if (tokenType == CgTokenNodeTypes.NEW_LINE)
            {
                return(new CgNewLineTokenNode(WhitespaceIntern.Intern(myLexer)));
            }

            return(TreeElementFactory.CreateLeafElement(myLexer));
        }