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

Source Code of com.dubture.twig.core.documentModel.parser.TwigTokenizer

/* The following code was generated by JFlex 1.2.2 on 7/6/12 9:26 PM */

/*******************************************************************************
* This file is part of the Twig eclipse plugin.
*
* (c) Robert Gruendler <r.gruendler@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
******************************************************************************/
/*nlsXXX*/
package com.dubture.twig.core.documentModel.parser;

import java.io.CharArrayReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import org.eclipse.core.resources.IProject;
import org.eclipse.php.internal.core.PHPVersion;
import com.dubture.twig.core.documentModel.parser.regions.TwigScriptRegion;
import org.eclipse.php.internal.core.documentModel.parser.PHPRegionContext;
import org.eclipse.php.internal.core.documentModel.parser.AbstractPhpLexer;
import org.eclipse.php.internal.core.documentModel.parser.PhpLexerFactory;
import org.eclipse.php.internal.core.documentModel.parser.regions.PhpScriptRegion;
import org.eclipse.php.internal.core.project.ProjectOptions;
import org.eclipse.wst.sse.core.internal.ltk.parser.BlockMarker;
import org.eclipse.wst.sse.core.internal.ltk.parser.BlockTokenizer;
import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion;
import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionList;
import com.dubture.twig.core.util.Debug;
import org.eclipse.wst.sse.core.utils.StringUtils;
import org.eclipse.wst.xml.core.internal.Logger;
import org.eclipse.wst.xml.core.internal.parser.ContextRegionContainer;
import org.eclipse.wst.xml.core.internal.parser.IntStack;
import org.eclipse.wst.xml.core.internal.parser.regions.XMLParserRegionFactory;
import org.eclipse.wst.xml.core.internal.regions.DOMRegionContext;




/**
* This class is a scanner generated by
* <a href="http://www.informatik.tu-muenchen.de/~kleing/jflex/">JFlex</a> 1.2.2
* on 7/6/12 9:26 PM from the specification file
* <tt>file:/Users/sobert/Documents/workspaces/juno/Twig-Eclipse-Plugin/com.dubture.twig.core/Resources/parserTools/highlighting/TwigTokenizer.jflex</tt>
*/
public class TwigTokenizer implements BlockTokenizer, PHPRegionContext, DOMRegionContext, TwigRegionContext {
  /** this character denotes the end of file */
  final public static int YYEOF = -1;

  /** lexical states */
  final public static int ST_XML_COMMENT_END = 4;
  final public static int ST_BLOCK_TAG_SCAN = 30;
  final public static int ST_DHTML_ATTRIBUTE_VALUE = 14;
  final public static int ST_XML_PI_ATTRIBUTE_NAME = 8;
  final public static int ST_DHTML_TAG_CLOSE = 15;
  final public static int ST_XML_ATTRIBUTE_VALUE_DQUOTED = 32;
  final public static int ST_DHTML_EQUALS = 13;
  final public static int ST_XML_PI_ATTRIBUTE_VALUE = 10;
  final public static int ST_XML_ATTRIBUTE_VALUE = 19;
  final public static int ST_XML_ATTRIBUTE_VALUE_SQUOTED = 31;
  final public static int ST_XML_ATTRIBUTE_NAME = 17;
  final public static int ST_XML_EQUALS = 18;
  final public static int YYINITIAL = 0;
  final public static int ST_XML_DOCTYPE_ID_SYSTEM = 25;
  final public static int ST_XML_ELEMENT_DECLARATION = 26;
  final public static int ST_XML_DECLARATION_CLOSE = 21;
  final public static int ST_TWIG_CONTENT = 34;
  final public static int ST_XML_DOCTYPE_DECLARATION = 22;
  final public static int ST_CDATA_END = 2;
  final public static int ST_PI_WS = 6;
  final public static int ST_CDATA_TEXT = 1;
  final public static int ST_XML_ELEMENT_DECLARATION_CONTENT = 27;
  final public static int ST_XML_ATTLIST_DECLARATION = 28;
  final public static int ST_XML_PI_EQUALS = 9;
  final public static int ST_XML_ATTLIST_DECLARATION_CONTENT = 29;
  final public static int ST_XML_DOCTYPE_ID_PUBLIC = 24;
  final public static int ST_DHTML_ATTRIBUTE_NAME = 12;
  final public static int ST_ABORT_EMBEDDED = 15;
  final public static int ST_XML_DOCTYPE_EXTERNAL_ID = 23;
  final public static int ST_PI_CONTENT = 7;
  final public static int ST_TWIG_COMMENT = 35;
  final public static int ST_BLOCK_TAG_INTERNAL_SCAN = 33;
  final public static int ST_PI = 5;
  final public static int ST_XML_DECLARATION = 20;
  final public static int ST_XML_TAG_NAME = 16;
  final public static int ST_XML_PI_TAG_CLOSE = 11;
  final public static int ST_XML_COMMENT = 3;

  /**
   * Translates characters to character classes
   */
  final private static String yycmap_packed =
    "\11\0\1\5\1\23\2\0\1\15\22\0\1\15\1\22\1\11\1\24"+
    "\1\71\1\20\1\12\1\13\1\17\1\17\1\17\1\17\1\17\1\7"+
    "\1\6\1\3\12\16\1\10\1\63\1\1\1\45\1\2\1\4\1\17"+
    "\1\31\1\64\1\27\1\30\1\50\1\61\1\36\1\36\1\42\1\36"+
    "\1\36\1\56\1\57\1\44\1\43\1\47\1\36\1\40\1\60\1\32"+
    "\1\62\2\36\1\55\1\46\1\36\1\26\1\0\1\21\1\0\1\10"+
    "\1\0\1\52\1\64\1\65\1\53\1\37\1\61\1\36\1\70\1\42"+
    "\2\36\1\35\1\34\1\44\1\43\1\47\1\36\1\40\1\41\1\51"+
    "\1\62\1\36\1\36\1\33\1\54\1\36\1\14\1\0\1\25\1\0"+
    "\70\0\1\67\10\0\27\66\1\0\37\66\1\0\10\66\62\66\2\0"+
    "\13\66\2\0\10\66\1\0\65\66\1\0\104\66\11\0\44\66\3\0"+
    "\2\66\4\0\36\66\70\0\131\66\22\0\7\66\16\0\2\67\56\0"+
    "\106\67\32\0\2\67\44\0\1\66\1\67\3\66\1\0\1\66\1\0"+
    "\24\66\1\0\54\66\1\0\7\66\3\0\1\66\1\0\1\66\1\0"+
    "\1\66\1\0\1\66\1\0\22\66\15\0\14\66\1\0\102\66\1\0"+
    "\14\66\1\0\44\66\1\0\4\67\11\0\65\66\2\0\2\66\2\0"+
    "\2\66\3\0\34\66\2\0\10\66\2\0\2\66\67\0\46\66\2\0"+
    "\1\66\7\0\46\66\12\0\21\67\1\0\27\67\1\0\3\67\1\0"+
    "\1\67\1\0\2\67\1\0\1\67\13\0\33\66\5\0\3\66\56\0"+
    "\32\66\5\0\1\67\12\66\10\67\15\0\12\67\6\0\1\67\107\66"+
    "\2\0\5\66\1\0\17\66\1\0\4\66\1\0\1\66\17\67\2\66"+
    "\2\67\1\0\4\67\2\0\12\67\u0207\0\3\67\1\0\65\66\2\0"+
    "\1\67\1\66\20\67\3\0\4\67\3\0\12\66\2\67\2\0\12\67"+
    "\21\0\3\67\1\0\10\66\2\0\2\66\2\0\26\66\1\0\7\66"+
    "\1\0\1\66\3\0\4\66\2\0\1\67\1\0\7\67\2\0\2\67"+
    "\2\0\3\67\11\0\1\67\4\0\2\66\1\0\3\66\2\67\2\0"+
    "\12\67\2\66\20\0\1\67\2\0\6\66\4\0\2\66\2\0\26\66"+
    "\1\0\7\66\1\0\2\66\1\0\2\66\1\0\2\66\2\0\1\67"+
    "\1\0\5\67\4\0\2\67\2\0\3\67\13\0\4\66\1\0\1\66"+
    "\7\0\12\67\2\67\3\66\14\0\3\67\1\0\7\66\1\0\1\66"+
    "\1\0\3\66\1\0\26\66\1\0\7\66\1\0\2\66\1\0\5\66"+
    "\2\0\1\67\1\66\10\67\1\0\3\67\1\0\3\67\22\0\1\66"+
    "\5\0\12\67\21\0\3\67\1\0\10\66\2\0\2\66\2\0\26\66"+
    "\1\0\7\66\1\0\2\66\2\0\4\66\2\0\1\67\1\66\6\67"+
    "\3\0\2\67\2\0\3\67\10\0\2\67\4\0\2\66\1\0\3\66"+
    "\4\0\12\67\22\0\2\67\1\0\6\66\3\0\3\66\1\0\4\66"+
    "\3\0\2\66\1\0\1\66\1\0\2\66\3\0\2\66\3\0\3\66"+
    "\3\0\10\66\1\0\3\66\4\0\5\67\3\0\3\67\1\0\4\67"+
    "\11\0\1\67\17\0\11\67\21\0\3\67\1\0\10\66\1\0\3\66"+
    "\1\0\27\66\1\0\12\66\1\0\5\66\4\0\7\67\1\0\3\67"+
    "\1\0\4\67\7\0\2\67\11\0\2\66\4\0\12\67\22\0\2\67"+
    "\1\0\10\66\1\0\3\66\1\0\27\66\1\0\12\66\1\0\5\66"+
    "\4\0\7\67\1\0\3\67\1\0\4\67\7\0\2\67\7\0\1\66"+
    "\1\0\2\66\4\0\12\67\22\0\2\67\1\0\10\66\1\0\3\66"+
    "\1\0\27\66\1\0\20\66\4\0\6\67\2\0\3\67\1\0\4\67"+
    "\11\0\1\67\10\0\2\66\4\0\12\67\221\0\56\66\1\0\1\66"+
    "\1\67\2\66\7\67\5\0\6\66\1\67\10\67\1\0\12\67\47\0"+
    "\2\66\1\0\1\66\2\0\2\66\1\0\1\66\2\0\1\66\6\0"+
    "\4\66\1\0\7\66\1\0\3\66\1\0\1\66\1\0\1\66\2\0"+
    "\2\66\1\0\2\66\1\0\1\66\1\67\2\66\6\67\1\0\2\67"+
    "\1\66\2\0\5\66\1\0\1\67\1\0\6\67\2\0\12\67\76\0"+
    "\2\67\6\0\12\67\13\0\1\67\1\0\1\67\1\0\1\67\4\0"+
    "\2\67\10\66\1\0\41\66\7\0\24\67\1\0\6\67\4\0\6\67"+
    "\1\0\1\67\1\0\25\67\3\0\7\67\1\0\1\67\346\0\46\66"+
    "\12\0\47\66\11\0\1\66\1\0\2\66\1\0\3\66\1\0\1\66"+
    "\1\0\2\66\1\0\5\66\51\0\1\66\1\0\1\66\1\0\1\66"+
    "\13\0\1\66\1\0\1\66\1\0\1\66\3\0\2\66\3\0\1\66"+
    "\5\0\3\66\1\0\1\66\1\0\1\66\1\0\1\66\1\0\1\66"+
    "\3\0\2\66\3\0\2\66\1\0\1\66\50\0\1\66\11\0\1\66"+
    "\2\0\1\66\2\0\2\66\7\0\2\66\1\0\1\66\1\0\7\66"+
    "\50\0\1\66\4\0\1\66\10\0\1\66\u0c06\0\234\66\4\0\132\66"+
    "\6\0\26\66\2\0\6\66\2\0\46\66\2\0\6\66\2\0\10\66"+
    "\1\0\1\66\1\0\1\66\1\0\1\66\1\0\37\66\2\0\65\66"+
    "\1\0\7\66\1\0\1\66\3\0\3\66\1\0\7\66\3\0\4\66"+
    "\2\0\6\66\4\0\15\66\5\0\3\66\1\0\7\66\323\0\15\67"+
    "\4\0\1\67\104\0\1\66\3\0\2\66\2\0\1\66\121\0\3\66"+
    "\u0e82\0\1\67\1\0\1\66\31\0\11\66\6\67\1\0\5\67\13\0"+
    "\124\66\4\0\2\67\2\0\2\67\2\0\132\66\1\0\3\67\6\0"+
    "\50\66\u1cd3\0\u51a6\66\u0c5a\0\u2ba4\66\134\0\u0800\0\u1ffe\0\2\0";

  /**
   * Translates characters to character classes
   */
  final private static char [] yycmap = yy_unpack_cmap(yycmap_packed);

  /**
   * Translates a state to a row index in the transition table
   */
  final private static int yy_rowMap [] = {
        0,    58,   116,   174,   232,   290,   348,   406,   464,   522,
      580,   638,   696,   754,   812,   870,   928,   98610441102,
     1160121812761334139214501508156616241682,
     1740179818561914197220302088214622042262,
     2320237824362494237824362494255223782378,
     2436261026682726278428422900295830163074,
     3132237824363190249432483306237833643364,
     3422348035383596319023783654371223783770,
     3828388639444002406023784118417642344292,
     4350440826682378446645244582464046984756,
     4814237848724930498850465104516252205278,
     5278533653945452551055685568562656845742,
     5800585858585916597460326090614823786206,
     6264626463226380643864966554237866122378,
     2436249466706728237867866844690223786960,
     2610261023782436249470187076237824362494,
     7134237871927250730873667424748275407598,
     2610765677147772237878307888794623782378,
     3364348023783538800436543770382880623886,
     2378812039448178237882364466829446402378,
     4698835284107192846885268584504623788642,
     8700527887585336237888168874893289328990,
     9048910691645510527855689222562623789280,
     5684933893965800556858589454591623789512,
     9570962896289686974498029860991899766264,
    1003463222378, 10092, 10150, 10208, 10208, 10266, 10324, 10382,
    10440, 10498, 1055667866960237823782378, 10614, 10672,
     2088, 10730, 1078820882378, 108462378, 109042900, 10962,
    11020, 11078, 11136, 11194, 112528816, 11310, 113109512, 11368,
    11368, 11426, 10092, 11484, 11484, 115422378, 116002088, 11658,
    11716, 11774, 11832, 11890, 11948, 12006, 1206489909686, 12122,
    10266, 12180, 12238, 12296, 12354, 12412, 12470, 12528, 12586, 12644,
    12702, 12760, 12818, 128762900, 12934, 12992, 1305023782378,
    13108, 13166, 13224, 13282237823782378, 13340, 13398, 13456,
    13514, 13572, 136302378, 1368860906496, 13746, 13804, 13862,
    139202900
  };

