/* The following code was generated by JFlex 1.4.2 on 7/28/08 9:29 AM */

/*******************************************************************************
 * Copyright (c) 2005, 2008 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
/*nlsXXX*/
package org.eclipse.wst.xml.core.internal.contenttype;
import java.io.IOException;
import java.io.Reader;

import org.eclipse.wst.xml.core.internal.contenttype.EncodingParserConstants;
import org.eclipse.wst.xml.core.internal.contenttype.XMLHeadTokenizerConstants;



/**
 * This class is a scanner generated by 
 * <a href="http://www.jflex.de/">JFlex</a> 1.4.2
 * on 7/28/08 9:29 AM from the specification file
 * <tt>D:/workspaces/wtp301/workspace/org.eclipse.wst.xml.core/DevTimeSupport/HeadParsers/XMLHeadTokenizer.jFlex</tt>
 */
public class XMLHeadTokenizer {

  /** This character denotes the end of file */
  public static final int YYEOF = -1;

  /** initial size of the lookahead buffer */
  private static final int ZZ_BUFFERSIZE = 8192;

  /** lexical states */
  public static final int YYINITIAL = 0;
  public static final int UnDelimitedString = 10;
  public static final int DQ_STRING = 6;
  public static final int SQ_STRING = 8;
  public static final int ST_XMLDecl = 2;
  public static final int QuotedAttributeValue = 4;

  /**
   * ZZ_LEXSTATE[l] is the state in the DFA for the lexical state l
   * ZZ_LEXSTATE[l+1] is the state in the DFA for the lexical state l
   *                  at the beginning of a line
   * l is of the form l = 2*k, k a non negative integer
   */
  private static final int ZZ_LEXSTATE[] = { 
     0,  1,  2,  2,  3,  3,  4,  4,  5,  5,  6, 6
  };

  /** 
   * Translates characters to character classes
   */
  private static final String ZZ_CMAP_PACKED = 
    "\1\11\10\0\1\6\1\10\2\0\1\7\22\0\1\6\1\0\1\33"+
    "\2\0\1\35\1\0\1\34\24\0\1\13\1\12\1\32\1\14\3\0"+
    "\1\27\1\30\1\21\1\0\1\31\1\0\1\24\2\0\1\17\1\16"+
    "\1\26\1\25\2\0\1\22\1\23\2\0\1\20\1\0\1\15\12\0"+
    "\1\27\1\30\1\21\1\0\1\31\1\0\1\24\2\0\1\17\1\16"+
    "\1\26\1\25\2\0\1\22\1\23\2\0\1\20\1\0\1\15\102\0"+
    "\1\4\3\0\1\5\17\0\1\3\16\0\1\1\20\0\1\3\16\0"+
    "\1\1\1\2\170\0\1\2\ufe87\0";

  /** 
   * Translates characters to character classes
   */
  private static final char [] ZZ_CMAP = zzUnpackCMap(ZZ_CMAP_PACKED);

  /** 
   * Translates DFA states to action switch labels.
   */
  private static final int [] ZZ_ACTION = zzUnpackAction();

  private static final String ZZ_ACTION_PACKED_0 =
    "\7\0\13\1\2\2\1\1\1\2\1\3\1\4\1\5"+
    "\1\6\1\1\1\5\1\7\1\1\1\5\1\10\1\1"+
    "\1\11\1\12\1\13\12\0\1\14\5\0\1\2\1\3"+
    "\1\4\1\6\2\0\1\15\1\7\2\0\1\10\1\11"+
    "\1\16\3\0\1\14\4\0\1\2\1\15\14\0\1\17"+
    "\5\0\1\17\6\0\1\20\3\0\1\20\2\0\1\21"+
    "\1\0\1\21\1\0";

  private static int [] zzUnpackAction() {
    int [] result = new int[111];
    int offset = 0;
    offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
    return result;
  }

  private static int zzUnpackAction(String packed, int offset, int [] result) {
    int i = 0;       /* index in packed string  */
    int j = offset;  /* index in unpacked array */
    int l = packed.length();
    while (i < l) {
      int count = packed.charAt(i++);
      int value = packed.charAt(i++);
      do result[j++] = value; while (--count > 0);
    }
    return j;
  }


  /* error codes */
  private static final int ZZ_UNKNOWN_ERROR = 0;
  private static final int ZZ_NO_MATCH = 1;
  private static final int ZZ_PUSHBACK_2BIG = 2;

  /* error messages for the codes above */
  private static final String ZZ_ERROR_MSG[] = {
    "Unkown internal scanner error",
    "Error: could not match input",
    "Error: pushback value was too large"
  };

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

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

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

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

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

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

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

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

