Package com.dubture.twig.core.documentModel.parser

Examples of com.dubture.twig.core.documentModel.parser.TwigLexer


    }

    private TwigLexer getTwigLexer(Reader stream, LexerState startState)
    {

        final TwigLexer lexer = new TwigLexer(stream);
        lexer.initialize(ST_TWIG_CONTENT);
        lexer.setPatterns(project);

        // set the wanted state
        if (startState != null) {
            startState.restoreState(lexer);
        }
View Full Code Here


                    .getState(newTokenOffset);
            final LexerState endState = tokensContainer.getState(tokenEnd
                    .getEnd() + 1);

            final TwigTokenContainer newContainer = new TwigTokenContainer();
            final TwigLexer twigLexer = getTwigLexer(new DocumentReader(
                    flatnode, changes, requestStart, lengthToReplace,
                    newTokenOffset), startState);

            Object state = startState;
            try {
                String yylex = twigLexer.getNextToken();
                if (shouldDeprecatedKeyword
                        && TwigTokenContainer.isKeyword(yylex)) {
                    yylex = TwigRegionTypes.PHP_STRING;
                }
                int yylength;
                final int toOffset = offset + length;
                while (yylex != null
                        && newTokenOffset <= toOffset
                        && (yylex != TwigRegionTypes.TWIG_COMMENT_CLOSE
                                && yylex != TwigRegionTypes.TWIG_CLOSETAG && yylex != TwigRegionTypes.TWIG_STMT_CLOSE)) {

                    yylength = twigLexer.getLength();
                    newContainer.addLast(yylex, newTokenOffset, yylength,
                            yylength, state);
                    newTokenOffset += yylength;
                    state = twigLexer.createLexicalStateMemento();
                    yylex = twigLexer.getNextToken();
                }
                if (yylex == TwigRegionTypes.WHITESPACE) {
                    yylength = twigLexer.getLength();
                    newContainer.adjustWhitespace(yylex, newTokenOffset,
                            yylength, yylength, state);
                }
            } catch (IOException e) {
                Logger.logException(e);
View Full Code Here

TOP

Related Classes of com.dubture.twig.core.documentModel.parser.TwigLexer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.