  /**
   * The packed transition table of the DFA
   */
  final private static String yy_packed =
    "\1\45\1\46\10\45\1\47\1\45\1\50\3\45\1\51"+
    "\51\45\1\52\1\53\12\52\1\54\55\52\1\55\1\56"+
    "\12\55\1\57\4\55\1\60\1\55\1\61\46\55\1\62"+
    "\1\63\3\62\1\64\6\62\1\65\1\64\5\62\1\64"+
    "\46\62\1\55\1\56\5\55\1\66\4\55\1\57\6\55"+
    "\1\61\47\55\1\56\2\55\1\67\1\70\2\55\1\71"+
    "\3\55\1\57\1\70\5\55\1\70\3\55\4\71\1\72"+
    "\6\71\1\73\2\71\1\55\7\71\1\74\5\71\1\55"+
    "\3\71\1\55\1\71\2\55\1\56\2\55\1\67\1\75"+
    "\6\55\1\57\1\75\5\55\1\75\46\55\1\76\1\77"+
    "\2\76\1\100\7\76\1\101\6\76\1\61\46\76\1\55"+
    "\1\56\2\55\1\102\1\70\2\55\1\103\3\55\1\57"+
    "\1\70\5\55\1\70\3\55\16\103\1\55\15\103\1\55"+
    "\3\103\1\55\1\103\2\55\1\56\2\55\1\102\1\70"+
    "\2\55\1\103\3\55\1\57\1\70\5\55\1\70\3\55"+
    "\16\103\1\104\15\103\1\55\3\103\1\55\1\103\1\55"+
    "\1\105\1\56\1\55\1\106\1\107\1\70\3\105\1\110"+
    "\1\105\1\111\1\112\1\70\5\105\1\70\46\105\1\55"+
    "\1\56\2\55\1\113\7\55\1\57\6\55\1\61\47\55"+
    "\1\56\1\114\1\115\4\55\1\116\3\55\1\57\6\55"+
    "\1\61\3\55\16\116\1\55\15\116\1\55\3\116\1\55"+
    "\1\116\2\55\1\56\1\114\1\115\4\55\1\116\3\55"+
    "\1\57\6\55\1\61\3\55\16\116\1\117\15\116\1\55"+
    "\3\116\1\55\1\116\1\55\1\120\1\56\1\114\1\121"+
    "\1\120\1\55\3\120\1\122\1\120\1\123\1\124\1\55"+
    "\5\120\1\61\46\120\1\55\1\56\12\55\1\57\6\55"+
    "\1\61\46\55\1\125\1\46\1\126\1\127\4\125\1\130"+
    "\16\125\16\131\1\125\15\131\1\125\3\131\1\125\1\131"+
    "\1\125\1\55\1\132\1\126\1\127\1\55\1\133\2\55"+
    "\1\134\3\55\1\135\1\133\5\55\1\133\3\55\16\134"+
    "\1\55\15\134\1\55\3\134\1\55\1\134\2\55\1\132"+
    "\1\126\1\127\1\55\1\133\2\55\1\134\3\55\1\135"+
    "\1\133\5\55\1\133\3\55\16\134\1\136\15\134\1\55"+
    "\3\134\1\55\1\134\1\55\1\137\1\140\1\126\1\141"+
    "\1\137\1\133\3\137\1\142\1\137\1\143\1\144\1\133"+
    "\5\137\1\133\46\137\1\55\1\145\1\146\2\55\1\133"+
    "\6\55\1\135\1\133\5\55\1\133\4\55\1\147\1\150"+
    "\5\55\1\151\10\55\1\151\1\55\1\150\1\147\17\55"+
    "\1\56\1\146\2\55\1\133\6\55\1\135\1\133\5\55"+
    "\1\133\2\55\1\152\44\55\1\56\1\146\2\55\1\133"+
    "\2\55\1\153\3\55\1\135\1\133\5\55\1\133\2\55"+
    "\1\152\16\153\1\55\15\153\1\55\3\153\1\55\1\153"+
    "\2\55\1\56\1\146\2\55\1\133\6\55\1\135\1\133"+
    "\5\55\1\133\2\55\1\152\12\55\1\154\5\55\1\155"+
    "\10\55\1\154\11\55\1\156\1\56\1\146\1\157\1\156"+
    "\1\133\3\156\1\160\1\156\1\161\1\162\1\133\5\156"+
    "\1\133\2\156\1\163\43\156\1\164\1\56\1\146\1\165"+
    "\1\164\1\133\3\164\1\166\1\164\1\167\1\170\1\133"+
    "\5\164\1\133\2\164\1\171\43\164\1\172\1\56\1\146"+
    "\1\173\1\172\1\133\3\172\1\174\1\172\1\175\1\176"+
    "\1\133\5\172\1\133\46\172\1\177\1\200\1\201\11\177"+
    "\1\202\55\177\1\203\1\56\1\146\1\204\1\203\1\133"+
    "\3\203\1\205\1\203\1\206\1\207\1\133\5\203\1\133"+
    "\46\203\1\210\1\211\1\212\11\210\1\213\55\210\1\214"+
    "\1\215\12\214\1\216\55\214\5\217\1\220\5\217\1\221"+
    "\1\135\1\220\5\217\1\220\1\222\44\217\1\222\5\223"+
    "\1\224\3\223\1\225\2\223\1\135\1\224\5\223\1\224"+
    "\1\226\44\223\1\226\1\55\1\56\3\55\1\227\6\55"+
    "\1\135\1\227\5\55\1\230\46\55\1\231\1\232\12\231"+
    "\1\233\3\231\1\234\4\231\1\235\44\231\1\236\1\237"+
    "\12\236\1\240\7\236\1\241\45\236\1\45\1\0\70\45"+
    "\3\0\1\242\16\0\1\243\47\0\1\45\1\0\6\45"+
    "\1\244\13\45\1\245\2\45\16\244\1\45\15\244\1\45"+
    "\3\244\1\45\1\244\2\45\1\0\16\45\1\246\52\45"+
    "\1\0\6\45\1\247\16\45\16\247\1\45\15\247\1\45"+
    "\3\247\1\45\1\247\1\45\114\0\1\250\67\0\1\251"+
    "\72\0\1\252\55\0\1\253\6\0\1\254\1\253\5\0"+
    "\1\253\62\0\1\255\3\0\1\251\60\0\1\256\64\0"+
    "\1\257\74\0\1\70\7\0\1\70\5\0\1\70\54\0"+
    "\3\71\5\0\1\71\10\0\16\71\1\0\15\71\1\0"+
    "\5\71\7\0\3\71\5\0\1\71\10\0\5\71\1\260"+
    "\10\71\1\0\11\71\1\261\3\71\1\0\5\71\7\0"+
    "\3\71\5\0\1\71\10\0\5\71\1\262\10\71\1\0"+
    "\11\71\1\262\3\71\1\0\5\71\7\0\3\71\5\0"+
    "\1\71\10\0\5\71\1\261\10\71\1\0\11\71\1\261"+
    "\3\71\1\0\5\71\6\0\1\75\7\0\1\75\5\0"+
    "\1\75\50\0\1\263\71\0\1\264\75\0\3\103\5\0"+
    "\1\103\10\0\16\103\1\0\15\103\1\0\5\103\1\0"+
    "\1\105\2\0\1\265\1\105\1\0\3\105\1\0\1\105"+
    "\1\0\1\105\1\0\5\105\1\0\47\105\1\0\1\264"+
    "\1\265\1\105\1\0\3\105\1\0\1\105\1\0\1\105"+
    "\1\0\5\105\1\0\46\105\11\266\1\267\2\266\1\0"+
    "\55\266\13\270\1\267\1\0\55\270\1\105\2\0\1\265"+
    "\1\105\1\0\3\105\1\0\1\105\1\0\1\105\1\0"+
    "\2\105\1\271\2\105\1\0\46\105\2\0\1\114\1\272"+
    "\74\0\3\116\5\0\1\116\10\0\16\116\1\0\15\116"+
    "\1\0\5\116\1\0\1\120\2\0\1\273\1\120\1\0"+
    "\3\120\1\0\1\120\1\0\1\120\1\0\5\120\1\0"+
    "\47\120\1\0\1\114\1\274\1\120\1\0\3\120\1\0"+
    "\1\120\1\0\1\120\1\0\5\120\1\0\46\120\1\122"+
    "\2\275\1\276\1\122\1\275\3\122\1\277\1\122\1\275"+
    "\1\120\1\275\5\122\1\275\46\122\1\123\2\300\1\301"+
    "\1\123\1\300\3\123\1\300\1\123\1\277\1\120\1\300"+
    "\5\123\1\300\46\123\1\120\2\0\1\273\1\120\1\0"+
    "\3\120\1\0\1\120\1\0\1\120\1\0\2\120\1\302"+
    "\2\120\1\0\46\120\1\125\3\0\23\125\16\0\1\125"+
    "\15\0\1\125\3\0\1\125\1\0\1\125\2\0\1\303"+
    "\67\0\1\125\3\0\2\125\3\130\5\125\1\130\10\125"+
    "\16\131\1\125\15\131\1\125\3\131\1\130\1\131\1\125"+
    "\6\0\3\131\5\0\1\131\10\0\16\131\1\0\15\131"+
    "\1\0\5\131\4\0\1\242\4\0\1\304\11\0\1\243"+
    "\4\0\16\304\1\0\15\304\1\0\3\304\1\0\1\304"+
    "\6\0\1\133\6\0\1\254\1\133\5\0\1\133\54\0"+
    "\3\134\5\0\1\134\10\0\16\134\1\0\15\134\1\0"+
    "\5\134\1\0\1\137\2\0\1\305\1\137\1\0\3\137"+
    "\1\0\1\137\1\0\1\137\1\0\5\137\1\0\46\137"+
    "\3\0\1\242\4\0\1\306\11\0\1\243\4\0\16\306"+
    "\1\0\15\306\1\0\3\306\1\0\1\306\1\0\1\137"+
    "\1\0\1\303\1\305\1\137\1\0\3\137\1\0\1\137"+
    "\1\0\1\137\1\0\5\137\1\0\46\137\11\307\1\310"+
    "\2\307\1\0\55\307\13\311\1\310\1\0\55\311\1\137"+
    "\2\0\1\305\1\137\1\0\3\137\1\0\1\137\1\0"+
    "\1\312\1\0\2\137\1\313\2\137\1\0\46\137\3\0"+
    "\1\242\16\0\1\314\112\0\1\315\60\0\1\316\16\0"+
    "\1\316\55\0\1\317\20\0\1\317\13\0\21\320\1\321"+
    "\50\320\6\0\3\153\5\0\1\153\10\0\16\153\1\0"+
    "\15\153\1\0\5\153\47\0\1\322\5\0\1\322\77\0"+
    "\1\323\7\0\1\156\2\0\1\324\1\156\1\0\3\156"+
    "\1\0\1\156\1\0\1\156\1\0\5\156\1\0\46\156"+
    "\1\160\2\325\1\326\1\160\1\325\3\160\1\327\1\160"+
    "\1\325\1\156\1\325\5\160\1\325\46\160\1\330\2\331"+
    "\1\332\1\333\1\331\3\333\1\331\1\330\1\334\1\156"+
    "\1\335\3\333\1\330\1\333\1\335\1\333\2\330\37\333"+
    "\2\330\2\333\1\156\2\0\1\324\1\156\1\0\3\156"+
    "\1\0\1\156\1\0\1\336\1\0\2\156\1\337\2\156"+
    "\1\0\46\156\1\163\2\320\1\340\1\163\1\320\3\163"+
    "\1\320\1\163\1\320\1\163\1\320\3\163\1\341\1\163"+
    "\1\320\46\163\1\164\2\0\1\342\1\164\1\0\3\164"+
    "\1\0\1\164\1\0\1\164\1\0\5\164\1\0\46\164"+
    "\1\166\2\343\1\344\1\166\1\343\3\166\1\345\1\166"+
    "\1\343\1\166\1\343\5\166\1\343\46\166\1\167\2\346"+
    "\1\347\1\167\1\346\3\167\1\346\1\167\1\345\1\167"+
    "\1\346\5\167\1\346\46\167\1\164\2\0\1\342\1\164"+
    "\1\0\3\164\1\0\1\164\1\0\1\350\1\0\2\164"+
    "\1\351\2\164\1\0\46\164\1\171\2\320\1\352\1\171"+
    "\1\320\3\171\1\320\1\171\1\320\1\171\1\320\3\171"+
    "\1\353\1\171\1\320\46\171\1\172\2\0\1\354\1\172"+
    "\1\0\3\172\1\0\1\172\1\0\1\172\1\0\5\172"+
    "\1\0\46\172\1\174\2\355\1\356\1\174\1\355\3\174"+
    "\1\357\1\174\1\355\1\172\1\355\5\174\1\355\46\174"+
    "\1\360\2\361\1\362\1\363\1\361\3\363\1\361\1\360"+
    "\1\364\1\172\1\365\3\363\1\360\1\363\1\365\1\363"+
    "\2\360\37\363\2\360\2\363\1\172\2\0\1\354\1\172"+
    "\1\0\3\172\1\0\1\172\1\0\1\366\1\0\2\172"+
    "\1\367\2\172\1\0\46\172\2\177\1\0\71\177\1\0"+
    "\17\177\1\370\51\177\1\0\15\177\1\371\51\177\1\203"+
    "\2\0\1\372\1\203\1\0\3\203\1\0\1\203\1\0"+
    "\1\203\1\0\5\203\1\0\46\203\1\205\2\373\1\374"+
    "\1\205\1\373\3\205\1\375\1\205\1\373\1\203\1\373"+
    "\5\205\1\373\46\205\1\376\2\377\1\u0100\1\u0101\1\377"+
    "\3\u0101\1\377\1\376\1\u0102\1\203\1\u0103\3\u0101\1\376"+
    "\1\u0101\1\u0103\1\u0101\2\376\37\u0101\2\376\2\u0101\1\203"+
    "\2\0\1\372\1\203\1\0\3\203\1\0\1\203\1\0"+
    "\1\u0104\1\0\2\203\1\u0105\2\203\1\0\46\203\2\210"+
    "\1\0\71\210\1\0\17\210\1\u0106\51\210\1\0\15\210"+
    "\1\u0107\51\210\13\217\2\0\7\217\1\u0108\44\217\1\u0108"+
    "\5\217\1\220\5\217\1\0\1\254\1\220\5\217\1\220"+
    "\1\u0108\44\217\1\u0108\14\217\1\0\55\217\11\223\1\0"+
    "\2\223\1\0\7\223\1\u0109\44\223\1\u0109\5\223\1\224"+
    "\3\223\1\0\2\223\1\254\1\224\5\223\1\224\1\u0109"+
    "\44\223\1\u0109\14\223\1\0\55\223\25\0\1\u010a\71\0"+
    "\1\u010b\71\0\1\u010c\53\0\1\u010d\16\0\1\u010e\43\0"+
    "\1\45\1\0\4\45\3\244\5\45\1\244\10\45\16\244"+
    "\1\45\15\244\1\u010f\5\244\2\45\1\0\14\45\1\u0110"+
    "\14\45\1\u0111\37\45\1\0\3\45\1\246\7\45\1\246"+
    "\5\45\1\246\47\45\1\0\4\45\3\247\5\45\1\247"+
    "\10\45\16\247\1\45\15\247\1\u0112\5\247\1\45\26\0"+
    "\1\u010e\50\0\1\251\7\0\1\251\5\0\1\251\50\0"+
    "\1\u0113\103\0\1\255\3\0\1\u0114\56\0\1\255\7\0"+
    "\1\255\5\0\1\255\50\0\1\u0115\75\0\3\71\5\0"+
    "\1\71\10\0\6\71\1\u0116\7\71\1\0\10\71\1\u0117"+
    "\4\71\1\0\5\71\7\0\3\71\5\0\1\71\10\0"+
    "\6\71\1\u0117\7\71\1\0\10\71\1\u0117\4\71\1\0"+
    "\5\71\7\0\3\71\5\0\1\71\10\0\16\71\1\0"+
    "\1\71\1\u0118\13\71\1\0\5\71\1\0\1\105\2\0"+
    "\1\265\1\105\1\251\3\105\1\0\1\105\1\0\1\105"+
    "\1\251\5\105\1\251\46\105\11\275\1\277\2\275\1\0"+
    "\55\275\13\300\1\277\1\0\55\300\1\120\2\0\1\273"+
    "\1\120\1\251\3\120\1\0\1\120\1\0\1\120\1\251"+
    "\5\120\1\251\46\120\6\0\3\304\5\0\1\304\10\0"+
    "\16\304\1\0\15\304\1\0\5\304\7\0\3\306\5\0"+
    "\1\306\10\0\16\306\1\0\15\306\1\0\5\306\1\0"+
    "\1\137\2\0\1\305\1\137\1\255\3\137\1\0\1\137"+
    "\1\0\1\137\1\255\5\137\1\255\47\137\2\0\1\305"+
    "\1\137\1\251\3\137\1\0\1\137\1\0\1\137\1\251"+
    "\5\137\1\251\46\137\27\0\1\u0119\35\0\1\u0119\36\0"+
    "\1\u011a\16\0\1\u011a\57\0\1\u011b\10\0\1\u011b\62\0"+
    "\1\u011c\16\0\1\u011c\75\0\1\u011d\5\0\11\325\1\327"+
    "\2\325\1\0\55\325\1\330\2\331\1\u011e\1\330\1\331"+
    "\3\330\1\331\1\330\1\327\1\156\1\331\5\330\1\331"+
    "\46\330\13\331\1\327\1\0\55\331\1\330\2\331\1\u011e"+
    "\1\330\1\331\3\330\1\331\1\330\1\u011f\1\156\1\331"+
    "\5\330\1\331\46\330\13\0\1\u0120\56\0\13\331\1\u011f"+
    "\1\0\55\331\1\156\2\0\1\324\1\156\1\255\3\156"+
    "\1\0\1\156\1\0\1\156\1\255\5\156\1\255\47\156"+
    "\2\0\1\324\1\156\1\251\3\156\1\0\1\156\1\0"+
    "\1\156\1\251\5\156\1\251\46\156\11\343\1\345\60\343"+
    "\13\346\1\345\56\346\1\164\2\0\1\342\1\164\1\255"+
    "\3\164\1\0\1\164\1\0\1\164\1\255\5\164\1\255"+
    "\47\164\2\0\1\342\1\164\1\251\3\164\1\0\1\164"+
    "\1\0\1\164\1\251\5\164\1\251\46\164\11\355\1\357"+
    "\2\355\1\0\55\355\1\360\2\361\1\u0121\1\360\1\361"+
    "\3\360\1\361\1\360\1\357\1\172\1\361\5\360\1\361"+
    "\46\360\13\361\1\357\1\0\55\361\1\360\2\361\1\u0121"+
    "\1\360\1\361\3\360\1\361\1\360\1\u0122\1\172\1\361"+
    "\5\360\1\361\46\360\13\0\1\u0123\56\0\13\361\1\u0122"+
    "\1\0\55\361\1\172\2\0\1\354\1\172\1\255\3\172"+
    "\1\0\1\172\1\0\1\172\1\255\5\172\1\255\47\172"+
    "\2\0\1\354\1\172\1\251\3\172\1\0\1\172\1\0"+
    "\1\172\1\251\5\172\1\251\46\172\2\177\1\0\23\177"+
    "\1\u0124\45\177\1\0\2\177\1\371\7\177\1\371\5\177"+
    "\1\371\46\177\11\373\1\375\2\373\1\0\55\373\1\376"+
    "\2\377\1\u0125\1\376\1\377\3\376\1\377\1\376\1\375"+
    "\1\203\1\377\5\376\1\377\46\376\13\377\1\375\1\0"+
    "\55\377\1\376\2\377\1\u0125\1\376\1\377\3\376\1\377"+
    "\1\376\1\u0126\1\203\1\377\5\376\1\377\46\376\13\0"+
    "\1\u0127\56\0\13\377\1\u0126\1\0\55\377\1\203\2\0"+
    "\1\372\1\203\1\255\3\203\1\0\1\203\1\0\1\203"+
    "\1\255\5\203\1\255\47\203\2\0\1\372\1\203\1\251"+
    "\3\203\1\0\1\203\1\0\1\203\1\251\5\203\1\251"+
    "\46\203\2\210\1\0\23\210\1\u0128\45\210\1\0\2\210"+
    "\1\u0107\7\210\1\u0107\5\210\1\u0107\46\210\7\0\1\u0129"+
    "\111\0\1\u012a\42\0\1\45\1\0\14\45\1\u0110\44\45"+
    "\1\u012b\7\45\1\0\14\45\1\u012c\10\45\3\u012c\5\45"+
    "\1\u012c\10\45\1\u012c\1\45\2\u012c\5\45\1\u012c\2\45"+
    "\2\u012c\4\45\5\0\1\u0114\7\0\1\u0114\5\0\1\u0114"+
    "\54\0\1\71\1\u012d\1\71\5\0\1\71\10\0\16\71"+
    "\1\0\15\71\1\0\5\71\7\0\3\71\5\0\1\71"+
    "\10\0\14\71\1\u012e\1\71\1\0\15\71\1\0\5\71"+
    "\33\0\1\u012f\16\0\1\u012f\55\0\1\u0130\20\0\1\u0130"+
    "\47\0\1\u0131\22\0\1\u0131\44\0\1\u0132\16\0\1\u0132"+
    "\55\0\1\u0133\20\0\1\u0133\16\0\2\u0134\1\0\3\u0134"+
    "\2\0\1\334\1\0\4\u0134\1\0\3\u0134\2\0\37\u0134"+
    "\2\0\2\u0134\3\0\2\u0135\1\0\3\u0135\2\0\1\364"+
    "\1\0\4\u0135\1\0\3\u0135\2\0\37\u0135\2\0\2\u0135"+
    "\2\177\1\0\24\177\1\u0136\42\177\3\0\2\u0137\1\0"+
    "\3\u0137\2\0\1\u0102\1\0\4\u0137\1\0\3\u0137\2\0"+
    "\37\u0137\2\0\2\u0137\2\210\1\0\24\210\1\u0138\42\210"+
    "\30\0\1\u0139\41\0\1\45\1\0\14\45\1\u012c\10\45"+
    "\3\u012c\5\45\1\u012c\10\45\1\u012c\1\45\2\u012c\5\45"+
    "\1\u012c\1\45\1\u012b\2\u012c\4\45\6\0\3\71\5\0"+
    "\1\71\10\0\12\71\1\u013a\3\71\1\0\15\71\1\0"+
    "\5\71\7\0\3\71\5\0\1\71\10\0\11\71\1\u013b"+
    "\4\71\1\0\15\71\1\0\5\71\47\0\1\u013c\5\0"+
    "\1\u013c\57\0\1\u013d\66\0\1\u013e\10\0\1\u013e\60\0"+
    "\1\u013f\10\0\1\u013f\63\0\1\u0140\27\0\2\177\1\0"+
    "\25\177\1\u0141\41\177\2\210\1\0\25\210\1\u0142\41\210"+
    "\31\0\1\u0143\46\0\3\71\5\0\1\71\10\0\16\71"+
    "\1\0\3\71\1\u0144\11\71\1\0\5\71\7\0\3\71"+
    "\5\0\1\71\10\0\3\71\1\u0145\12\71\1\0\3\71"+
    "\1\u0145\11\71\1\0\5\71\50\0\1\u0146\63\0\1\u0147"+
    "\16\0\1\u0147\55\0\1\u0148\61\0\1\u0149\22\0\1\u0149"+
    "\41\0\1\u014a\35\0\1\u014a\4\0\2\177\1\0\26\177"+
    "\1\u014b\40\177\2\210\1\0\26\210\1\u014c\40\210\32\0"+
    "\1\u014d\45\0\3\71\5\0\1\71\10\0\16\71\1\0"+
    "\6\71\1\u014e\6\71\1\0\5\71\40\0\1\u014f\10\0"+
    "\1\u014f\53\0\1\u0150\16\0\1\u0150\52\0\1\u0151\16\0"+
    "\1\u0151\20\0\2\177\1\0\27\177\1\u0152\37\177\2\210"+
    "\1\0\27\210\1\u0153\37\210\31\0\1\u0154\46\0\3\71"+
    "\5\0\1\71\10\0\6\71\1\u0155\7\71\1\0\15\71"+
    "\1\0\5\71\1\0\2\177\1\0\26\177\1\u0156\40\177"+
    "\2\210\1\0\26\210\1\u0157\40\210\26\0\1\u0158\51\0"+
    "\3\71\5\0\1\71\10\0\10\71\1\u0159\5\71\1\0"+
    "\15\71\1\0\5\71\1\0\2\177\1\0\23\177\1\u015a"+
    "\43\177\2\210\1\0\23\210\1\u015b\43\210\6\0\3\71"+
    "\5\0\1\71\10\0\12\71\1\u015c\3\71\1\0\15\71"+
    "\1\0\5\71\7\0\3\71\5\0\1\71\10\0\16\71"+
    "\1\0\15\71\1\0\4\71\1\u015d\7\0\3\71\5\0"+
    "\1\71\10\0\10\71\1\u015e\5\71\1\0\15\71\1\0"+
    "\5\71\7\0\3\71\5\0\1\71\10\0\10\71\1\u015f"+
    "\5\71\1\0\15\71\1\0\5\71\7\0\3\71\5\0"+
    "\1\71\10\0\16\71\1\0\3\71\1\u0160\11\71\1\0"+
    "\5\71\1\0";