  /** 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;

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

  /** zzAtEOF == true <=> the scanner is at the EOF */
  private boolean zzAtEOF;

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

  /* user code: */


	private boolean hasMore = true;
	private final static int MAX_TO_SCAN = 8000;
	StringBuffer string = new StringBuffer();
	// state stack for easier state handling
	private IntStack fStateStack = new IntStack();
	private String valueText = null;


	public XMLHeadTokenizer() {
		super();
	}

	  public void reset (Reader in) {
                /* the input device */
                zzReader = in;

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

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

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

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

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

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

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

                /**
                 * endRead marks the last character in the buffer, that has been read
                 * from input
                 */
                zzEndRead = 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;

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

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

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

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


                fStateStack.clear();

                hasMore = true;
  		
  	}


	public final HeadParserToken getNextToken() throws IOException {
		String context = null;
		context = primGetNextToken();
		HeadParserToken result = null;
		if (valueText != null) {
			result = createToken(context, yychar, valueText);
			valueText = null;
		} else {
			result = createToken(context, yychar, yytext());
		}
		return result;
	}

	public final boolean hasMoreTokens() {
		return hasMore && yychar < MAX_TO_SCAN;
	}
	private void pushCurrentState() {
		fStateStack.push(yystate());

	}

	private void popState() {
		yybegin(fStateStack.pop());
	}
	
	private HeadParserToken createToken(String context, int start, String text) {
		return new HeadParserToken(context, start, text);
	}	



  /**
   * 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 XMLHeadTokenizer(java.io.Reader in) {
    this.zzReader = 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 XMLHeadTokenizer(java.io.InputStream in) {
    this(new java.io.InputStreamReader(in));
  }

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


  /**
   * Refills the input buffer.
   *
   * @return      <code>false</code>, iff there was new input.
   * 
   * @exception   java.io.IOException  if any I/O-Error occurs
   */
  private boolean zzRefill() throws java.io.IOException {

    /* first: make room (if you can) */
    if (zzStartRead > 0) {
      System.arraycopy(zzBuffer, zzStartRead,
                       zzBuffer, 0,
                       zzEndRead-zzStartRead);

      /* translate stored positions */
      zzEndRead-= zzStartRead;
      zzCurrentPos-= zzStartRead;
      zzMarkedPos-= zzStartRead;
      zzStartRead = 0;
    }

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

    /* finally: fill the buffer with new input */
    int numRead = zzReader.read(zzBuffer, zzEndRead,
                                            zzBuffer.length-zzEndRead);

    if (numRead > 0) {
      zzEndRead+= numRead;
      return false;
    }
    // unlikely but not impossible: read 0 characters, but not at end of stream    
    if (numRead == 0) {
      int c = zzReader.read();
      if (c == -1) {
        return true;
      } else {
        zzBuffer[zzEndRead++] = (char) c;
        return false;
      }     
    }

	// numRead < 0
    return true;
  }

    
  /**
   * Closes the input stream.
   */
  public final void yyclose() throws java.io.IOException {
    zzAtEOF = true;            /* indicate end of file */
    zzEndRead = zzStartRead;  /* invalidate buffer    */

    if (zzReader != null)
      zzReader.close();
  }


  /**
   * Resets the scanner to read from a new input stream.
   * Does not close the old reader.
   *
   * All internal variables are reset, the old input stream 
   * <b>cannot</b> be reused (internal buffer is discarded and lost).
   * Lexical state is set to <tt>ZZ_INITIAL</tt>.
   *
   * @param reader   the new input stream 
   */
  public final void yyreset(java.io.Reader reader) {
    zzReader = reader;
    zzAtBOL  = true;
    zzAtEOF  = false;
    zzEndRead = zzStartRead = 0;
    zzCurrentPos = zzMarkedPos = 0;
    yychar = 0;
    zzLexicalState = YYINITIAL;
  }


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


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


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


  /**
   * Returns the character at position <tt>pos</tt> from the 
   * matched text. 
   * 
   * It is equivalent to yytext().charAt(pos), but faster
   *
   * @param pos the position of the character to fetch. 
   *            A value from 0 to yylength()-1.
   *
   * @return the character at position pos
   */
  public final char yycharat(int pos) {
    return zzBuffer[zzStartRead+pos];
  }


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


  /**
   * Reports an error that occured while scanning.
   *
   * In a wellformed scanner (no or only correct usage of 
   * yypushback(int) and a match-all fallback rule) this method 
   * will only be called with things that "Can't Possibly Happen".
   * If this method is called, something is seriously wrong
   * (e.g. a JFlex bug producing a faulty scanner etc.).
   *
   * Usual syntax/scanner level error handling should be done
   * in error fallback rules.
   *
   * @param   errorCode  the code of the errormessage to display
   */
  private void zzScanError(int errorCode) {
    String message;
    try {
      message = ZZ_ERROR_MSG[errorCode];
    }
    catch (ArrayIndexOutOfBoundsException e) {
      message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
    }

    throw new Error(message);
  } 


