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

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


    public void testHighlighter()
    {

        try {
            tokens = "{{ some('function') }}";
            tokenizer = new TwigTokenizer(tokens.toCharArray());
            textRegions = new Stack<ITextRegion>();
            assertTrue(textRegions.size() == 0);

            while (!tokenizer.isEOF()) {
                ITextRegion region = tokenizer.getNextToken();
View Full Code Here


    {

        try {

            tokens = "{# foobar #}";
            tokenizer = new TwigTokenizer(tokens.toCharArray());
            textRegions = new Stack<ITextRegion>();
            assertTrue(textRegions.size() == 0);

            while (!tokenizer.isEOF()) {
                ITextRegion region = tokenizer.getNextToken();
View Full Code Here

                    "XML_CONTENT", "XML_END_TAG_OPEN", "XML_TAG_NAME",
                    "XML_TAG_CLOSE", "XML_CONTENT", "XML_END_TAG_OPEN",
                    "XML_TAG_NAME", "XML_TAG_CLOSE"};

            tokens = loadTemplate("full.twig");
            tokenizer = new TwigTokenizer(tokens.toCharArray());
            textRegions = new Stack<ITextRegion>();
            assertTrue(textRegions.size() == 0);

            while (!tokenizer.isEOF()) {
                ITextRegion region = tokenizer.getNextToken();
View Full Code Here

    {

        try {

            tokens = "{{ \"foo #{ baz } \" }}";
            tokenizer = new TwigTokenizer(tokens.toCharArray());
            textRegions = new Stack<ITextRegion>();
            assertTrue(textRegions.size() == 0);

            while (!tokenizer.isEOF()) {
                ITextRegion region = tokenizer.getNextToken();
View Full Code Here

    {

        try {

            tokens = "Welcome {% endblock %}";
            tokenizer = new TwigTokenizer(tokens.toCharArray());
            textRegions = new Stack<ITextRegion>();
            assertTrue(textRegions.size() == 0);

            while (!tokenizer.isEOF()) {
                ITextRegion region = tokenizer.getNextToken();
View Full Code Here

    public void testEmbeddedRegion()
    {

        try {
            String tokens = "<a href=\"{{ }}\"></a>";
            tokenizer = new TwigTokenizer(tokens.toCharArray());
            textRegions = new Stack<ITextRegion>();
            assertTrue(textRegions.size() == 0);

            while (!tokenizer.isEOF()) {
                ITextRegion region = tokenizer.getNextToken();
View Full Code Here

    {

        try {

            tokens = "{{ path('_ipsum',{'foo': 'bar'}) }}";
            tokenizer = new TwigTokenizer(tokens.toCharArray());
            textRegions = new Stack<ITextRegion>();
            assertTrue(textRegions.size() == 0);

            while (!tokenizer.isEOF()) {
                ITextRegion region = tokenizer.getNextToken();
View Full Code Here

    {

        try {

            tokens = "{# \naha \nsome \ntext #}";
            tokenizer = new TwigTokenizer(tokens.toCharArray());
            textRegions = new Stack<ITextRegion>();
            assertTrue(textRegions.size() == 0);

            while (!tokenizer.isEOF()) {
                ITextRegion region = tokenizer.getNextToken();
View Full Code Here

    {

        try {

            tokens = "{# asdf #}";
            tokenizer = new TwigTokenizer(tokens.toCharArray());
            textRegions = new Stack<ITextRegion>();
            assertTrue(textRegions.size() == 0);

            while (!tokenizer.isEOF()) {
                ITextRegion region = tokenizer.getNextToken();
View Full Code Here

                    "XML_TAG_ATTRIBUTE_NAME", "XML_TAG_ATTRIBUTE_EQUALS",
                    "XML_TAG_ATTRIBUTE_VALUE", "XML_TAG_CLOSE",
                    "XML_END_TAG_OPEN", "XML_TAG_NAME", "XML_TAG_CLOSE"};

            tokens = "<div id=\"{% block 'foobar' %}\"></div>";
            tokenizer = new TwigTokenizer(tokens.toCharArray());
            textRegions = new Stack<ITextRegion>();
            assertTrue(textRegions.size() == 0);

            while (!tokenizer.isEOF()) {
                ITextRegion region = tokenizer.getNextToken();
                textRegions.push(region);
            }

            for (int i = 0; i < regions.length; i++) {
                assertEquals(regions[i], textRegions.get(i).getType());
            }

            regions = new String[]{"XML_TAG_OPEN", "XML_TAG_NAME",
                    "XML_TAG_ATTRIBUTE_NAME", "XML_TAG_ATTRIBUTE_EQUALS"};
            tokens = "<div id=\" {% block 'foobar' %}\"></div>";

            tokenizer = new TwigTokenizer(tokens.toCharArray());
            textRegions = new Stack<ITextRegion>();
            assertTrue(textRegions.size() == 0);

            while (!tokenizer.isEOF()) {
                ITextRegion region = tokenizer.getNextToken();
View Full Code Here

TOP

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

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.