  /**
   * The transition table of the DFA
   */
  final private static int yytrans [] = yy_unpack(yy_packed);


  /* error codes */
  final private static int YY_UNKNOWN_ERROR = 0;
  // final private static int YY_ILLEGAL_STATE = 1;
  final private static int YY_NO_MATCH = 2;
  final private static int YY_PUSHBACK_2BIG = 3;

  /* error messages for the codes above */
  final private static String YY_ERROR_MSG[] = {
    "Unkown internal scanner error",    //$NON-NLS-1$
    "Internal error: unknown state",    //$NON-NLS-1$
    "Error: could not match input",    //$NON-NLS-1$
    "Error: pushback value was too large"  //$NON-NLS-1$
  };

  /**
   * YY_ATTRIBUTE[aState] contains the attributes of state <code>aState</code>
   */
  private final static byte YY_ATTRIBUTE[] = {
     1000010011100010,
     1111111111111100,
     0000111119119111,
     9911111111111911,
     1119111111191191,
     1111191111111911,
     1111191111111111,
     1111111111111111,
     9111111119191111,
     9111911191111911,
     1911111010001091,
     1199009010000090,
     0191010901100000,
     9000009100110110,
     1000900110100091,
     0011011110009100,
     1101111009990011,
     1191911100000010,
     0101010190111100,
     0000010101100000,
     1101100099110199,
     9110111911111111
  };

  /** the input device */
  private java.io.Reader yy_reader;

  /** the current state of the DFA */
  private int yy_state;

  /** the current lexical state */
  private int yy_lexical_state = YYINITIAL;

  /** this buffer contains the current text to be matched and is
      the source of the yytext() string */
  private char yy_buffer[] = new char[16384];

  /** the textposition at the last accepting state */
  private int yy_markedPos;

  /** the textposition at the last state to be included in yytext */
  private int yy_pushbackPos;

  /** the current text position in the buffer */
  private int yy_currentPos;

  /** startRead marks the beginning of the yytext() string in the buffer */
  private int yy_startRead;

  /** endRead marks the last character in the buffer, that has been read
      from input */
  private int yy_endRead;

  /** number of newlines encountered up to the start of the matched text */
  private int yyline;

  /** the number of characters up to the start of the matched text */
  private int yychar;

  /**
   * the number of characters from the last newline up to the start of the
   * matched text
   */
  // private int yycolumn;

  /**
   * yy_atBOL == true <=> the scanner is currently at the beginning of a line
   */
  // private boolean yy_atBOL;

  /** yy_atEOF == true <=> the scanner has returned a value for EOF */
  private boolean yy_atEOF;
 
  /** are we inside a raw tag? **/
  private boolean insideRaw = false;
 
  private TwigTokenizer twigTokenizer = null;
 

  /** denotes if the user-EOF-code has already been executed */
  private boolean yy_eof_done;

  /* user code: */
  // where the last internal container block was found
  private int fLastInternalBlockStart = -1;

  private int fTokenCount = 0;
  // required holders for white-space compacting
  private boolean fShouldLoadBuffered = false;
  private String fBufferedContext = null;
  private String fBufferedText = null;
  private int fBufferedStart = 1;
  private int fBufferedLength = 0;
 
  // help for php container text region
  private ContextRegionContainer fBufferedEmbeddedContainer = null;
  private String f_context = null;


  // state stack for handling embedded regions
  private IntStack fStateStack = new IntStack();

  // a "hint" as to what an embedded region should be evaluated
  private String fEmbeddedHint = UNDEFINED;
  // a "hint" as to what state to enter once an embedded region has
  // been completed
  private int fEmbeddedPostState = YYINITIAL;
  // the container used to create embedded regions
  private ContextRegionContainer fEmbeddedContainer = null;
  private static final String PROXY_CONTEXT = "PROXY_CONTEXT";

  private String context = null;
  private String text = null;
  private int start = 0;
  private int textLength = 0;
  private int length = 0;

  // offset for tracking position specific block tags
  private int fOffset = 0;
 
  // the name of the current tag being opened
  private String fCurrentTagName = null;

  // the list of tag name BlockMarkers
  private List fBlockMarkers = new ArrayList();

  // required to not seek text blocks on an end tag
  private boolean fIsBlockingEnabled = false;
  private boolean fIsCaseSensitiveBlocking = true;

  // the name of the current tag inside of an embedded region
  private String internalTagName = null;
  private String internalContext = null;
 
  public static String twigLeftDelim = "{{";
  public static String twigRightDelim = "}}";
  public static String[] leftDelimiters = new String[] {"{{", "{%", "{#"};
 
  public static String stateHint; 
 