  /**
   * 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()!
   */
  public void yypushback(int number)  {
    if ( number > yylength() )
      zzScanError(ZZ_PUSHBACK_2BIG);

    zzMarkedPos -= number;
  }


  /**
   * Contains user EOF-code, which will be executed exactly once,
   * when the end of file is reached
   */
  private void zzDoEOF() {
    if (!zzEOFDone) {
      zzEOFDone = true;
    	hasMore=false;

    }
  }


  /**
   * 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   java.io.IOException  if any I/O-Error occurs
   */
  public String primGetNextToken() throws java.io.IOException {
    int zzInput;
    int zzAction;

    // cached fields:
    int zzCurrentPosL;
    int zzMarkedPosL;
    int zzEndReadL = zzEndRead;
    char [] zzBufferL = zzBuffer;
    char [] zzCMapL = ZZ_CMAP;


    while (true) {
      zzMarkedPosL = zzMarkedPos;

      yychar+= zzMarkedPosL-zzStartRead;

      if (zzMarkedPosL > zzStartRead) {
        switch (zzBufferL[zzMarkedPosL-1]) {
        case '\n':
        case '\u000B':
        case '\u000C':
        case '\u0085':
        case '\u2028':
        case '\u2029':
          zzAtBOL = true;
          break;
        case '\r': 
          if (zzMarkedPosL < zzEndReadL)
            zzAtBOL = zzBufferL[zzMarkedPosL] != '\n';
          else if (zzAtEOF)
            zzAtBOL = false;
          else {
            boolean eof = zzRefill();
            zzMarkedPosL = zzMarkedPos;
            zzEndReadL = zzEndRead;
            zzBufferL = zzBuffer;
            if (eof) 
              zzAtBOL = false;
            else 
              zzAtBOL = zzBufferL[zzMarkedPosL] != '\n';
          }
          break;
        default:
          zzAtBOL = false;
        }
      }
      zzAction = -1;

      zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
  
      if (zzAtBOL)
        zzState = ZZ_LEXSTATE[zzLexicalState+1];
      else
        zzState = ZZ_LEXSTATE[zzLexicalState];


      zzForAction: {
        while (true) {
    
          if (zzCurrentPosL < zzEndReadL)
            zzInput = zzBufferL[zzCurrentPosL++];
          else if (zzAtEOF) {
            zzInput = YYEOF;
            break zzForAction;
          }
          else {
            // store back cached positions
            zzCurrentPos  = zzCurrentPosL;
            zzMarkedPos   = zzMarkedPosL;
            boolean eof = zzRefill();
            // get translated positions and possibly new buffer
            zzCurrentPosL  = zzCurrentPos;
            zzMarkedPosL   = zzMarkedPos;
            zzBufferL      = zzBuffer;
            zzEndReadL     = zzEndRead;
            if (eof) {
              zzInput = YYEOF;
              break zzForAction;
            }
            else {
              zzInput = zzBufferL[zzCurrentPosL++];
            }
          }
          zzInput = zzCMapL[zzInput];

          boolean zzIsFinal = false;
          boolean zzNoLookAhead = false;

          zzForNext: { switch (zzState) {
            case 0:
              switch (zzInput) {
                default: zzIsFinal = true; zzNoLookAhead = true; zzState = 7; break zzForNext;
              }

            case 1:
              switch (zzInput) {
                case 1: zzIsFinal = true; zzState = 8; break zzForNext;
                case 2: zzIsFinal = true; zzState = 9; break zzForNext;
                case 3: zzIsFinal = true; zzState = 10; break zzForNext;
                case 6: 
                case 7: 
                case 8: zzIsFinal = true; zzState = 11; break zzForNext;
                case 9: zzIsFinal = true; zzState = 12; break zzForNext;
                case 11: zzIsFinal = true; zzState = 13; break zzForNext;
                default: zzIsFinal = true; zzNoLookAhead = true; zzState = 7; break zzForNext;
              }

            case 2:
              switch (zzInput) {
                case 9: zzIsFinal = true; zzState = 14; break zzForNext;
                case 12: zzIsFinal = true; zzState = 15; break zzForNext;
                case 16: zzIsFinal = true; zzState = 16; break zzForNext;
                case 17: zzIsFinal = true; zzState = 17; break zzForNext;
                default: zzIsFinal = true; zzNoLookAhead = true; zzState = 7; break zzForNext;
              }

            case 3:
              switch (zzInput) {
                case 6: 
                case 7: zzIsFinal = true; zzState = 19; break zzForNext;
                case 8: zzIsFinal = true; zzState = 20; break zzForNext;
                case 9: zzIsFinal = true; zzState = 21; break zzForNext;
                case 27: zzIsFinal = true; zzState = 22; break zzForNext;
                case 28: zzIsFinal = true; zzState = 23; break zzForNext;
                default: zzIsFinal = true; zzNoLookAhead = true; zzState = 18; break zzForNext;
              }

            case 4:
              switch (zzInput) {
                case 7: 
                case 8: 
                case 11: zzIsFinal = true; zzState = 25; break zzForNext;
                case 9: zzIsFinal = true; zzState = 26; break zzForNext;
                case 12: zzIsFinal = true; zzState = 27; break zzForNext;
                case 27: zzIsFinal = true; zzState = 28; break zzForNext;
                default: zzIsFinal = true; zzNoLookAhead = true; zzState = 24; break zzForNext;
              }

            case 5:
              switch (zzInput) {
                case 7: 
                case 8: 
                case 11: zzIsFinal = true; zzState = 25; break zzForNext;
                case 28: zzIsFinal = true; zzState = 28; break zzForNext;
                case 9: zzIsFinal = true; zzState = 29; break zzForNext;
                case 29: zzIsFinal = true; zzState = 30; break zzForNext;
                default: zzIsFinal = true; zzNoLookAhead = true; zzState = 24; break zzForNext;
              }

            case 6:
              switch (zzInput) {
                case 11: zzIsFinal = true; zzState = 25; break zzForNext;
                case 12: zzIsFinal = true; zzState = 30; break zzForNext;
                case 6: 
                case 7: 
                case 8: zzIsFinal = true; zzState = 31; break zzForNext;
                case 9: zzIsFinal = true; zzState = 32; break zzForNext;
                case 27: 
                case 28: zzIsFinal = true; zzState = 33; break zzForNext;
                default: zzIsFinal = true; zzNoLookAhead = true; zzState = 24; break zzForNext;
              }

            case 8:
              switch (zzInput) {
                case 2: zzIsFinal = true; zzNoLookAhead = true; zzState = 34; break zzForNext;
                default: break zzForAction;
              }

            case 9:
              switch (zzInput) {
                case 1: zzIsFinal = true; zzNoLookAhead = true; zzState = 35; break zzForNext;
                default: break zzForAction;
              }

            case 10:
              switch (zzInput) {
                case 4: zzState = 36; break zzForNext;
                default: break zzForAction;
              }

            case 11:
              switch (zzInput) {
                case 6: 
                case 7: 
                case 8: zzState = 37; break zzForNext;
                case 9: zzState = 38; break zzForNext;
                case 11: zzState = 39; break zzForNext;
                default: break zzForAction;
              }

            case 12:
              switch (zzInput) {
                case 6: 
                case 7: 
                case 8: zzState = 37; break zzForNext;
                case 11: zzState = 39; break zzForNext;
                default: break zzForAction;
              }

            case 13:
              switch (zzInput) {
                case 9: zzState = 40; break zzForNext;
                case 12: zzState = 41; break zzForNext;
                default: break zzForAction;
              }

            case 14:
              switch (zzInput) {
                case 12: zzState = 42; break zzForNext;
                case 16: zzState = 43; break zzForNext;
                case 17: zzState = 44; break zzForNext;
                default: break zzForAction;
              }

            case 15:
              switch (zzInput) {
                case 9: zzState = 45; break zzForNext;
                case 26: zzIsFinal = true; zzState = 46; break zzForNext;
                default: break zzForAction;
              }

            case 16:
              switch (zzInput) {
                case 9: zzState = 47; break zzForNext;
                case 17: zzState = 48; break zzForNext;
                default: break zzForAction;
              }

            case 17:
              switch (zzInput) {
                case 9: zzState = 49; break zzForNext;
                case 22: zzState = 50; break zzForNext;
                default: break zzForAction;
              }

            case 19:
              switch (zzInput) {
                case 6: 
                case 7: zzIsFinal = true; break zzForNext;
                case 8: zzState = 51; break zzForNext;
                case 9: zzIsFinal = true; zzState = 52; break zzForNext;
                default: zzIsFinal = true; zzNoLookAhead = true; zzState = 18; break zzForNext;
              }

            case 20:
              switch (zzInput) {
                case 6: 
                case 7: zzIsFinal = true; zzState = 19; break zzForNext;
                case 8: zzState = 51; break zzForNext;
                case 9: zzIsFinal = true; zzState = 52; break zzForNext;
                default: zzIsFinal = true; zzNoLookAhead = true; zzState = 18; break zzForNext;
              }

            case 21:
              switch (zzInput) {
                case 27: zzIsFinal = true; zzState = 22; break zzForNext;
                case 28: zzIsFinal = true; zzState = 23; break zzForNext;
                case 6: 
                case 7: 
                case 8: zzState = 51; break zzForNext;
                default: break zzForAction;
              }

            case 22:
              switch (zzInput) {
                case 9: zzIsFinal = true; zzNoLookAhead = true; zzState = 53; break zzForNext;
                default: break zzForAction;
              }

            case 23:
              switch (zzInput) {
                case 9: zzIsFinal = true; zzNoLookAhead = true; zzState = 54; break zzForNext;
                default: break zzForAction;
              }

            case 25:
              switch (zzInput) {
                case 9: zzIsFinal = true; zzNoLookAhead = true; zzState = 55; break zzForNext;
                default: break zzForAction;
              }

            case 26:
              switch (zzInput) {
                case 7: 
                case 8: 
                case 11: zzIsFinal = true; zzState = 25; break zzForNext;
                case 27: zzIsFinal = true; zzState = 28; break zzForNext;
                case 12: zzState = 56; break zzForNext;
                default: break zzForAction;
              }

            case 27:
              switch (zzInput) {
                case 9: zzState = 57; break zzForNext;
                case 26: zzIsFinal = true; zzState = 58; break zzForNext;
                default: break zzForAction;
              }

            case 28:
              switch (zzInput) {
                case 9: zzIsFinal = true; zzNoLookAhead = true; zzState = 59; break zzForNext;
                default: break zzForAction;
              }

            case 29:
              switch (zzInput) {
                case 7: 
                case 8: 
                case 11: zzIsFinal = true; zzState = 25; break zzForNext;
                case 28: zzIsFinal = true; zzState = 28; break zzForNext;
                case 29: zzState = 60; break zzForNext;
                default: break zzForAction;
              }

            case 30:
              switch (zzInput) {
                case 26: zzIsFinal = true; zzState = 25; break zzForNext;
                case 9: zzState = 61; break zzForNext;
                default: break zzForAction;
              }

            case 31:
              switch (zzInput) {
                case 9: zzIsFinal = true; zzNoLookAhead = true; zzState = 62; break zzForNext;
                default: break zzForAction;
              }

            case 32:
              switch (zzInput) {
                case 11: zzIsFinal = true; zzState = 25; break zzForNext;
                case 6: 
                case 7: 
                case 8: zzIsFinal = true; zzState = 31; break zzForNext;
                case 27: 
                case 28: zzIsFinal = true; zzState = 33; break zzForNext;
                case 12: zzState = 60; break zzForNext;
                default: break zzForAction;
              }

            case 33:
              switch (zzInput) {
                case 9: zzIsFinal = true; zzNoLookAhead = true; zzState = 63; break zzForNext;
                default: break zzForAction;
              }

            case 36:
              switch (zzInput) {
                case 5: zzIsFinal = true; zzNoLookAhead = true; zzState = 64; break zzForNext;
                default: break zzForAction;
              }

            case 37:
              switch (zzInput) {
                case 6: 
                case 7: 
                case 8: break zzForNext;
                case 9: zzState = 38; break zzForNext;
                case 11: zzState = 39; break zzForNext;
                default: break zzForAction;
              }

            case 38:
              switch (zzInput) {
                case 6: 
                case 7: 
                case 8: zzState = 37; break zzForNext;
                case 11: zzState = 39; break zzForNext;
                case 9: zzState = 65; break zzForNext;
                default: break zzForAction;
              }

            case 39:
              switch (zzInput) {
                case 9: zzState = 40; break zzForNext;
                case 12: zzState = 41; break zzForNext;
                default: break zzForAction;
              }

            case 40:
              switch (zzInput) {
                case 12: zzState = 41; break zzForNext;
                default: break zzForAction;
              }

            case 41:
              switch (zzInput) {
                case 9: zzState = 66; break zzForNext;
                case 13: zzState = 67; break zzForNext;
                default: break zzForAction;
              }

            case 42:
              switch (zzInput) {
                case 9: zzState = 45; break zzForNext;
                case 26: zzIsFinal = true; zzState = 46; break zzForNext;
                default: break zzForAction;
              }

            case 43:
              switch (zzInput) {
                case 9: zzState = 47; break zzForNext;
                case 17: zzState = 48; break zzForNext;
                default: break zzForAction;
              }

            case 44:
              switch (zzInput) {
                case 9: zzState = 49; break zzForNext;
                case 22: zzState = 50; break zzForNext;
                default: break zzForAction;
              }

            case 45:
              switch (zzInput) {
                case 26: zzIsFinal = true; zzState = 46; break zzForNext;
                default: break zzForAction;
              }

            case 46:
              switch (zzInput) {
                case 9: zzIsFinal = true; zzNoLookAhead = true; zzState = 68; break zzForNext;
                default: break zzForAction;
              }

            case 47:
              switch (zzInput) {
                case 17: zzState = 48; break zzForNext;
                default: break zzForAction;
              }

            case 48:
              switch (zzInput) {
                case 9: zzState = 69; break zzForNext;
                case 18: zzState = 70; break zzForNext;
                default: break zzForAction;
              }

            case 49:
              switch (zzInput) {
                case 22: zzState = 50; break zzForNext;
                default: break zzForAction;
              }

            case 50:
              switch (zzInput) {
                case 9: zzState = 71; break zzForNext;
                case 23: zzState = 72; break zzForNext;
                default: break zzForAction;
              }

            case 51:
              switch (zzInput) {
                case 6: 
                case 7: zzIsFinal = true; zzState = 19; break zzForNext;
                case 8: break zzForNext;
                case 9: zzIsFinal = true; zzState = 52; break zzForNext;
                default: zzIsFinal = true; zzNoLookAhead = true; zzState = 18; break zzForNext;
              }

            case 52:
              switch (zzInput) {
                case 6: 
                case 7: zzIsFinal = true; zzState = 19; break zzForNext;
                case 8: zzState = 51; break zzForNext;
                case 9: zzIsFinal = true; zzState = 73; break zzForNext;
                default: zzIsFinal = true; zzNoLookAhead = true; zzState = 18; break zzForNext;
              }

            case 56:
              switch (zzInput) {
                case 9: zzState = 57; break zzForNext;
                case 26: zzIsFinal = true; zzState = 58; break zzForNext;
                default: break zzForAction;
              }

            case 57:
              switch (zzInput) {
                case 26: zzIsFinal = true; zzState = 58; break zzForNext;
                default: break zzForAction;
              }

            case 58:
              switch (zzInput) {
                case 9: zzIsFinal = true; zzNoLookAhead = true; zzState = 74; break zzForNext;
                default: break zzForAction;
              }

            case 60:
              switch (zzInput) {
                case 26: zzIsFinal = true; zzState = 25; break zzForNext;
                case 9: zzState = 61; break zzForNext;
                default: break zzForAction;
              }

            case 61:
              switch (zzInput) {
                case 26: zzIsFinal = true; zzState = 25; break zzForNext;
                default: break zzForAction;
              }

            case 65:
              switch (zzInput) {
                case 6: 
                case 7: 
                case 8: zzState = 37; break zzForNext;
                case 11: zzState = 39; break zzForNext;
                default: break zzForAction;
              }

            case 66:
              switch (zzInput) {
                case 13: zzState = 67; break zzForNext;
                default: break zzForAction;
              }

            case 67:
              switch (zzInput) {
                case 9: zzState = 75; break zzForNext;
                case 14: zzState = 76; break zzForNext;
                default: break zzForAction;
              }

            case 69:
              switch (zzInput) {
                case 18: zzState = 70; break zzForNext;
                default: break zzForAction;
              }

            case 70:
              switch (zzInput) {
                case 9: zzState = 77; break zzForNext;
                case 19: zzState = 78; break zzForNext;
                default: break zzForAction;
              }

            case 71:
              switch (zzInput) {
                case 23: zzState = 72; break zzForNext;
                default: break zzForAction;
              }

            case 72:
              switch (zzInput) {
                case 9: zzState = 79; break zzForNext;
                case 21: zzState = 80; break zzForNext;
                default: break zzForAction;
              }

            case 73:
              switch (zzInput) {
                case 6: 
                case 7: 
                case 8: zzState = 51; break zzForNext;
                default: break zzForAction;
              }

            case 75:
              switch (zzInput) {
                case 14: zzState = 76; break zzForNext;
                default: break zzForAction;
              }

            case 76:
              switch (zzInput) {
                case 9: zzState = 81; break zzForNext;
                case 15: zzState = 82; break zzForNext;
                default: break zzForAction;
              }

            case 77:
              switch (zzInput) {
                case 19: zzState = 78; break zzForNext;
                default: break zzForAction;
              }

            case 78:
              switch (zzInput) {
                case 9: zzState = 83; break zzForNext;
                case 20: zzState = 84; break zzForNext;
                default: break zzForAction;
              }

            case 79:
              switch (zzInput) {
                case 21: zzState = 80; break zzForNext;
                default: break zzForAction;
              }

            case 80:
              switch (zzInput) {
                case 9: zzState = 85; break zzForNext;
                case 24: zzState = 86; break zzForNext;
                default: break zzForAction;
              }

            case 81:
              switch (zzInput) {
                case 15: zzState = 82; break zzForNext;
                default: break zzForAction;
              }

            case 82:
              switch (zzInput) {
                case 6: 
                case 7: 
                case 8: zzIsFinal = true; zzState = 87; break zzForNext;
                case 9: zzState = 88; break zzForNext;
                default: break zzForAction;
              }

            case 83:
              switch (zzInput) {
                case 20: zzState = 84; break zzForNext;
                default: break zzForAction;
              }

            case 84:
              switch (zzInput) {
                case 9: zzState = 89; break zzForNext;
                case 21: zzState = 90; break zzForNext;
                default: break zzForAction;
              }

            case 85:
              switch (zzInput) {
                case 24: zzState = 86; break zzForNext;
                default: break zzForAction;
              }

            case 86:
              switch (zzInput) {
                case 9: zzState = 91; break zzForNext;
                case 20: zzState = 92; break zzForNext;
                default: break zzForAction;
              }

            case 87:
              switch (zzInput) {
                case 6: 
                case 7: 
                case 8: zzIsFinal = true; break zzForNext;
                case 9: zzIsFinal = true; zzState = 93; break zzForNext;
                default: break zzForAction;
              }

            case 88:
              switch (zzInput) {
                case 6: 
                case 7: 
                case 8: zzIsFinal = true; zzState = 87; break zzForNext;
                case 9: zzState = 94; break zzForNext;
                default: break zzForAction;
              }

            case 89:
              switch (zzInput) {
                case 21: zzState = 90; break zzForNext;
                default: break zzForAction;
              }

            case 90:
              switch (zzInput) {
                case 9: zzState = 95; break zzForNext;
                case 22: zzState = 96; break zzForNext;
                default: break zzForAction;
              }

            case 91:
              switch (zzInput) {
                case 20: zzState = 92; break zzForNext;
                default: break zzForAction;
              }

            case 92:
              switch (zzInput) {
                case 9: zzState = 97; break zzForNext;
                case 22: zzState = 98; break zzForNext;
                default: break zzForAction;
              }

            case 93:
              switch (zzInput) {
                case 6: 
                case 7: 
                case 8: zzIsFinal = true; zzState = 87; break zzForNext;
                case 9: zzState = 94; break zzForNext;
                default: break zzForAction;
              }

            case 94:
              switch (zzInput) {
                case 6: 
                case 7: 
                case 8: zzIsFinal = true; zzState = 87; break zzForNext;
                default: break zzForAction;
              }

            case 95:
              switch (zzInput) {
                case 22: zzState = 96; break zzForNext;
                default: break zzForAction;
              }

            case 96:
              switch (zzInput) {
                case 6: 
                case 7: 
                case 8: break zzForNext;
                case 9: zzState = 99; break zzForNext;
                case 10: zzIsFinal = true; zzState = 100; break zzForNext;
                default: break zzForAction;
              }

            case 97:
              switch (zzInput) {
                case 22: zzState = 98; break zzForNext;
                default: break zzForAction;
              }

            case 98:
              switch (zzInput) {
                case 9: zzState = 101; break zzForNext;
                case 25: zzState = 102; break zzForNext;
                default: break zzForAction;
              }

            case 99:
              switch (zzInput) {
                case 6: 
                case 7: 
                case 8: zzState = 96; break zzForNext;
                case 10: zzIsFinal = true; zzState = 100; break zzForNext;
                case 9: zzState = 103; break zzForNext;
                default: break zzForAction;
              }

            case 100:
              switch (zzInput) {
                case 6: 
                case 7: 
                case 8: zzIsFinal = true; zzState = 104; break zzForNext;
                case 9: zzState = 105; break zzForNext;
                default: break zzForAction;
              }

            case 101:
              switch (zzInput) {
                case 25: zzState = 102; break zzForNext;
                default: break zzForAction;
              }

            case 102:
              switch (zzInput) {
                case 6: 
                case 7: 
                case 8: break zzForNext;
                case 9: zzState = 106; break zzForNext;
                case 10: zzIsFinal = true; zzState = 107; break zzForNext;
                default: break zzForAction;
              }

            case 103:
              switch (zzInput) {
                case 6: 
                case 7: 
                case 8: zzState = 96; break zzForNext;
                default: break zzForAction;
              }

            case 104:
              switch (zzInput) {
                case 9: zzIsFinal = true; zzState = 100; break zzForNext;
                case 6: 
                case 7: 
                case 8: zzIsFinal = true; break zzForNext;
                default: break zzForAction;
              }

            case 105:
              switch (zzInput) {
                case 6: 
                case 7: 
                case 8: zzIsFinal = true; zzState = 104; break zzForNext;
                default: break zzForAction;
              }

            case 106:
              switch (zzInput) {
                case 6: 
                case 7: 
                case 8: zzState = 102; break zzForNext;
                case 10: zzIsFinal = true; zzState = 107; break zzForNext;
                case 9: zzState = 108; break zzForNext;
                default: break zzForAction;
              }

            case 107:
              switch (zzInput) {
                case 6: 
                case 7: 
                case 8: zzIsFinal = true; zzState = 109; break zzForNext;
                case 9: zzState = 110; break zzForNext;
                default: break zzForAction;
              }

            case 108:
              switch (zzInput) {
                case 6: 
                case 7: 
                case 8: zzState = 102; break zzForNext;
                default: break zzForAction;
              }

            case 109:
              switch (zzInput) {
                case 9: zzIsFinal = true; zzState = 107; break zzForNext;
                case 6: 
                case 7: 
                case 8: zzIsFinal = true; break zzForNext;
                default: break zzForAction;
              }

            case 110:
              switch (zzInput) {
                case 6: 
                case 7: 
                case 8: zzIsFinal = true; zzState = 109; break zzForNext;
                default: break zzForAction;
              }

            default:
              // if this is ever reached, there is a serious bug in JFlex
              zzScanError(ZZ_UNKNOWN_ERROR);
              break;
          } }

          if ( zzIsFinal ) {
            zzAction = zzState;
            zzMarkedPosL = zzCurrentPosL;
            if ( zzNoLookAhead ) break zzForAction;
          }

        }
      }

      // store back cached position
      zzMarkedPos = zzMarkedPosL;

      switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
        case 12: 
          { yybegin(YYINITIAL); hasMore = false; return XMLHeadTokenizerConstants.XMLDeclEnd;
          }
        case 18: break;
        case 14: 
          { if (yychar == 0 ) {hasMore = false; return EncodingParserConstants.UTF83ByteBOM;}
          }
        case 19: break;
        case 9: 
          { yypushback(yylength());popState(); valueText = string.toString(); return EncodingParserConstants.InvalidTermintatedUnDelimitedStringValue;
          }
        case 20: break;
        case 2: 
          { yypushback(1); yybegin(UnDelimitedString); string.setLength(0);
          }
        case 21: break;
        case 7: 
          { popState(); valueText = string.toString(); return EncodingParserConstants.StringValue;
          }
        case 22: break;
        case 10: 
          { if (yychar == 0 ) {hasMore = false; return EncodingParserConstants.UTF16BE;}
          }
        case 23: break;
        case 1: 
          { if(yychar > MAX_TO_SCAN) {hasMore=false; return EncodingParserConstants.MAX_CHARS_REACHED;}
          }
        case 24: break;
        case 6: 
          { yypushback(yylength());popState(); valueText = string.toString(); return EncodingParserConstants.InvalidTerminatedStringValue;
          }
        case 25: break;
        case 5: 
          { string.append( yytext() );
          }
        case 26: break;
        case 13: 
          { yypushback(yylength()); popState(); valueText = string.toString(); return EncodingParserConstants.InvalidTerminatedStringValue;
          }
        case 27: break;
        case 4: 
          { yybegin(SQ_STRING); string.setLength(0);
          }
        case 28: break;
        case 3: 
          { yybegin(DQ_STRING); string.setLength(0);
          }
        case 29: break;
        case 8: 
          { yypushback(yylength());popState(); valueText = string.toString(); return EncodingParserConstants.UnDelimitedStringValue;
          }
        case 30: break;
        case 17: 
          { pushCurrentState(); yybegin(QuotedAttributeValue); return XMLHeadTokenizerConstants.XMLDelEncoding;
          }
        case 31: break;
        case 15: 
          { if (yychar == 0 ) {yybegin(ST_XMLDecl); return XMLHeadTokenizerConstants.XMLDeclStart;}
          }
        case 32: break;
        case 11: 
          { if (yychar == 0 ) {hasMore = false; return EncodingParserConstants.UTF16LE;}
          }
        case 33: break;
        case 16: 
          { pushCurrentState(); yybegin(QuotedAttributeValue); return XMLHeadTokenizerConstants.XMLDeclVersion;
          }
        case 34: break;
        default: 
          if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
            zzAtEOF = true;
            zzDoEOF();
              {
                hasMore = false; return EncodingParserConstants.EOF;
              }
          } 
          else {
            zzScanError(ZZ_NO_MATCH);
          }
      }
    }
  }


}
