Examples of TwigScriptRegion


Examples of com.dubture.twig.core.documentModel.parser.regions.TwigScriptRegion

            assertEquals(3, textRegions.size());
            assertEquals(TwigRegionContext.TWIG_OPEN, textRegions.get(0).getType());
            assertEquals(TwigRegionContext.TWIG_CONTENT, textRegions.get(1).getType());
            assertEquals(TwigRegionContext.TWIG_CLOSE, textRegions.get(2).getType());

            TwigScriptRegion region = (TwigScriptRegion) textRegions.get(1);
            assertNotNull(region);
            assertEquals(9, region.getTokenCount());
            assertEquals(TwigRegionContext.TWIG_INTERPOLATION_START, region.getTwigToken(6).getType());
            assertEquals(TwigRegionContext.TWIG_LABEL, region.getTwigToken(8).getType());

        } catch (Exception e) {
            e.printStackTrace();
            fail();
        }
View Full Code Here

Examples of com.dubture.twig.core.documentModel.parser.regions.TwigScriptRegion

            assertEquals(textRegions.get(1).getType(),
                    TwigRegionContext.TWIG_CONTENT);
            assertEquals(textRegions.get(2).getType(),
                    TwigRegionContext.TWIG_CLOSE);

            TwigScriptRegion scriptRegion = (TwigScriptRegion) textRegions
                    .get(1);
            assertNotNull(scriptRegion);

            assertEquals(12, scriptRegion.getTokenCount());

            assertEquals(scriptRegion.getTwigToken(0).getType(),
                    TwigRegionContext.TWIG_LABEL);
            assertEquals(scriptRegion.getTwigToken(1).getType(),
                    TwigRegionContext.TWIG_LABEL);
            assertEquals(scriptRegion.getTwigToken(6).getType(),
                    TwigRegionContext.TWIG_CONSTANT_ENCAPSED_STRING);
            assertEquals(scriptRegion.getTwigToken(16).getType(),
                    TwigRegionContext.TWIG_CONSTANT_ENCAPSED_STRING);

        } catch (Exception e) {

            fail();
View Full Code Here

Examples of com.dubture.twig.core.documentModel.parser.regions.TwigScriptRegion

                    TwigRegionContext.TWIG_CONTENT);
            assertEquals(contextRegions.get(2).getType(),
                    TwigRegionContext.TWIG_CLOSE);
            assertTrue(contextRegions.get(1) instanceof TwigScriptRegion);

            TwigScriptRegion twigRegion = (TwigScriptRegion) contextRegions
                    .get(1);
            assertEquals(twigRegion.getTwigToken(0).getType(),
                    TwigRegionContext.TWIG_WHITESPACE);

        } catch (Exception e) {
            e.printStackTrace();
            fail();
View Full Code Here

Examples of com.dubture.twig.core.documentModel.parser.regions.TwigScriptRegion

                textRegions.push(region);

            }

            assertEquals(5, textRegions.size());
            TwigScriptRegion twigRegion = (TwigScriptRegion) textRegions.get(2);
            assertNotNull(twigRegion);
            assertEquals(twigRegion.getTwigToken(0).getType(),
                    TwigRegionContext.TWIG_WHITESPACE);

        } catch (Exception e) {

            e.printStackTrace();
View Full Code Here

Examples of com.dubture.twig.core.documentModel.parser.regions.TwigScriptRegion

        String newline = document.getLineDelimiter();
        for (int i = 0; i < textRegions.size(); i++) {
            ITextRegion textRegion = textRegions.get(i);
            if (textRegion instanceof TwigScriptRegion) {
                int startOffset = sdRegion.getStartOffset(textRegion);
                TwigScriptRegion scriptRegion = (TwigScriptRegion) textRegion;
                ITextRegion[] twigTokens;
                try {
                    twigTokens = scriptRegion.getTwigTokens(0,
                            textRegion.getLength());
                    for (int j = twigTokens.length - 1; j >= 0; j--) {
                        ITextRegion phpToken = twigTokens[j];
                        int start = startOffset + phpToken.getStart();
                        int end = start + phpToken.getLength();
View Full Code Here

Examples of com.dubture.twig.core.documentModel.parser.regions.TwigScriptRegion

 
  String lexerState = "ST_" + searchContext;
 
  final AbstractTwigLexer twigLexer = getTwigLexer(stateHint);
  bufferedTextRegion = new TwigScriptRegion(searchContext, yychar, project, twigLexer, stateHint);
 
  if (Debug.debugTokenizer)
    System.err.println("created twig script region between " + bufferedTextRegion.getStart() + " and " + bufferedTextRegion.getEnd())

  // restore the locations / states
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.