  private final XMLParserRegionFactory fRegionFactory = new XMLParserRegionFactory();
/**
* user method
*/
public final void addBlockMarker(BlockMarker marker) {
  if(containsTagName(marker.getTagName()))
    return;
  fBlockMarkers.add(marker);
}
/**
* user method
*/
public final void removeBlockMarker(BlockMarker marker) {
  fBlockMarkers.remove(marker);
}
/**
* user method
*/
public final void removeBlockMarker(String tagname) {
  if (fBlockMarkers != null) {
    Iterator blocks = fBlockMarkers.iterator();
    while (blocks.hasNext()) {
      if (((BlockMarker) blocks.next()).getTagName().equals(tagname))
        blocks.remove();
    }
  }
}
/* user method */
public boolean getBlockMarkerCaseSensitivity() {
        return getBlockMarkerCaseSensitivity(fCurrentTagName);
}
/* user method */
public boolean getBlockMarkerCaseSensitivity(String name) {
  Iterator iterator = fBlockMarkers.iterator();
  while(iterator.hasNext()) {
    BlockMarker marker = (BlockMarker)iterator.next();
    boolean casesensitive = marker.isCaseSensitive();
    if(casesensitive && marker.getTagName().equals(name))
      return casesensitive;
    else if(!casesensitive && marker.getTagName().equalsIgnoreCase(name))
      return casesensitive;
  }
  return true;
}
/* user method */
public String getBlockMarkerContext() {
  return getBlockMarkerContext(fCurrentTagName);
}
/* user method */
public String getBlockMarkerContext(String name) {
  Iterator iterator = fBlockMarkers.iterator();
  while(iterator.hasNext()) {
    BlockMarker marker = (BlockMarker)iterator.next();
    if(marker.getTagName().equals(name))
      return marker.getContext();
  }
  return BLOCK_TEXT;
}
/* user method */
public List getBlockMarkers() {
  return fBlockMarkers;
}
/* user method */
public final int getOffset() {
  return fOffset + yychar;
}
private final boolean isBlockMarker() {
  return isBlockMarker(fCurrentTagName);
}
private final boolean isBlockMarker(String tagName) {
  if (!fIsBlockingEnabled)
    return false;
  return containsTagName(tagName);
}
/**
* user method
*/
public final void beginBlockTagScan(String newTagName) {
  beginBlockMarkerScan(newTagName, BLOCK_TEXT);
}
/**
* user method
*
* Special tokenizer setup.  Allows tokenization to be initiated at the
* start of a text block within a "newTagName" tag.
*
* Example:
*  Tokenizer toker = new Tokenizer();
*  toker.setCaseSensitiveBlocking(false);
*  toker.reset(new java.io.StringReader("afiuhqwkejhtasihgalkwhtq</scripter></scr></script>asgdasga"));
*  toker.beginBlockMarkerScan("script", BLOCK_TEXT);
*  toker.getRegions();
*
* Returns:
*  BLOCK_TEXT: 0-40
*  XML_END_TAG_OPEN: 41-42
*  XML_TAG_NAME: 43-48
*  XML_TAG_CLOSE: 49-49
*  XML_CONTENT: 50-57
*
*/
public final void beginBlockMarkerScan(String newTagName, String blockcontext) {
  yybegin(ST_BLOCK_TAG_SCAN);
  fCurrentTagName = newTagName;
}
/**
* Method doScan.
*
* Returns a context region for all of the text from the current position upto the end of input or
* to right *before* the first occurence of searchString
*
* @param searchString - target string to search for ex.: "-->", "</tagname"
* @param requireTailSeparator - whether the target must be immediately followed by whitespace or '>'
* @param context - the context of the scanned region if non-zero length
* @param exitState - the state to go to if the region was of non-zero length
* @param abortState - the state to go to if the searchString was found immediately
* @return String - the context found: the desired context on a non-zero length match, the abortContext on immediate success
* @throws IOException
*/
private final String doScan(String searchString, boolean allowPHP, boolean requireTailSeparator, String searchContext, int exitState, int immediateFallbackState) throws IOException {
  boolean stillSearching = true;
  // Disable further block (probably)
  fIsBlockingEnabled = false;
  int searchStringLength = searchString.length();
  int n = 0;
  char lastCheckChar;
  int i;
  boolean same = false;
  while (stillSearching) {
    n = 0;
    // Ensure that enough data from the input exists to compare against the search String.
    n = yy_advance();
    while(n != YYEOF && yy_currentPos < searchStringLength)
      n = yy_advance();
    // If the input was too short or we've exhausted the input, stop immediately.
    if (n == YYEOF) {
      stillSearching = false;
    }
    else {
     
      /**
       * Look for starting PHPs "{?"
       */
      // Look for a PHP beginning at the current position; this case wouldn't be handled by the preceding section
      // since it relies upon *having* closeTagStringLength amount of input to work as designed.  Must be sure we don't
      // spill over the end of the buffer while checking.
      if(allowPHP && yy_startRead != fLastInternalBlockStart && yy_currentPos > 0 && yy_currentPos < yy_buffer.length - 1 &&
          yy_buffer[yy_currentPos - 1] == '{' && (yy_buffer[yy_currentPos] == '{' || (yy_buffer[yy_currentPos] == '%'))) {
        fLastInternalBlockStart = yy_markedPos = yy_currentPos - 1;
        yy_currentPos = yy_markedPos + 1;
        int resumeState = yystate();
        yybegin(ST_BLOCK_TAG_INTERNAL_SCAN);
        if(yy_markedPos == yy_startRead) {
          String jspContext = primGetNextToken();
          yybegin(resumeState);
          return jspContext;
        }
        return searchContext;
      }
     
      // 2) yy_currentPos - jspstarter.length : There's not searchStringLength of input available; check for a JSP 2 spots back in what we could read
      // ---
      // Look for a JSP beginning at the current position; this case wouldn't be handled by the preceding section
      // since it relies upon *having* closeTagStringLength amount of input to work as designed.  Must be sure we don't
      // spill over the end of the buffer while checking.
      else if(allowPHP && yy_startRead != fLastInternalBlockStart && yy_currentPos > 0 && yy_currentPos < yy_buffer.length - 1 &&
          yy_buffer[yy_currentPos - 1] == '{' && (yy_buffer[yy_currentPos] == '{' || yy_buffer[yy_currentPos] == '%')) {
        fLastInternalBlockStart = yy_markedPos = yy_currentPos - 1;
        yy_currentPos = yy_markedPos + 1;
        int resumeState = yystate();
        yybegin(ST_BLOCK_TAG_INTERNAL_SCAN);
        if(yy_markedPos == yy_startRead) {
          String jspContext = primGetNextToken();
          yybegin(resumeState);
          return jspContext;
        }
        return searchContext;
      }
      // 3) yy_currentPos..(yy_currentPos+jspStartlength-1) : Check at the start of the block one time
      // ---
      // Look for a JSP beginning immediately in the block area; this case wouldn't be handled by the preceding section
      // since it relies upon yy_currentPos equaling exactly the previous end +1 to work as designed.
      else if(allowPHP && yy_startRead != fLastInternalBlockStart && yy_startRead > 0 &&
          yy_startRead < yy_buffer.length - 1 && yy_buffer[yy_startRead] == '{' && yy_buffer[yy_startRead + 1] == '{') {
        fLastInternalBlockStart = yy_markedPos = yy_startRead;
        yy_currentPos = yy_markedPos + 1;
        int resumeState = yystate();
        yybegin(ST_BLOCK_TAG_INTERNAL_SCAN);
        if(yy_markedPos == yy_startRead) {
          String jspContext = primGetNextToken();
          yybegin(resumeState);
          return jspContext;
        }
        return searchContext;
      }

      // Check the characters in the target versus the last targetLength characters read from the buffer
      // and see if it matches
      if (n == YYEOF) {
        stillSearching = false;
      }
      else {
        same = true;
        // Ensure that we've not encountered a complete block (<%%>) that was *shorter* than the closeTagString and
        // thus found twice at current-targetLength [since the first scan would have come out this far anyway].
        // Check the characters in the target versus the last targetLength characters read from the buffer
        // and see if it matches
       
        // safety check for array accesses (yy_currentPos is the *last* character we can check against)
        if(yy_currentPos >= searchStringLength && yy_currentPos <= yy_buffer.length) {
          for(i = 0; i < searchStringLength; i++) {
            if(same && fIsCaseSensitiveBlocking)
              same = yy_buffer[i + yy_currentPos - searchStringLength] == searchString.charAt(i);
            else if(same && !fIsCaseSensitiveBlocking)
              same = Character.toLowerCase(yy_buffer[i + yy_currentPos - searchStringLength]) == Character.toLowerCase(searchString.charAt(i));
          }
        }
        // safety check failed; no match is possible right now
        else {
          same = false;
        }
      }
      if (same && requireTailSeparator && yy_currentPos < yy_buffer.length) {
        // Additional check for close tags to ensure that targetString="</script" doesn't match
        // "</scriptS"
        lastCheckChar = yy_buffer[yy_currentPos];
        // Succeed on "</script>" and "</script "
        if(lastCheckChar == '>' || Character.isWhitespace(lastCheckChar))
          stillSearching = false;
      }
      else {
        stillSearching = !same || (yy_currentPos < yy_startRead + searchStringLength);
      }
    }
  }
  if (n != YYEOF || same) {
    // We've stopped short of the end or definitely found a match
    yy_markedPos = yy_currentPos - searchStringLength;
    yy_currentPos = yy_markedPos + 1;
    // If the searchString occurs at the very beginning of what would have
    // been a Block, resume scanning normally immediately
    if (yy_markedPos == yy_startRead) {
      yybegin(immediateFallbackState);
      return primGetNextToken();
    }
  }
  else {
    // We ran through the rest of the input
    yy_markedPos = yy_currentPos;
    yy_currentPos++;
  }
  yybegin(exitState);
  // If the ending occurs at the very beginning of what would have
  // been a Block, resume scanning normally immediately
  if(yy_markedPos == yy_startRead)
    return primGetNextToken();
  return searchContext;
}

/**
* Method doScanEndTwig
*
* @see doScan(searchString, req...)
* this version can handle two strings as options to search string
* it originally written to support ?> or %> close tags to php
* The two strings must be on the same length
*
* @param isAsp - whether the asp %> close is premited
* @param context - the context of the scanned region if non-zero length
* @param exitState - the state to go to if the region was of non-zero length
* @param abortState - the state to go to if the searchString was found immediately
* @return String - the context found: the desired context on a non-zero length match, the abortContext on immediate success
* @throws IOException
*/
private ITextRegion bufferedTextRegion = null;
private final String doScanEndTwig(String searchContext, int exitState, int immediateFallbackState) throws IOException {

  if (Debug.debugTokenizer) { 
    System.err.println("do scan end twig, current pos: " + yy_currentPos)
  }
 
  yypushback(1); // begin with the last char
 
  // the phpLexer should read until the last token, so
  // the position after this method should match
  // <ST_TWIG_CONTENT> "}}" otherwise we'll
  // get an infinite loop ;)
 
  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
  reset(yy_reader, twigLexer.getZZBuffer(), twigLexer.getParamenters());
 
 
  if (Debug.debugTokenizer) { 
    System.err.println("end scan, position: " + yy_currentPos)
  }
 
 
  yybegin(exitState);
  return searchContext;
}


/**
* @param project
* @param stream
* @return a new lexer for the given project with the given stream initialized with current parameters
*/
private AbstractTwigLexer getTwigLexer(String lexerState) {

  final AbstractTwigLexer lexer = new TwigLexer(yy_reader);
  int[] currentParameters = getParamenters();
  try {
    // set initial lexer state - we use reflection here since we don't know the constant value of
    // of this state in specific PHP version lexer
    currentParameters[6] = lexer.getClass().getField(lexerState).getInt(lexer);
  } catch (Exception e) {
    Logger.logException(e);
  }
  lexer.initialize(currentParameters[6]);
  lexer.reset(yy_reader, yy_buffer, currentParameters);
  lexer.setPatterns(project);

//  lexer.setAspTags(ProjectOptions.isSupportingAspTags(project));
  return lexer;
}

// call the doScan without searching for PHP internal code
private final String doScan(String searchString, boolean requireTailSeparator, String searchContext, int exitState, int immediateFallbackState) throws IOException {
  return doScan(searchString, true, requireTailSeparator, searchContext, exitState, immediateFallbackState)
}

  /* user method */
  private final void assembleEmbeddedTagSequence(String startType, String endTagName) {
    assembleEmbeddedContainer(startType, null, endTagName);
  }
  /* user method */
  private final void assembleEmbeddedContainer(String startType, String[] endTypes) {
    assembleEmbeddedContainer(startType, endTypes, null);
  }
  /* user method */
  private final void assembleEmbeddedContainer(String startType, String endType) {
    assembleEmbeddedContainer(startType, new String[]{endType}, null);
  }
  /**
   *  user method
   *
   * Assembles an embedded container beginning with the given startType as
   * the first ContextRegion within it and of the type fEmbeddedHint.  The
   * endTypes[] array contains the context types that will cause a successful
   * exit.  Use of the endTagName parameter alters this behavior to force an
   * exit on an XML_TAG_CLOSE after seeing an XML_TAG_NAME whose significant
   * text matches the endTagName String.  All contents in between are
   * insignificant, and yes, this means comments are allowed inside.
   **/
  private final void assembleEmbeddedContainer(String startType, String[] endTypes, String endTagName) {
    // the context of the region being added to the embedded container
    internalContext = startType;
    // keep track of where this container began; to provide relative indeces for the regions
    int containerStart = yychar;
    boolean notFinished = true;
    // keep track of where we seem to be so that the endTagName can be checked
    boolean isInEndTag = false;
    boolean isInFirstTag = true;
    // create the embedded container and setup its "type"
    if (fEmbeddedContainer == null) {
      fEmbeddedContainer = new ContextRegionContainer();
      fEmbeddedContainer.setType(fEmbeddedHint);
      fEmbeddedContainer.setStart(containerStart);
      // TODO: parent region needs to be set .... but not sure where to get it from
      //    fEmbeddedContainer.setParent(parentRegion);
    }
    containerStart = fEmbeddedContainer.getStart();
    while (notFinished) {
      // add the region to the container
      if (internalContext != null && internalContext != PROXY_CONTEXT) {

        ITextRegion newToken;
        // if it is php content we extract the tokens
        if (internalContext == TWIG_CONTENT) {
          newToken = bufferedTextRegion;
          bufferedTextRegion.adjustStart(-containerStart);
        } else {
          newToken = fRegionFactory.createToken(internalContext, yychar - containerStart, yylength(), yylength());
        }
        fEmbeddedContainer.getRegions().add(newToken);
        fEmbeddedContainer.setLength(fEmbeddedContainer.getLength() + newToken.getLength() );
        fEmbeddedContainer.setTextLength(fEmbeddedContainer.getTextLength() + newToken.getLength());
        // DW, 4/16/2003 token regions no longer have parents
        //newToken.setParent(fEmbeddedContainer);
      }
      try {
        // longscan determines whether to attempt a blockTagScan within the embedded container
        boolean longscan = false;
        // save the tokenizer state in case of a block tag scan
        int previousState = yystate();
        String previousCurrentTagName = fCurrentTagName;
        int previousPostState = fEmbeddedPostState;
        String previousEmbeddedHint = fEmbeddedHint;
        // determine if a block tag scan is necessary
        if (internalContext == XML_TAG_NAME) {
          internalTagName = yytext();
          if(!isNestable(internalTagName)) {
            internalTagName = null;
            // snagged a tag name we shouldn't have
            fEmbeddedPostState = ST_ABORT_EMBEDDED;
            notFinished = false;
          }
        }
        else if (internalContext == XML_TAG_OPEN || internalContext == XML_END_TAG_OPEN) {
          internalTagName = null;
        }
        // do upkeep for endTagName usage; must be here since the next token could be the close
        if (internalContext == XML_END_TAG_OPEN) {
          isInEndTag = true;
        } else if (internalContext == XML_TAG_CLOSE) {
          isInFirstTag = isInEndTag = false;
        } else {
           ITextRegionList embeddedRegions = fEmbeddedContainer.getRegions();
          if (embeddedRegions.size() > 2 && (embeddedRegions.get(embeddedRegions.size()-1)).getType() == XML_TAG_CLOSE && (embeddedRegions.get(embeddedRegions.size() - 3)).getType() == XML_TAG_OPEN && internalTagName != null) {
            if (containsTagName(internalTagName)) {
              longscan = true;
              yybegin(ST_BLOCK_TAG_SCAN);
            }
          }
        }
        if (longscan)
          fCurrentTagName = internalTagName;
        // read the next region and context
        internalContext = primGetNextToken();
        if (longscan) {
          // Returning from a block tag scan requires restoring some state variables
          // as well as handling the block region and setting up for normal scanning
          // inside the embedded container

          ITextRegion newToken;
          // if it is php content we extract the tokens
          if (internalContext == TWIG_CONTENT) {
            newToken = bufferedTextRegion;
            bufferedTextRegion.adjustStart(-containerStart);
          } else {
            newToken = fRegionFactory.createToken(internalContext, yychar - containerStart, yylength(), yylength());
          }

          fEmbeddedContainer.getRegions().add(newToken);
          fEmbeddedContainer.setLength(fEmbeddedContainer.getLength() + newToken.getLength());
          fEmbeddedContainer.setTextLength(fEmbeddedContainer.getTextLength() + newToken.getLength());
          // DW, 4/16/2003 token regions no longer have parents
          // newToken.setParent(fEmbeddedContainer);
          longscan = false;
          fEmbeddedPostState = previousPostState;
          fEmbeddedHint = previousEmbeddedHint;
          fCurrentTagName = previousCurrentTagName;
          yybegin(previousState);
          internalContext = primGetNextToken();
        }
      } catch (IOException e) {
        // primGetNextToken() calls may throw an IOException
        // catch and do nothing since the isEOF check below
        // will properly exit if the input was too short
      } catch (Exception f) {
        // some other exception happened; never should
        Logger.logException(f);
      }
      boolean isEndingType = yystate() == ST_ABORT_EMBEDDED;
      if(!isEndingType) {
        // check for ending context
        if (endTagName == null) {
          for (int i = 0; i < endTypes.length; i++) {
            isEndingType = isEndingType || (internalContext == endTypes[i]);
          }
        }
        else {
          isEndingType = ((isInEndTag && internalContext == XML_TAG_CLOSE) || (isInFirstTag && internalContext == XML_EMPTY_TAG_CLOSE)) && internalTagName != null && internalTagName.equals(endTagName);
        }
      }
      ITextRegionList embeddedList = fEmbeddedContainer.getRegions();
      notFinished = notFinished && ((!isEndingType) && !isEOF() && (endTagName != null || internalContext != UNDEFINED) && !(internalContext == PROXY_CONTEXT && (embeddedList.get(embeddedList.size()-1)).getType() == UNDEFINED));
    }
    // finish adding the last context
    if (internalContext != null && internalContext != PROXY_CONTEXT) {
      ITextRegion newToken = fRegionFactory.createToken(internalContext, yychar - containerStart, yylength(), yylength());
      fEmbeddedContainer.getRegions().add(newToken);
      // DW, 4/16/2003 token regions no longer have parents
      //newToken.setParent(fEmbeddedContainer);
      fEmbeddedContainer.setLength(yychar - containerStart + yylength());
      fEmbeddedContainer.setTextLength(yychar - containerStart + yylength());
    }
    yybegin(fEmbeddedPostState);
  }

  /**
   * user method
   */
  private boolean isNestable(String tagName) {
    return true;
  }

/**
* user method
*
* A generic lookahead-like operation
*/
private final String doBlockScan(String target, String targetContext, int immediateFallbackState) throws IOException {
  return doScan(target, false, targetContext, immediateFallbackState, immediateFallbackState);
}
/**
* user method
* does a lookahead for the current tag name
*/
private final String doBlockTagScan() throws IOException {
        fIsCaseSensitiveBlocking = getBlockMarkerCaseSensitivity();
  return doScan("</" + fCurrentTagName, true, getBlockMarkerContext(fCurrentTagName), YYINITIAL, YYINITIAL);
}

private IProject project;

public void setProject(IProject project) {
  this.project = project;
}

public void reset(java.io.Reader  reader, char[] buffer, int[] parameters){
  this.yy_reader = reader;
  this.yy_buffer = buffer;
  this.yy_markedPos = parameters[0];
  this.yy_pushbackPos = parameters[1];
  this.yy_currentPos = parameters[2];
  this.yy_startRead = parameters[3];
  this.yy_endRead = parameters[4];
  this.yyline = parameters[5]
  this.yychar = this.yy_startRead - this.yy_pushbackPos;
}

public int[] getParamenters(){
  return new int[]{yy_markedPos, yy_pushbackPos, yy_currentPos, yy_startRead, yy_endRead, yyline, yy_lexical_state};
}

/**
* user method
*
* Converts the raw context String returned by the primGetNextToken()
* method into a full ITextRegion by pulling in values for the
* current offset within the scanning text.
*
* Returns null when EOF is encountered and attaches intermittently
* discovered whitespace onto the end of useful regions.
*
* Note that this algorithm caches the token following the one being returned
* so that whitespace can be collapsed.
*/
public final ITextRegion getNextToken() throws IOException {
  fEmbeddedContainer = null;
  // load the starting non-whitespace token (assume that it is so)
  if (fShouldLoadBuffered) {
    if (fBufferedEmbeddedContainer != null) {
      ITextRegion container = fBufferedEmbeddedContainer;
      fBufferedEmbeddedContainer = null;
      fShouldLoadBuffered = false;
      return container;
    }
    context = fBufferedContext;
    text = fBufferedText;
    start = fBufferedStart;
    textLength = length = fBufferedLength;
    fShouldLoadBuffered = false;
  }
  else {
    context = primGetNextToken();
    if (context == PROXY_CONTEXT) {
      return fEmbeddedContainer;
    } else if (context == XML_TAG_OPEN) {
      fIsBlockingEnabled = true;
    } else if (context == XML_END_TAG_OPEN) {
      fIsBlockingEnabled = false;
    }
    text = yytext();
    if (context == XML_TAG_NAME) {
      if(containsTagName(yy_buffer, yy_startRead, yy_markedPos-yy_startRead))
        fCurrentTagName = text;
      else
        fCurrentTagName = null;
    }
    else if (context == XML_TAG_OPEN) {
      fIsBlockingEnabled = true;
    }
    else if (context == XML_END_TAG_OPEN) {
      fIsBlockingEnabled = false;
    }
    start = yychar;
    textLength = length = yylength();
    if (yy_atEOF) {
      fTokenCount++;
      return null;
    }
  }
 
  // store the next token
  f_context = primGetNextToken();
  if (f_context == PROXY_CONTEXT) {
    fBufferedEmbeddedContainer = fEmbeddedContainer;
    fShouldLoadBuffered = true;
  } else if (f_context == XML_TAG_NAME) {
    if(containsTagName(yy_buffer, yy_startRead, yy_markedPos-yy_startRead))
      fCurrentTagName = yytext();
    else
      fCurrentTagName = null;
  } else if (f_context == XML_TAG_OPEN) {
    fIsBlockingEnabled = true;
  } else if (f_context == XML_END_TAG_OPEN) {
    fIsBlockingEnabled = false;
  }
  fBufferedContext = f_context;
  fBufferedText = yytext();
  if (fBufferedContext == XML_TAG_NAME) {
    if(containsTagName(yy_buffer, yy_startRead, yy_markedPos-yy_startRead))
      fCurrentTagName = fBufferedText;
    else
      fCurrentTagName = null;
  }
  else if (fBufferedContext == XML_TAG_OPEN) {
    fIsBlockingEnabled = true;
  }
  else if (fBufferedContext == XML_END_TAG_OPEN) {
    fIsBlockingEnabled = false;
  }
  fBufferedStart = yychar;
  fBufferedLength = yylength();
  if (fBufferedContext == WHITE_SPACE) {
    fShouldLoadBuffered = false;
    length += fBufferedLength;
  }else {
    fShouldLoadBuffered = true;
  }
  if (context == null) {
    // EOF
    return null;
  }
  fTokenCount++;

  // if it is twig content we create a twig script region
  if ((context == TWIG_CONTENT) || (context == TWIG_COMMENT))
  { 
//    if (Debug.debugTokenizer)
//      System.err.println("create twig region " + context);
   
    return bufferedTextRegion;
  } else {

//    if (Debug.debugTokenizer)
//      System.err.println("create standard region " + context);

    return fRegionFactory.createToken(context, start, textLength, length, null, fCurrentTagName);
  }
}

/* user method */
public TwigTokenizer(){
  super();
}
/* user method */
public TwigTokenizer(char[] charArray){
    this(new CharArrayReader(charArray));
}
/* user method */
public void reset(char[] charArray) {
  reset(new CharArrayReader(charArray), 0);
}
/* user method */
public void reset(char[] charArray, int newOffset) {
  reset(new CharArrayReader(charArray), newOffset);
}
/* user method */
public void reset(java.io.InputStream in) {
  reset(new java.io.InputStreamReader(in), 0);
}
/* user method */
public void reset(java.io.InputStream in, int newOffset) {
  reset(new java.io.InputStreamReader(in), newOffset);
}
/* user method */
public void reset(java.io.Reader in) {
  reset(in, 0);
}
/**
* user method *
*
* Reset internal counters and vars to "newly created" values, in the hopes
* that resetting a pre-existing tokenizer is faster than creating a new one.
*
* This method contains code blocks that were essentially duplicated from the
* <em>generated</em> output of this specification before this method was
* added.  Those code blocks were under the above copyright.
*/
public void reset(java.io.Reader in, int newOffset) {
  if (Debug.debugTokenizer) {
    System.out.println("resetting tokenizer");//$NON-NLS-1$
  }
  fOffset = newOffset;

  /* the input device */
  yy_reader = in;

  /* the current state of the DFA */
  yy_state = 0;

  /* the current lexical state */
  yy_lexical_state = YYINITIAL;

  /* this buffer contains the current text to be matched and is
  the source of the yytext() string */
  java.util.Arrays.fill(yy_buffer, (char)0);

  /* the textposition at the last accepting state */
  yy_markedPos = 0;

  /* the textposition at the last state to be included in yytext */
  yy_pushbackPos = 0;

  /* the current text position in the buffer */
  yy_currentPos = 0;

  /* startRead marks the beginning of the yytext() string in the buffer */
  yy_startRead = 0;

  /**
   * endRead marks the last character in the buffer, that has been read
   * from input
   */
  yy_endRead = 0;

  /* number of newlines encountered up to the start of the matched text */
  yyline = 0;

  /* the number of characters up to the start of the matched text */
  yychar = 0;

  /* yy_atEOF == true <=> the scanner has returned a value for EOF */
  yy_atEOF = false;

  /* denotes if the user-EOF-code has already been executed */
  yy_eof_done = false;


  /* user vars: */
  fLastInternalBlockStart = -1

  fTokenCount = 0;
 
  fShouldLoadBuffered = false;
  fBufferedContext = null;
  fBufferedText = null;
  fBufferedStart = 1;
  fBufferedLength = 0;
  fStateStack = new IntStack();

  context = null;
  text = null;
  start = 0;
  textLength = 0;
  length = 0;
}

  /**
   * user method
   *
   */
  public BlockTokenizer newInstance() {
    TwigTokenizer newInstance = new TwigTokenizer();
    // global tagmarkers can be shared; they have no state and
    // are never destroyed (e.g. 'release')
    for(int i = 0; i < fBlockMarkers.size(); i++) {
      BlockMarker blockMarker = (BlockMarker) fBlockMarkers.get(i);
      if(blockMarker.isGlobal())
        newInstance.addBlockMarker(blockMarker);
    }
    return newInstance;
  }
/* user method */
private final String scanXMLCommentText() throws IOException {
  // Scan for '-->' and return the text up to that point as
  //   XML_COMMENT_TEXT unless the string occurs IMMEDIATELY, in which
  //  case change to the ST_XML_COMMENT_END state and return the next
  //  context as usual.
  return doScan("-->", true, false,  XML_COMMENT_TEXT, ST_XML_COMMENT_END, ST_XML_COMMENT_END);
}


private void assembleEmbeddedTwigOpen() {
 
 
 
}



  /**
   * Creates a new scanner
   * There is also a java.io.InputStream version of this constructor.
   *
   * @param   in  the java.io.Reader to read input from.
   */
  public TwigTokenizer(java.io.Reader in) {
    this.yy_reader = in;
  }

  /**
   * Creates a new scanner.
   * There is also java.io.Reader version of this constructor.
   *
   * @param   in  the java.io.Inputstream to read input from.
   */
  public TwigTokenizer(java.io.InputStream in) {
    this(new java.io.InputStreamReader(in));
  }

  /**
   * Unpacks the compressed DFA transition table.
   *
   * @param packed   the packed transition table
   * @return         the unpacked transition table
   */
  private static int [] yy_unpack(String packed) {
    int [] trans = new int[13978];
    int i = 0/* index in packed string  */
    int j = 0/* index in unpacked array */
    while (i < 4356) {
      int count = packed.charAt(i++);
      int value = packed.charAt(i++);
      value--;
      do trans[j++] = value; while (--count > 0);
    }
    return trans;
  }

  /**
   * Unpacks the compressed character translation table.
   *
   * @param packed   the packed character translation table
   * @return         the unpacked character translation table
   */
  private static char [] yy_unpack_cmap(String packed) {
    char [] map = new char[0x10000];
    int i = 0/* index in packed string  */
    int j = 0/* index in unpacked array */
    while (i < 1378) {
      int  count = packed.charAt(i++);
      char value = packed.charAt(i++);
      do map[j++] = value; while (--count > 0);
    }
    return map;
  }

    public void setTokenizer(TwigTokenizer tokenizer) {
        twigTokenizer = tokenizer;
    }

    public void startRaw() {
       
        insideRaw = true;
       
    }
    public void endRaw() {
   
        insideRaw = false;
       
    }


  /**
   * Gets the next input character.
   *
   * @return      the next character of the input stream, EOF if the
   *              end of the stream is reached.
   * @exception   IOException  if any I/O-Error occurs
   */
  private int yy_advance() throws java.io.IOException {

    /* standard case */
    if (yy_currentPos < yy_endRead) return yy_buffer[yy_currentPos++];

    /* if the eof is reached, we don't need to work hard */
    if (yy_atEOF) return YYEOF;

    /* otherwise: need to refill the buffer */

    /* first: make room (if you can) */
    if (yy_startRead > 0) {
      System.arraycopy(yy_buffer, yy_startRead,
                       yy_buffer, 0,
                       yy_endRead-yy_startRead);

      /* translate stored positions */
      yy_endRead-= yy_startRead;
      yy_currentPos-= yy_startRead;
      yy_markedPos-= yy_startRead;
      yy_pushbackPos-= yy_startRead;
      yy_startRead = 0;
    }

    /* is the buffer big enough? */
    if (yy_currentPos >= yy_buffer.length) {
      /* if not: blow it up */
      char newBuffer[] = new char[yy_currentPos*2];
      System.arraycopy(yy_buffer, 0, newBuffer, 0, yy_buffer.length);
      yy_buffer = newBuffer;
    }

    /* finally: fill the buffer with new input */
    int numRead = yy_reader.read(yy_buffer, yy_endRead,
                                            yy_buffer.length-yy_endRead);

    if ( numRead == -1 ) return YYEOF;

    yy_endRead+= numRead;

    return yy_buffer[yy_currentPos++];
  }

   
  /**
   * Closes the input stream.
   */
  final public void yyclose() throws java.io.IOException {
    yy_atEOF = true;            /* indicate end of file */
    yy_endRead = yy_startRead;  /* invalidate buffer    */
    yy_reader.close();
  }


  /**
   * Returns the current lexical state.
   */
  final public int yystate() {
    return yy_lexical_state;
  }

  /**
   * Enters a new lexical state
   *
   * @param newState the new lexical state
   */
  final public void yybegin(int newState) {
    yy_lexical_state = newState;
  }


  /**
   * Returns the text matched by the current regular expression.
   */
  final public String yytext() {
    return new String( yy_buffer, yy_startRead, yy_markedPos-yy_startRead );
  }

  /**
   * Returns the length of the matched text region.
   */
  final public int yylength() {
    return yy_markedPos-yy_startRead;
  }


  /**
   * Reports an error that occured while scanning - from the SED JFlex skeleton
   *
   * @param   errorCode  the code of the errormessage to display
   */
  private void yy_ScanError(int errorCode) {
    try {
      Logger.log(Logger.ERROR, YY_ERROR_MSG[errorCode]);
    }
    catch (ArrayIndexOutOfBoundsException e) {
      Logger.log(Logger.ERROR, YY_ERROR_MSG[YY_UNKNOWN_ERROR]);
    }
    // DO NOT EXIT the VM on an error
    // System.exit(1);
  }


  /**
   * Pushes the specified amount of characters back into the input stream.
   *
   * They will be read again by then next call of the scanning method
   *
   * @param number  the number of characters to be read again.
   *                This number must not be greater than yylength()!
   */
  void yypushback(int number) {
    if ( number > yylength() )
      yy_ScanError(YY_PUSHBACK_2BIG);

    yy_markedPos -= number;
  }

  /**
   * user method - skeleton.sed
   */
  protected final boolean containsTagName(char[] markerTagName, int offset, int tagnameLength) {
    for(int j = 0; j < fBlockMarkers.size(); j++) {
      BlockMarker marker = (BlockMarker)fBlockMarkers.get(j);
      if(marker.getTagName().length() == tagnameLength) {
        boolean matchesSoFar = true;
        for(int i = 0; i < tagnameLength && matchesSoFar; i++) {
          if(marker.isCaseSensitive()) {
            if(marker.getTagName().charAt(i) != markerTagName[i + offset])
              matchesSoFar = false;
          }
          else {
            if(Character.toLowerCase(marker.getTagName().charAt(i)) != Character.toLowerCase(markerTagName[i + offset]))
              matchesSoFar = false;
          }
        }
        if(matchesSoFar)
          return true;
      }
    }
    return false;
  }
 
/* user method - skeleton.sse */
  protected final String findTwigDelimiter(String text, String insideOf, String delim, String delimType, int afterDelimType) {

      int current = -1;
      int firstOccurence = text.length();
      int delimiter = -1;

      for (int i=0; i < leftDelimiters.length; i++) {

          current = text.indexOf(leftDelimiters[i]);

          if (current > -1 && current < firstOccurence) {
              firstOccurence = current;
              delimiter = i;
          }
      }

      if (delimiter <= -1)
          return insideOf;

      switch (delimiter) {

          case 0:

              // don't evaluate inside raw blocks
              if (insideRaw) {
                  return insideOf;
              }

              delim = "{{";

              if (Debug.debugTokenizer) {
                  // System.err.println("Delim: "+delim+" looking in: '"+text+"' startchar: "+startChar);
              }

              //System.err.println("a");
              //go to the char right before the text, so it doesnt mark the whole thing red...
              if (firstOccurence > 0){
                  // System.err.println("b");
                  //push to right before the delim
                  yypushback(yylength() - firstOccurence);
                  return insideOf;
                  //return YYINITIAL;
              } else {
                  // System.err.println("c");
                  stateHint = "ST_TWIG_IN_PRINT";
                  fStateStack.push(yystate());
                  yybegin(afterDelimType);
                  // pushback to just after the closing bracket
                  int delemLen = delim.length();
                  yypushback(yylength() - firstOccurence - delemLen);
                  return delimType;
              }

          case 1:

              delim = "{%";

              if (Debug.debugTokenizer) {
                  // System.err.println("Delim: "+delim+" looking in: '"+text+"' startchar: "+startChar);
              }

              if (firstOccurence != -1) {

                  if (Debug.debugTokenizer)
                      System.err.println("a");
                  //go to the char right before the text, so it doesnt mark the whole thing red...
                  if (firstOccurence > 0){

                      if (Debug.debugTokenizer)
                          System.err.println("b");

                      //push to right before the delim
                      yypushback(yylength() - firstOccurence);
                      return insideOf;
                      //return YYINITIAL;
                  } else {

                      if (Debug.debugTokenizer)
                          System.err.println("c");
                     
                      fStateStack.push(yystate());
                      yybegin(afterDelimType);
                      stateHint = "ST_TWIG_IN_STATEMENT";
                      // pushback to just after the closing bracket
                      int delemLen = delim.length();
                      yypushback(yylength() - firstOccurence - delemLen);
                      return TWIG_STMT_OPEN;
                  }
              }



              break;

          case 2:

              // don't evaluate inside raw blocks
              if (insideRaw) {
                  return insideOf;
              }

              // search for comments first
              delim = "{#";

              //System.err.println("a");
              //go to the char right before the text, so it doesnt mark the whole thing red...
              if (firstOccurence > 0){
                  // System.err.println("b");
                  //push to right before the delim
                  yypushback(yylength() - firstOccurence);
                  return insideOf;
                  //return YYINITIAL;
              } else {
                  // System.err.println("c");
                  fStateStack.push(yystate());
                  yybegin(ST_TWIG_COMMENT);
                  stateHint = "ST_TWIG_COMMENT";
                  // pushback to just after the closing bracket
                  int delemLen = delim.length();
                  yypushback(yylength() - firstOccurence - delemLen);
                  return TWIG_COMMENT_OPEN;
              }


          default:
              return insideOf;

      }


      return insideOf;
  }


   

  /**
   * user method - skeleton.sed
   *
   * Return ALL of the regions scannable within the remaining text
   * Note: for verification use
   */
  public final List getRegions() {
    List tokens = new ArrayList();
    ITextRegion region = null;
    try {
      region = getNextToken();
      while(region != null) {
        if (region != null) {
          tokens.add(region);
        }
        region = getNextToken();
      }
    }
    catch (StackOverflowError e) {
      Logger.logException(getClass().getName()+": input could not be tokenized correctly at position " + getOffset(), e);//$NON-NLS-1$
      throw e;
    }
    catch (Exception e) {
      // Since this is convenience method and NOT the recommended
      // way of getting tokens, many errors are simply hidden
      Logger.logException("Exception not handled retrieving regions: " + e.getLocalizedMessage(), e);//$NON-NLS-1$
    }
    return tokens;
  }
  /**
   * user method - skeleton.sed
   */
  private final void dump(String s) {
    if (Debug.debugTokenizer) {
      System.out.println(s + " (" + yychar + "-" + //$NON-NLS-2$//$NON-NLS-1$
        (yylength() + yychar) + "):\'" +//$NON-NLS-1$
          StringUtils.escape(yytext()) + "\'");//$NON-NLS-1$
    }
  }
  /* user method  - skeleton.sed */
  public final boolean isEOF() {
    return yy_atEOF;
  }
/* user method - skeleton.sed */
protected final boolean containsTagName(String markerTagName) {
  Iterator blocks = fBlockMarkers.iterator();
  while(blocks.hasNext()) {
    BlockMarker marker = (BlockMarker)blocks.next();
    if(marker.isCaseSensitive()) {
      if(marker.getTagName().equals(markerTagName))
        return true;
    }
    else {
      if(marker.getTagName().equalsIgnoreCase(markerTagName))
        return true;
    }
  }
  return false;
}

  /**
   * Contains user EOF-code, which will be executed exactly once,
   * when the end of file is reached
   */
  private void yy_do_eof() {
    if (!yy_eof_done) {
      yy_eof_done = true;
    // do nothing, this is the downstream parser's job

    }
  }


  /**
   * Resumes scanning until the next regular expression is matched,
   * the end of input is encountered or an I/O-Error occurs.
   *
   * @return      the next token
   * @exception   IOException  if any I/O-Error occurs
   */
  public String primGetNextToken() throws java.io.IOException {
    int yy_input;
    int yy_action;


    while (true) {

      yychar+= yylength();

      boolean yy_counted = false;
      for (yy_currentPos = yy_startRead; yy_currentPos < yy_markedPos;
                                                      yy_currentPos++) {
        switch (yy_buffer[yy_currentPos]) {
        case '\r':
          yyline++;
          yy_counted = true;
          break;
        case '\n':
          if (yy_counted)
            yy_counted = false;
          else {
            yyline++;
          }
          break;
        default:
          yy_counted = false;
        }
      }

      if (yy_counted) {
        if ( yy_advance() == '\n' ) yyline--;
        if ( !yy_atEOF ) yy_currentPos--;
      }

      yy_action = -1;

      yy_currentPos = yy_startRead = yy_markedPos;

      yy_state = yy_lexical_state;


      yy_forAction: {
        while (true) {
   
          yy_input = yy_advance();

          if ( yy_input == YYEOF ) break yy_forAction;

          int yy_next = yytrans[ yy_rowMap[yy_state] + yycmap[yy_input] ];
          if (yy_next == -1) break yy_forAction;
          yy_state = yy_next;

          int yy_attributes = YY_ATTRIBUTE[yy_state];
          if ( (yy_attributes & 1) > 0 ) {
            yy_action = yy_state;
            yy_markedPos = yy_currentPos;
            if ( (yy_attributes & 8) > 0 ) break yy_forAction;
          }

        }
      }


      switch (yy_action) {   

        case 351:
          {
  if(Debug.debugTokenizer)
    dump("XSL processing instruction target");//$NON-NLS-1$
  fEmbeddedPostState = ST_XML_EQUALS;
        yybegin(ST_XML_PI_ATTRIBUTE_NAME);
        return XML_TAG_NAME;
}
        case 353: break;
        case 137:
          {
  if(Debug.debugTokenizer)
    dump("attlist close");//$NON-NLS-1$
  if (Debug.debugTokenizer) {
    if(fStateStack.peek()!=YYINITIAL)
      System.out.println("end embedded region");//$NON-NLS-1$
  }
  yybegin(fStateStack.pop());
  return XML_DECLARATION_CLOSE;
}
        case 354: break;
        case 130:
        case 132:
        case 133:
        case 134:
        case 252:
        case 253:
        case 256:
        case 257:
        case 259:
        case 293:
          {
  if(Debug.debugTokenizer)
    dump("attlist name");//$NON-NLS-1$
  yybegin(ST_XML_ATTLIST_DECLARATION_CONTENT);
  return XML_ATTLIST_DECL_NAME;
}
        case 355: break;
        case 128:
          {
  if(Debug.debugTokenizer)
    dump("elementdecl close");//$NON-NLS-1$
  if (Debug.debugTokenizer) {
    if(fStateStack.peek()!=YYINITIAL)
      System.out.println("end embedded region");//$NON-NLS-1$
  }
  yybegin(fStateStack.pop());
  return XML_DECLARATION_CLOSE;
}
        case 356: break;
        case 121:
        case 123:
        case 124:
        case 125:
        case 238:
        case 239:
        case 242:
        case 243:
        case 245:
        case 289:
          {
  if(Debug.debugTokenizer)
    dump("elementdecl name");//$NON-NLS-1$
  yybegin(ST_XML_ELEMENT_DECLARATION_CONTENT);
  return XML_ELEMENT_DECL_NAME;
}
        case 357: break;
        case 115:
        case 117:
        case 118:
        case 119:
        case 120:
        case 228:
        case 231:
          {
  if(Debug.debugTokenizer)
    dump("doctype system reference");//$NON-NLS-1$
  yybegin(ST_XML_DECLARATION_CLOSE);
  return XML_DOCTYPE_EXTERNAL_ID_SYSREF;
}
        case 358: break;
        case 109:
        case 111:
        case 112:
        case 113:
        case 114:
        case 214:
        case 215:
        case 218:
        case 219:
        case 221:
        case 286:
          {
  if(Debug.debugTokenizer)
    dump("doctype public reference");//$NON-NLS-1$
  yybegin(ST_XML_DOCTYPE_ID_SYSTEM);
  return XML_DOCTYPE_EXTERNAL_ID_PUBREF;
}
        case 359: break;
        case 106:
          {
  if(Debug.debugTokenizer)
    dump("doctype type");//$NON-NLS-1$
  yybegin(ST_XML_DOCTYPE_EXTERNAL_ID);
  return XML_DOCTYPE_NAME;
}
        case 360: break;
        case 101:
          {
  if(Debug.debugTokenizer)
    dump("declaration end");//$NON-NLS-1$
  if (Debug.debugTokenizer) {
    if(fStateStack.peek()!=YYINITIAL)
      System.out.println("end embedded region");//$NON-NLS-1$
  }
  yybegin(fStateStack.pop());
  return XML_DECLARATION_CLOSE;
}
        case 361: break;
        case 98:
          {
  // begin embedded region: " + fEmbeddedHint
  fEmbeddedHint = XML_TAG_ATTRIBUTE_VALUE;
  fEmbeddedPostState = ST_XML_ATTRIBUTE_VALUE_SQUOTED;
  yybegin(ST_XML_ATTRIBUTE_VALUE_SQUOTED);
  fStateStack.push(yystate());
  // JSP attribute value start - complex single quoted
  assembleEmbeddedContainer(XML_TAG_ATTRIBUTE_VALUE_SQUOTE, XML_TAG_ATTRIBUTE_VALUE_SQUOTE);
  fStateStack.pop();
  fEmbeddedHint = XML_TAG_ATTRIBUTE_NAME;
  fEmbeddedPostState = ST_XML_EQUALS;
        yybegin(ST_XML_ATTRIBUTE_NAME);
       
  if (Debug.debugTokenizer) {
     dump("XML ATTR VALUE '");
  }
       
  return PROXY_CONTEXT;
}
        case 362: break;
        case 97:
          {

  fEmbeddedHint = XML_TAG_ATTRIBUTE_VALUE;
  fEmbeddedPostState = ST_XML_ATTRIBUTE_VALUE_DQUOTED;
  yybegin(ST_XML_ATTRIBUTE_VALUE_DQUOTED);
  fStateStack.push(yystate());
  assembleEmbeddedContainer(XML_TAG_ATTRIBUTE_VALUE_DQUOTE, XML_TAG_ATTRIBUTE_VALUE_DQUOTE);
  fStateStack.pop();
  fEmbeddedHint = XML_TAG_ATTRIBUTE_NAME;
  fEmbeddedPostState = ST_XML_EQUALS;
  yybegin(ST_XML_ATTRIBUTE_NAME);
 
  if (Debug.debugTokenizer) {
     dump("XML ATTR VALUE \"");
  }
 
  return PROXY_CONTEXT;
}
        case 363: break;
        case 94:
        case 99:
        case 199:
        case 201:
        case 202:
          {
 
  // attr value
  fEmbeddedHint = XML_TAG_ATTRIBUTE_NAME;
  fEmbeddedPostState = ST_XML_EQUALS;
     yybegin(ST_XML_ATTRIBUTE_NAME);
   
  if (Debug.debugTokenizer) {
     dump("ST_XML_ATTRIBUTE_VALUE");
  }
   
    return XML_TAG_ATTRIBUTE_VALUE; 

}
        case 364: break;
        case 93:
          {
  // equals
  fEmbeddedHint = XML_TAG_ATTRIBUTE_VALUE;
  fEmbeddedPostState = ST_XML_ATTRIBUTE_NAME;
    yybegin(ST_XML_ATTRIBUTE_VALUE);
   
  if (Debug.debugTokenizer) {
     dump("ST_XML_EQUALS");
  }
   
    return XML_TAG_ATTRIBUTE_EQUALS;
}
        case 365: break;
        case 91:
          {
  // attr name
  fEmbeddedHint = XML_TAG_ATTRIBUTE_NAME;
  fEmbeddedPostState = ST_XML_ATTRIBUTE_NAME;
    yybegin(ST_XML_EQUALS);
   
  if (Debug.debugTokenizer) {
     dump("ST_XML_ATTR_NAME");
  }
   
   
    return XML_TAG_ATTRIBUTE_NAME;
}
        case 366: break;
        case 87:
        case 88:
          {
  if(Debug.debugTokenizer)
    dump("TAG NAME");//$NON-NLS-1$
  fEmbeddedHint = XML_TAG_ATTRIBUTE_NAME;
  fEmbeddedPostState = ST_XML_EQUALS;
    yybegin(ST_XML_ATTRIBUTE_NAME);
   
  if (Debug.debugTokenizer) {
     dump("ST_XML_TAG_NAME");
  }
   
    return XML_TAG_NAME;
}
        case 367: break;
        case 85:
          {
  // tag close
  fEmbeddedHint = UNDEFINED;
  if(isBlockMarker()) {
    fEmbeddedHint = getBlockMarkerContext();
    fEmbeddedPostState = ST_BLOCK_TAG_SCAN;
          yybegin(ST_BLOCK_TAG_SCAN);
  }
  else yybegin(YYINITIAL);
 
  if (Debug.debugTokenizer) {
     dump("ST_XML_TAG_NAME closing");
  }
 
    return XML_TAG_CLOSE;
}
        case 368: break;
        case 78:
          {
  if(Debug.debugTokenizer)
    dump("DHTML processing instruction '='");//$NON-NLS-1$
  fEmbeddedHint = XML_TAG_ATTRIBUTE_VALUE;
  fEmbeddedPostState = ST_XML_ATTRIBUTE_NAME;
        yybegin(ST_DHTML_ATTRIBUTE_VALUE);
        return XML_TAG_ATTRIBUTE_EQUALS;
}
        case 369: break;
        case 77:
          {
  if(Debug.debugTokenizer)
    dump("DHTML processing instruction attribute name");//$NON-NLS-1$
        yybegin(ST_DHTML_EQUALS);
        return XML_TAG_ATTRIBUTE_NAME;
}
        case 370: break;
        case 75:
          {
  if(Debug.debugTokenizer)
    dump("DHTML processing instruction end");//$NON-NLS-1$
  fEmbeddedHint = UNDEFINED;
        yybegin(YYINITIAL);
        return XML_PI_CLOSE;
}
        case 371: break;
        case 41:
        case 42:
        case 43:
          {
  if(Debug.debugTokenizer)
    dump("CDATA text");//$NON-NLS-1$
  fEmbeddedPostState = ST_CDATA_TEXT;
  fEmbeddedHint = XML_CDATA_TEXT;
  String blockContext = doBlockScan("]]>", XML_CDATA_TEXT, ST_CDATA_END);//$NON-NLS-1$
  if(blockContext == XML_CDATA_TEXT)
    yybegin(ST_CDATA_END);
  return blockContext;
}
        case 372: break;
        case 37:
        case 89:
        case 95:
        case 100:
          {
  if(Debug.debugTokenizer)
    dump("\nstart tag open");//$NON-NLS-1$
  fEmbeddedHint = XML_TAG_NAME;
  fEmbeddedPostState = ST_XML_ATTRIBUTE_NAME;
    yybegin(ST_XML_TAG_NAME);
    return XML_TAG_OPEN;
}
        case 373: break;
        case 29:
        case 135:
        case 136:
        case 138:
        case 261:
        case 295:
        case 311:
        case 321:
        case 331:
        case 338:
        case 342:
          {
  if(Debug.debugTokenizer)
    dump("attlist contentspec");//$NON-NLS-1$
  return XML_ATTLIST_DECL_CONTENT;
}
        case 374: break;
        case 27:
        case 126:
        case 127:
        case 129:
        case 247:
        case 291:
        case 309:
        case 320:
        case 330:
        case 337:
        case 341:
          {
  if(Debug.debugTokenizer)
    dump("elementdecl contentspec");//$NON-NLS-1$
  return XML_ELEMENT_DECL_CONTENT;
}
        case 375: break;
        case 16:
        case 84:
          {
  // inappropriate tag name
  if(!fStateStack.empty() && (fStateStack.peek()==ST_XML_ATTRIBUTE_VALUE_SQUOTED||fStateStack.peek()==ST_XML_ATTRIBUTE_VALUE_DQUOTED)) {
    yybegin(ST_ABORT_EMBEDDED);
    yypushback(yylength()-1);
    return XML_TAG_ATTRIBUTE_VALUE;
  }
  yybegin(YYINITIAL);
 
  if (Debug.debugTokenizer) {
     dump("ST_XML_TAG_NAME X");
  }
 
 
    return XML_CONTENT;
}
        case 376: break;
        case 14:
        case 79:
        case 81:
        case 82:
        case 83:
        case 190:
          {
  if(Debug.debugTokenizer)
    dump("DHTML processing instruction attribute value");//$NON-NLS-1$
  fEmbeddedHint = XML_TAG_ATTRIBUTE_NAME;
  fEmbeddedPostState = ST_XML_EQUALS;
        yybegin(ST_DHTML_ATTRIBUTE_NAME);
        return XML_TAG_ATTRIBUTE_VALUE;
}
        case 377: break;
        case 5:
        case 8:
        case 9:
        case 10:
        case 17:
        case 18:
        case 19:
        case 20:
        case 21:
        case 22:
        case 23:
        case 24:
        case 25:
        case 26:
        case 28:
        case 55:
        case 90:
          {
  if(Debug.debugTokenizer)
    dump("WHITE SPACE");//$NON-NLS-1$
        return WHITE_SPACE;
}
        case 378: break;
        case 0:
        case 36:
        case 38:
        case 39:
        case 40:
        case 163:
        case 164:
        case 166:
        case 271:
        case 272:
        case 299:
          {
   if(Debug.debugTokenizer)
        dump("\nXML content");//$NON-NLS-1$

    final String text = yytext();
    assert text != null;
   
  if (Debug.debugTokenizer) { 
    dump("FIND TWIG DELIMITER");
  }
   

    // checks the smarty case
    return findTwigDelimiter(text, XML_CONTENT, twigLeftDelim, TWIG_OPEN, ST_TWIG_CONTENT);

}
        case 379: break;
        case 44:
        case 45:
        case 46:
        case 47:
        case 53:
        case 54:
        case 65:
        case 69:
        case 71:
        case 72:
        case 74:
        case 76:
        case 80:
        case 86:
        case 92:
        case 96:
        case 102:
        case 103:
        case 104:
        case 105:
        case 107:
        case 108:
        case 110:
        case 116:
        case 122:
        case 131:
        case 145:
        case 149:
        case 150:
          {
  if (Debug.debugTokenizer) {
    System.out.println("current state " + yy_state);
    System.out.println("!!!unexpected!!!: \"" + yytext() + "\":" + //$NON-NLS-2$//$NON-NLS-1$
 
      yychar + "-" + (yychar + yylength()));//$NON-NLS-1$
  }
  return UNDEFINED;
}
        case 380: break;
        case 48:
        case 151:
          {
  if(Debug.debugTokenizer)
    dump("LINE FEED");//$NON-NLS-1$
  return WHITE_SPACE;
}
        case 381: break;
        case 49:
        case 50:
        case 51:
        case 52:
          {
  if(Debug.debugTokenizer)
    dump("comment content");//$NON-NLS-1$
  return scanXMLCommentText();
}
        case 382: break;
        case 56:
        case 57:
        case 58:
        case 59:
        case 175:
        case 176:
        case 177:
        case 279:
        case 300:
        case 301:
        case 313:
        case 314:
        case 323:
        case 333:
        case 340:
        case 344:
        case 347:
        case 348:
        case 349:
        case 350:
          {
  if(Debug.debugTokenizer)
    dump("processing instruction target");//$NON-NLS-1$
  fEmbeddedHint = XML_CONTENT;
        yybegin(ST_PI_WS);
        return XML_TAG_NAME;
}
        case 383: break;
        case 60:
          {

  if (Debug.debugTokenizer) {
     dump("ST_PI_WS S");
  }

        yybegin(ST_PI_CONTENT);
        return WHITE_SPACE;
}
        case 384: break;
        case 61:
        case 62:
        case 63:
        case 64:
          {
    // block scan until close is found
   
  if (Debug.debugTokenizer) {
     dump("ST_PI_CONTENT");
  }
   
  return doScan("?>", false, false, XML_PI_CONTENT, ST_XML_PI_TAG_CLOSE, ST_XML_PI_TAG_CLOSE);
}
        case 385: break;
        case 66:
          {
  if(Debug.debugTokenizer)
    dump("XML processing instruction attribute name");//$NON-NLS-1$
        yybegin(ST_XML_PI_EQUALS);
        return XML_TAG_ATTRIBUTE_NAME;
}
        case 386: break;
        case 67:
          {
  if(Debug.debugTokenizer)
    dump("XML processing instruction '='");//$NON-NLS-1$
  fEmbeddedHint = XML_TAG_ATTRIBUTE_VALUE;
  fEmbeddedPostState = ST_XML_ATTRIBUTE_NAME;
        yybegin(ST_XML_PI_ATTRIBUTE_VALUE);
        return XML_TAG_ATTRIBUTE_EQUALS;
}
        case 387: break;
        case 68:
        case 70:
        case 73:
        case 182:
          {
  if(Debug.debugTokenizer)
    dump("XML processing instruction attribute value");//$NON-NLS-1$
  fEmbeddedHint = XML_TAG_ATTRIBUTE_NAME;
  fEmbeddedPostState = ST_XML_EQUALS;
        yybegin(ST_XML_PI_ATTRIBUTE_NAME);
        return XML_TAG_ATTRIBUTE_VALUE;
}
        case 388: break;
        case 139:
        case 140:
        case 141:
          {

  if (Debug.debugTokenizer)
    dump("DO BLOCK TAG SCAN");

  return doBlockTagScan();
}
        case 389: break;
        case 142:
        case 143:
          {

  if (Debug.debugTokenizer) {
     dump("XML ATTR VALUE XX");
  }

  return XML_TAG_ATTRIBUTE_VALUE;
}
        case 390: break;
        case 144:
          {

  if (Debug.debugTokenizer) {
     dump("XML ATTR VALUE SQUOTED");
  }

  return XML_TAG_ATTRIBUTE_VALUE_SQUOTE;
}
        case 391: break;
        case 146:
        case 147:
          {

  if (Debug.debugTokenizer) {
     dump("XML ATTR VALUE X");
  }

  return XML_TAG_ATTRIBUTE_VALUE;
}
        case 392: break;
        case 148:
          {

  if (Debug.debugTokenizer) {
     dump("XML ATTR VALUE DQUOTED");
  }

  return XML_TAG_ATTRIBUTE_VALUE_DQUOTE;
}
        case 393: break;
        case 152:
        case 153:
        case 154:
        case 155:
        case 156:
          {

  if (Debug.debugTokenizer) { 
    dump("DO SCAN END TWIG CONTENT");
  }

  return doScanEndTwig(TWIG_CONTENT, ST_TWIG_CONTENT, ST_TWIG_CONTENT);

}
        case 394: break;
        case 157:
        case 158:
        case 159:
        case 160:
          {

  if (Debug.debugTokenizer) { 
    dump("DO SCAN END TWIG COMMENT");
  }

  // twig comment scan
  return doScanEndTwig(TWIG_COMMENT, ST_TWIG_COMMENT, ST_TWIG_COMMENT)

}
        case 395: break;
        case 161:
          {
  // end tag open
  fEmbeddedHint = XML_TAG_NAME;
  fEmbeddedPostState = ST_XML_ATTRIBUTE_NAME;
    yybegin(ST_XML_TAG_NAME);
   
  if (Debug.debugTokenizer) {
     dump("XML INITIAL generic end");
  }
   
    return XML_END_TAG_OPEN;
}
        case 396: break;
        case 162:
          {
  fStateStack.push(yystate());
  if(Debug.debugTokenizer)
    dump("\ndeclaration start");//$NON-NLS-1$
        yybegin(ST_XML_DECLARATION);
  return XML_DECLARATION_OPEN;
}
        case 397: break;
        case 165:
        case 168:
        case 184:
        case 193:
        case 222:
        case 232:
        case 246:
        case 248:
        case 260:
        case 262:
          {

  stateHint = "ST_TWIG_IN_STATEMENT";
  if(Debug.debugTokenizer) {
    dump("twig processing instruction start");//$NON-NLS-1$
  }
 
  // removeing trailing whitespaces for the php open
  String phpStart = yytext();
  int i = phpStart.length() - 1;
  while (i >= 0
      && Character.isWhitespace(phpStart.charAt(i--))) {
    yypushback(1);
  }
  fStateStack.push(yystate());// YYINITIAL
  if (fStateStack.peek() == YYINITIAL) {
    // the simple case, just a regular scriptlet out in
    // content
    yybegin(ST_TWIG_CONTENT);
    stateHint = "ST_TWIG_IN_STATEMENT";
    return TWIG_STMT_OPEN;
  } else {
    if (yystate() == ST_XML_ATTRIBUTE_VALUE_DQUOTED)
      fEmbeddedPostState = ST_XML_ATTRIBUTE_VALUE_DQUOTED;
    else if (yystate() == ST_XML_ATTRIBUTE_VALUE_SQUOTED)
      fEmbeddedPostState = ST_XML_ATTRIBUTE_VALUE_SQUOTED;
    else if (yystate() == ST_CDATA_TEXT) {
      fEmbeddedPostState = ST_CDATA_TEXT;
      fEmbeddedHint = XML_CDATA_TEXT;
    }
    yybegin(ST_TWIG_CONTENT);
    assembleEmbeddedContainer(TWIG_STMT_OPEN, TWIG_STMT_CLOSE);
    if (yystate() == ST_BLOCK_TAG_INTERNAL_SCAN) {
      yybegin(ST_BLOCK_TAG_SCAN);
      return BLOCK_TEXT;
    }
    // required help for successive embedded regions
    if (yystate() == ST_XML_TAG_NAME) {
      fEmbeddedHint = XML_TAG_NAME;
      fEmbeddedPostState = ST_XML_ATTRIBUTE_NAME;
    } else if ((yystate() == ST_XML_ATTRIBUTE_NAME || yystate() == ST_XML_EQUALS)) {
      fEmbeddedHint = XML_TAG_ATTRIBUTE_NAME;
      fEmbeddedPostState = ST_XML_EQUALS;
    } else if (yystate() == ST_XML_ATTRIBUTE_VALUE) {
      fEmbeddedHint = XML_TAG_ATTRIBUTE_VALUE;
      fEmbeddedPostState = ST_XML_ATTRIBUTE_NAME;
    }
    return PROXY_CONTEXT;
  }
}
        case 398: break;
        case 172:
          {

  if (Debug.debugTokenizer) { 
    dump("TW START EMBEDDED");
  }

  stateHint = "ST_TWIG_IN_PRINT"
  //removeing trailing whitespaces for the twig open
  String twigStart = yytext();
  int i = twigStart.length() - 1;
  while(i >= 0 && Character.isWhitespace(twigStart.charAt(i--))){
    yypushback(1);
  }

  fStateStack.push(yystate());
  if(fStateStack.peek()==YYINITIAL) {
    // the simple case, just a regular scriptlet out in content
   
    yybegin(ST_TWIG_CONTENT);   
    return TWIG_OPEN;
  }
  else {
    if(yystate() == ST_XML_ATTRIBUTE_VALUE_DQUOTED)
      fEmbeddedPostState = ST_XML_ATTRIBUTE_VALUE_DQUOTED;
    else if(yystate() == ST_XML_ATTRIBUTE_VALUE_SQUOTED)
      fEmbeddedPostState = ST_XML_ATTRIBUTE_VALUE_SQUOTED;
    else if(yystate() == ST_CDATA_TEXT) {
      fEmbeddedPostState = ST_CDATA_TEXT;
      fEmbeddedHint = XML_CDATA_TEXT;
    }
    yybegin(ST_TWIG_CONTENT);
    assembleEmbeddedContainer(TWIG_OPEN, TWIG_CLOSE);
    if(yystate() == ST_BLOCK_TAG_INTERNAL_SCAN) {
      yybegin(ST_BLOCK_TAG_SCAN);
      return BLOCK_TEXT;
    }
    // required help for successive embedded regions
    if(yystate() == ST_XML_TAG_NAME) {
      fEmbeddedHint = XML_TAG_NAME;
      fEmbeddedPostState = ST_XML_ATTRIBUTE_NAME;
    }
    else if((yystate() == ST_XML_ATTRIBUTE_NAME || yystate() == ST_XML_EQUALS)) {
      fEmbeddedHint = XML_TAG_ATTRIBUTE_NAME;
      fEmbeddedPostState = ST_XML_EQUALS;
    }
    else if(yystate() == ST_XML_ATTRIBUTE_VALUE) {
      fEmbeddedHint = XML_TAG_ATTRIBUTE_VALUE;
      fEmbeddedPostState = ST_XML_ATTRIBUTE_NAME;
    }
    return PROXY_CONTEXT;
  }
}
        case 399: break;
        case 174:
          {
  if(Debug.debugTokenizer)
    dump("processing instruction end");//$NON-NLS-1$
  fEmbeddedHint = UNDEFINED;
        yybegin(YYINITIAL);
        return XML_PI_CLOSE;
}
        case 400: break;
        case 178:
          {
    // ended with nothing inside
    fEmbeddedHint = UNDEFINED;
        yybegin(YYINITIAL);
       
   
  if (Debug.debugTokenizer) {
     dump("PI_CLOSE");
  }
       
        return XML_PI_CLOSE;
}
        case 401: break;
        case 179:
          {
  if(Debug.debugTokenizer)
    dump("XML processing instruction end");//$NON-NLS-1$
  fEmbeddedHint = UNDEFINED;
        yybegin(YYINITIAL);
        return XML_PI_CLOSE;
}
        case 402: break;
        case 194:
          {
    yybegin(YYINITIAL);
  fEmbeddedHint = UNDEFINED;
 
  if (Debug.debugTokenizer) {
     dump("ST_XML_TAG_NAME closing empty");
  }
 
  // empty tag close
    return XML_EMPTY_TAG_CLOSE;
}
        case 403: break;
        case 195:
          {
  String tagName = yytext().substring(1);
  // pushback to just after the opening bracket
  yypushback(yylength() - 1);
  /*
   * If this tag can not be nested or we're already searching for an
   * attribute name, equals, or value, return immediately.
   */
  if (!isNestable(tagName) || (!fStateStack.empty() && (fStateStack.peek() == ST_XML_ATTRIBUTE_NAME || fStateStack.peek() == ST_XML_EQUALS || fStateStack.peek() == ST_XML_ATTRIBUTE_VALUE))) {
    yybegin(ST_XML_TAG_NAME);
    return XML_TAG_OPEN;
  }
  if(Debug.debugTokenizer)
    dump("tag in place of attr name");//$NON-NLS-1$
  fEmbeddedHint = XML_TAG_ATTRIBUTE_NAME;
  fEmbeddedPostState = ST_XML_ATTRIBUTE_NAME;
  fStateStack.push(yystate());
  // embedded container should be looking for the name (again) next
  yybegin(ST_XML_TAG_NAME);
  assembleEmbeddedTagSequence(XML_TAG_OPEN, tagName); // ?
  fStateStack.pop();
  yybegin(ST_XML_EQUALS);
  return PROXY_CONTEXT;
}
        case 404: break;
        case 197:
          {
  String tagName = yytext().substring(1);
  // pushback to just after the opening bracket
  yypushback(yylength() - 1);
  /*
   * If this tag can not be nested or we're already searching for an
   * attribute name, equals, or value, return immediately.
   */
  if (!isNestable(tagName) || (!fStateStack.empty() && (fStateStack.peek() == ST_XML_ATTRIBUTE_NAME || fStateStack.peek() == ST_XML_EQUALS || fStateStack.peek() == ST_XML_ATTRIBUTE_VALUE))) {
    yybegin(ST_XML_TAG_NAME);
    return XML_TAG_OPEN;
  }
  if(Debug.debugTokenizer)
    dump("tag in place of attr value");//$NON-NLS-1$
  fEmbeddedHint = XML_TAG_ATTRIBUTE_VALUE;
  fEmbeddedPostState = ST_XML_ATTRIBUTE_NAME;
  fStateStack.push(yystate());
  // embedded container should be looking for the name (again) next
  yybegin(ST_XML_TAG_NAME);
  assembleEmbeddedTagSequence(XML_TAG_OPEN, tagName); // ?
  fStateStack.pop();
  yybegin(ST_XML_ATTRIBUTE_NAME);
  return PROXY_CONTEXT;
}
        case 405: break;
        case 208:
        case 224:
        case 234:
          {
  return XML_DOCTYPE_INTERNAL_SUBSET;
}
        case 406: break;
        case 265:
          {
 
  if(Debug.debugTokenizer)
    dump("TWIG STMT CLOSE");
 
  //yybegin(YYINITIAL);
  yybegin(fStateStack.pop());
  return TWIG_STMT_CLOSE;
}
        case 407: break;
        case 266:
          {
 
  if(Debug.debugTokenizer)
    dump("TWIG CLOSE");
 
  //yybegin(YYINITIAL);
  yybegin(fStateStack.pop());
  return TWIG_CLOSE;
}
        case 408: break;
        case 267:
          {
 
  if(Debug.debugTokenizer)
    dump("TWIG COMMENT CLOSE");
 
  yybegin(YYINITIAL);
  return TWIG_COMMENT_CLOSE;
}
        case 409: break;
        case 270:
          {
  if(Debug.debugTokenizer)
    dump("\nEntityRef");//$NON-NLS-1$
  return XML_ENTITY_REFERENCE;
}
        case 410: break;
        case 273:
          {
  if(Debug.debugTokenizer)
    dump("\nPEReference");//$NON-NLS-1$
  return XML_PE_REFERENCE;
}
        case 411: break;
        case 274:
          {
  if(Debug.debugTokenizer)
    dump("CDATA end");//$NON-NLS-1$
  yybegin(fStateStack.pop());
  return XML_CDATA_CLOSE;
}
        case 412: break;
        case 275:
          {

  if (Debug.debugTokenizer) { 
    dump("TW START EMBEDDED");
  }

  stateHint = "ST_TWIG_IN_STATEMENT"
  //removeing trailing whitespaces for the twig open
  String twigStart = yytext();
  int i = twigStart.length() - 1;
  while(i >= 0 && Character.isWhitespace(twigStart.charAt(i--))){
    yypushback(1);
  }

  fStateStack.push(yystate());
  if(fStateStack.peek()==YYINITIAL) {
    // the simple case, just a regular scriptlet out in content
   
    yybegin(ST_TWIG_CONTENT);   
    return TWIG_STMT_OPEN;
  }
  else {
    if(yystate() == ST_XML_ATTRIBUTE_VALUE_DQUOTED)
      fEmbeddedPostState = ST_XML_ATTRIBUTE_VALUE_DQUOTED;
    else if(yystate() == ST_XML_ATTRIBUTE_VALUE_SQUOTED)
      fEmbeddedPostState = ST_XML_ATTRIBUTE_VALUE_SQUOTED;
    else if(yystate() == ST_CDATA_TEXT) {
      fEmbeddedPostState = ST_CDATA_TEXT;
      fEmbeddedHint = XML_CDATA_TEXT;
    }
    yybegin(ST_TWIG_CONTENT);
    assembleEmbeddedContainer(TWIG_OPEN, TWIG_STMT_CLOSE);
    if(yystate() == ST_BLOCK_TAG_INTERNAL_SCAN) {
      yybegin(ST_BLOCK_TAG_SCAN);
      return BLOCK_TEXT;
    }
    // required help for successive embedded regions
    if(yystate() == ST_XML_TAG_NAME) {
      fEmbeddedHint = XML_TAG_NAME;
      fEmbeddedPostState = ST_XML_ATTRIBUTE_NAME;
    }
    else if((yystate() == ST_XML_ATTRIBUTE_NAME || yystate() == ST_XML_EQUALS)) {
      fEmbeddedHint = XML_TAG_ATTRIBUTE_NAME;
      fEmbeddedPostState = ST_XML_EQUALS;
    }
    else if(yystate() == ST_XML_ATTRIBUTE_VALUE) {
      fEmbeddedHint = XML_TAG_ATTRIBUTE_VALUE;
      fEmbeddedPostState = ST_XML_ATTRIBUTE_NAME;
    }
    return PROXY_CONTEXT;
  }
}
        case 413: break;
        case 276:
          {
  if(Debug.debugTokenizer)
    dump("comment end");//$NON-NLS-1$
  fEmbeddedHint = UNDEFINED;
  yybegin(YYINITIAL);
  return XML_COMMENT_CLOSE;
}
        case 414: break;
        case 277:
        case 278:
          {
  if(Debug.debugTokenizer)
    dump("XML processing instruction target");//$NON-NLS-1$
  fEmbeddedHint = XML_TAG_ATTRIBUTE_NAME;
  fEmbeddedPostState = ST_XML_EQUALS;
        yybegin(ST_XML_PI_ATTRIBUTE_NAME);
        return XML_TAG_NAME;
}
        case 415: break;
        case 296:
          {
  if(Debug.debugTokenizer)
    dump("\ncomment start");//$NON-NLS-1$
  fEmbeddedHint = XML_COMMENT_TEXT;
  fEmbeddedPostState = ST_XML_COMMENT;
  yybegin(ST_XML_COMMENT);
  return XML_COMMENT_OPEN;
}
        case 416: break;
        case 298:
          {
  if(Debug.debugTokenizer)
    dump("\nCharRef");//$NON-NLS-1$
  return XML_CHAR_REFERENCE;
}
        case 417: break;
        case 324:
          {
  if(Debug.debugTokenizer)
    dump("DHTML processing instruction target");//$NON-NLS-1$
  fEmbeddedHint = XML_TAG_ATTRIBUTE_NAME;
  fEmbeddedPostState = ST_XML_EQUALS;
        yybegin(ST_DHTML_ATTRIBUTE_NAME);
        return XML_TAG_NAME;
}
        case 418: break;
        case 328:
          {
  if(Debug.debugTokenizer)
    dump("doctype external id");//$NON-NLS-1$
  yybegin(ST_XML_DOCTYPE_ID_SYSTEM);
  return XML_DOCTYPE_EXTERNAL_ID_SYSTEM;
}
        case 419: break;
        case 329:
          {
  if(Debug.debugTokenizer)
    dump("doctype external id");//$NON-NLS-1$
  yybegin(ST_XML_DOCTYPE_ID_PUBLIC);
  return XML_DOCTYPE_EXTERNAL_ID_PUBLIC;
}
        case 420: break;
        case 334:
          {
  if(Debug.debugTokenizer)
    dump("doctype");//$NON-NLS-1$
  yybegin(ST_XML_DOCTYPE_DECLARATION);
  return XML_DOCTYPE_DECLARATION;
}
        case 421: break;
        case 335:
          {
  if(Debug.debugTokenizer)
    dump("attlist");//$NON-NLS-1$
  yybegin(ST_XML_ATTLIST_DECLARATION);
  return XML_ATTLIST_DECLARATION;
}
        case 422: break;
        case 336:
          {
  if(Debug.debugTokenizer)
    dump("element");//$NON-NLS-1$
  yybegin(ST_XML_ELEMENT_DECLARATION);
  return XML_ELEMENT_DECLARATION;
}
        case 423: break;
        case 343:
        case 345:
        case 346:
          {
  if(Debug.debugTokenizer)
    dump("\nCDATA start");//$NON-NLS-1$
  fStateStack.push(yystate());
  yybegin(ST_CDATA_TEXT);
  return XML_CDATA_OPEN;
}
        case 424: break;
        default:
          if (yy_input == YYEOF && yy_startRead == yy_currentPos) {
            yy_atEOF = true;
            yy_do_eof();
              return null;
          }
          else {
            yy_ScanError(YY_NO_MATCH);
          }
      }
    }
  }   


}
TOP

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

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.