001/* The following code was generated by JFlex 1.4.1 on 3/13/06 6:15 PM */
002
003/*
004 * Copyright 2000-2006 Omnicore Software, Hans Kratz & Dennis Strein GbR,
005 *                     Geert Bevin <gbevin[remove] at uwyn dot com>.
006 * Distributed under the terms of the GNU Lesser General Public License, v2.1 or later
007 * $Id: XmlHighlighter.java 3106 2006-03-13 17:53:50Z gbevin $
008 */
009package com.uwyn.jhighlight.highlighter;
010
011import java.io.Reader;
012import java.io.IOException;
013
014
015/**
016 * This class is a scanner generated by 
017 * <a href="http://www.jflex.de/">JFlex</a> 1.4.1
018 * on 3/13/06 6:15 PM from the specification file
019 * <tt>com/uwyn/jhighlight/highlighter/XmlHighlighter.flex</tt>
020 */
021public class XmlHighlighter implements ExplicitStateHighlighter {
022
023  /** This character denotes the end of file */
024  public static final int YYEOF = -1;
025
026  /** initial size of the lookahead buffer */
027  private static final int ZZ_BUFFERSIZE = 128;
028
029  /** lexical states */
030  public static final int TAG_START = 9;
031  public static final int IN_CDATA_SECTION = 14;
032  public static final int IN_RIFE_NAME_QUOTED = 6;
033  public static final int IN_SINGLE_QUOTE_STRING = 11;
034  public static final int IN_RIFE_TAG_REGULAR = 4;
035  public static final int IN_PROCESSING_INSTRUCTION = 13;
036  public static final int IN_DOUBLE_QUOTE_STRING = 12;
037  public static final int IN_RIFE_NAME = 7;
038  public static final int IN_TAG = 10;
039  public static final int IN_RIFE_NAME_SINGLEQUOTED = 5;
040  public static final int IN_RIFE_TAG_VELOCITY = 3;
041  public static final int IN_COMMENT = 8;
042  public static final int YYINITIAL = 0;
043  public static final int IN_RIFE_TAG_COMMENT = 1;
044  public static final int IN_RIFE_TAG_COMPACT = 2;
045
046  /** 
047   * Translates characters to character classes
048   */
049  private static final String ZZ_CMAP_PACKED = 
050    "\11\3\1\40\1\34\1\0\1\1\1\2\16\3\4\0\1\1\1\10"+
051    "\1\37\1\0\1\20\2\0\1\36\5\0\1\4\1\3\1\15\12\3"+
052    "\1\6\1\0\1\7\1\35\1\14\1\27\1\0\1\32\1\12\1\30"+
053    "\1\31\4\5\1\13\12\5\1\33\1\5\1\11\4\5\1\16\1\0"+
054    "\1\17\1\0\1\5\1\0\1\5\1\23\6\5\1\24\10\5\1\26"+
055    "\1\41\2\5\1\22\4\5\1\21\1\0\1\25\1\0\41\3\2\0"+
056    "\4\5\4\0\1\5\12\0\1\5\4\0\1\5\5\0\27\5\1\0"+
057    "\37\5\1\0\u0128\5\2\0\22\5\34\0\136\5\2\0\11\5\2\0"+
058    "\7\5\16\0\2\5\16\0\5\5\11\0\1\5\21\0\117\3\21\0"+
059    "\3\3\27\0\1\5\13\0\1\5\1\0\3\5\1\0\1\5\1\0"+
060    "\24\5\1\0\54\5\1\0\10\5\2\0\32\5\14\0\202\5\1\0"+
061    "\4\3\5\0\71\5\2\0\2\5\2\0\2\5\3\0\46\5\2\0"+
062    "\2\5\67\0\46\5\2\0\1\5\7\0\47\5\11\0\21\3\1\0"+
063    "\27\3\1\0\3\3\1\0\1\3\1\0\2\3\1\0\1\3\13\0"+
064    "\33\5\5\0\3\5\56\0\32\5\5\0\13\5\13\3\12\0\12\3"+
065    "\6\0\1\3\143\5\1\0\1\5\7\3\2\0\6\3\2\5\2\3"+
066    "\1\0\4\3\2\0\12\3\3\5\22\0\1\3\1\5\1\3\33\5"+
067    "\3\0\33\3\65\0\46\5\13\3\u0150\0\3\3\1\0\65\5\2\0"+
068    "\1\3\1\5\20\3\2\0\1\5\4\3\3\0\12\5\2\3\2\0"+
069    "\12\3\21\0\3\3\1\0\10\5\2\0\2\5\2\0\26\5\1\0"+
070    "\7\5\1\0\1\5\3\0\4\5\2\0\1\3\1\0\7\3\2\0"+
071    "\2\3\2\0\3\3\11\0\1\3\4\0\2\5\1\0\3\5\2\3"+
072    "\2\0\12\3\4\5\16\0\1\3\2\0\6\5\4\0\2\5\2\0"+
073    "\26\5\1\0\7\5\1\0\2\5\1\0\2\5\1\0\2\5\2\0"+
074    "\1\3\1\0\5\3\4\0\2\3\2\0\3\3\13\0\4\5\1\0"+
075    "\1\5\7\0\14\3\3\5\14\0\3\3\1\0\7\5\1\0\1\5"+
076    "\1\0\3\5\1\0\26\5\1\0\7\5\1\0\2\5\1\0\5\5"+
077    "\2\0\1\3\1\5\10\3\1\0\3\3\1\0\3\3\2\0\1\5"+
078    "\17\0\1\5\5\0\12\3\21\0\3\3\1\0\10\5\2\0\2\5"+
079    "\2\0\26\5\1\0\7\5\1\0\2\5\2\0\4\5\2\0\1\3"+
080    "\1\5\6\3\3\0\2\3\2\0\3\3\10\0\2\3\4\0\2\5"+
081    "\1\0\3\5\4\0\12\3\22\0\2\3\1\0\6\5\3\0\3\5"+
082    "\1\0\4\5\3\0\2\5\1\0\1\5\1\0\2\5\3\0\2\5"+
083    "\3\0\3\5\3\0\10\5\1\0\3\5\4\0\5\3\3\0\3\3"+
084    "\1\0\4\3\11\0\1\3\17\0\11\3\21\0\3\3\1\0\10\5"+
085    "\1\0\3\5\1\0\27\5\1\0\12\5\1\0\5\5\4\0\7\3"+
086    "\1\0\3\3\1\0\4\3\7\0\2\3\11\0\2\5\4\0\12\3"+
087    "\22\0\2\3\1\0\10\5\1\0\3\5\1\0\27\5\1\0\12\5"+
088    "\1\0\5\5\4\0\7\3\1\0\3\3\1\0\4\3\7\0\2\3"+
089    "\7\0\1\5\1\0\2\5\4\0\12\3\22\0\2\3\1\0\10\5"+
090    "\1\0\3\5\1\0\27\5\1\0\20\5\4\0\6\3\2\0\3\3"+
091    "\1\0\4\3\11\0\1\3\10\0\2\5\4\0\12\3\22\0\2\3"+
092    "\1\0\22\5\3\0\30\5\1\0\11\5\1\0\1\5\2\0\7\5"+
093    "\3\0\1\3\4\0\6\3\1\0\1\3\1\0\10\3\22\0\2\3"+
094    "\15\0\60\5\1\3\2\5\7\3\4\0\10\5\10\3\1\0\12\3"+
095    "\47\0\2\5\1\0\1\5\2\0\2\5\1\0\1\5\2\0\1\5"+
096    "\6\0\4\5\1\0\7\5\1\0\3\5\1\0\1\5\1\0\1\5"+
097    "\2\0\2\5\1\0\4\5\1\3\2\5\6\3\1\0\2\3\1\5"+
098    "\2\0\5\5\1\0\1\5\1\0\6\3\2\0\12\3\2\0\2\5"+
099    "\42\0\1\5\27\0\2\3\6\0\12\3\13\0\1\3\1\0\1\3"+
100    "\1\0\1\3\4\0\2\3\10\5\1\0\42\5\6\0\24\3\1\0"+
101    "\2\3\4\5\4\0\10\3\1\0\44\3\11\0\1\3\71\0\42\5"+
102    "\1\0\5\5\1\0\2\5\1\0\7\3\3\0\4\3\6\0\12\3"+
103    "\6\0\6\5\4\3\106\0\46\5\12\0\47\5\11\0\132\5\5\0"+
104    "\104\5\5\0\122\5\6\0\7\5\1\0\77\5\1\0\1\5\1\0"+
105    "\4\5\2\0\7\5\1\0\1\5\1\0\4\5\2\0\47\5\1\0"+
106    "\1\5\1\0\4\5\2\0\37\5\1\0\1\5\1\0\4\5\2\0"+
107    "\7\5\1\0\1\5\1\0\4\5\2\0\7\5\1\0\7\5\1\0"+
108    "\27\5\1\0\37\5\1\0\1\5\1\0\4\5\2\0\7\5\1\0"+
109    "\47\5\1\0\23\5\16\0\11\3\56\0\125\5\14\0\u026c\5\2\0"+
110    "\10\5\12\0\32\5\5\0\113\5\225\0\64\5\40\3\7\0\1\5"+
111    "\4\0\12\3\41\0\4\3\1\0\12\3\6\0\130\5\10\0\51\5"+
112    "\1\3\u0556\0\234\5\4\0\132\5\6\0\26\5\2\0\6\5\2\0"+
113    "\46\5\2\0\6\5\2\0\10\5\1\0\1\5\1\0\1\5\1\0"+
114    "\1\5\1\0\37\5\2\0\65\5\1\0\7\5\1\0\1\5\3\0"+
115    "\3\5\1\0\7\5\3\0\4\5\2\0\6\5\4\0\15\5\5\0"+
116    "\3\5\1\0\7\5\17\0\4\3\32\0\5\3\20\0\2\5\51\0"+
117    "\6\3\17\0\1\5\40\0\20\5\40\0\15\3\4\0\1\3\40\0"+
118    "\1\5\4\0\1\5\2\0\12\5\1\0\1\5\3\0\5\5\6\0"+
119    "\1\5\1\0\1\5\1\0\1\5\1\0\4\5\1\0\3\5\1\0"+
120    "\7\5\46\0\44\5\u0e81\0\3\5\31\0\11\5\6\3\1\0\5\5"+
121    "\2\0\3\5\6\0\124\5\4\0\2\3\2\0\2\5\2\0\136\5"+
122    "\6\0\50\5\4\0\136\5\21\0\30\5\u0248\0\u19b6\5\112\0\u51a6\5"+
123    "\132\0\u048d\5\u0773\0\u2ba4\5\u215c\0\u012e\5\322\0\7\5\14\0\5\5"+
124    "\5\0\1\5\1\3\12\5\1\0\15\5\1\0\5\5\1\0\1\5"+
125    "\1\0\2\5\1\0\2\5\1\0\154\5\41\0\u016b\5\22\0\100\5"+
126    "\2\0\66\5\50\0\14\5\44\0\4\3\17\0\2\5\30\0\3\5"+
127    "\31\0\1\5\6\0\3\5\1\0\1\5\1\0\207\5\2\0\1\3"+
128    "\4\0\1\5\13\0\12\3\7\0\32\5\4\0\1\5\1\0\32\5"+
129    "\12\0\132\5\3\0\6\5\2\0\6\5\2\0\6\5\2\0\3\5"+
130    "\3\0\2\5\3\0\2\5\22\0\3\3\4\0";
131
132  /** 
133   * Translates characters to character classes
134   */
135  private static final char [] ZZ_CMAP = zzUnpackCMap(ZZ_CMAP_PACKED);
136
137  /** 
138   * Translates DFA states to action switch labels.
139   */
140  private static final int [] ZZ_ACTION = zzUnpackAction();
141
142  private static final String ZZ_ACTION_PACKED_0 =
143    "\1\1\2\2\1\3\1\2\3\0\1\4\2\0\2\5"+
144    "\1\0\1\6\2\1\1\7\2\1\3\2\1\10\1\2"+
145    "\1\11\2\3\1\2\1\12\1\13\1\14\1\13\2\4"+
146    "\1\15\1\16\1\17\1\20\2\1\1\20\1\21\1\22"+
147    "\1\23\1\5\2\24\3\5\1\25\2\5\2\1\1\26"+
148    "\2\6\1\0\1\7\1\0\1\27\10\0\1\30\16\0"+
149    "\1\31\1\0\1\32\1\33\4\0\1\34\4\0\1\35"+
150    "\10\0\1\36\1\37\7\0\1\40";
151
152  private static int [] zzUnpackAction() {
153    int [] result = new int[118];
154    int offset = 0;
155    offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
156    return result;
157  }
158
159  private static int zzUnpackAction(String packed, int offset, int [] result) {
160    int i = 0;       /* index in packed string  */
161    int j = offset;  /* index in unpacked array */
162    int l = packed.length();
163    while (i < l) {
164      int count = packed.charAt(i++);
165      int value = packed.charAt(i++);
166      do result[j++] = value; while (--count > 0);
167    }
168    return j;
169  }
170
171
172  /** 
173   * Translates a state to a row index in the transition table
174   */
175  private static final int [] ZZ_ROWMAP = zzUnpackRowMap();
176
177  private static final String ZZ_ROWMAP_PACKED_0 =
178    "\0\0\0\42\0\104\0\146\0\210\0\252\0\314\0\356"+
179    "\0\u0110\0\u0132\0\u0154\0\u0176\0\u0198\0\u01ba\0\u01dc\0\u01fe"+
180    "\0\u0220\0\u0242\0\u0264\0\u0286\0\u02a8\0\u02ca\0\u01fe\0\u01fe"+
181    "\0\u02ec\0\u01fe\0\u030e\0\u0330\0\u0352\0\u01fe\0\u01fe\0\u01fe"+
182    "\0\u0374\0\u0396\0\u03b8\0\u01fe\0\u03da\0\u01fe\0\u03fc\0\u041e"+
183    "\0\u0440\0\u0462\0\u01fe\0\u01fe\0\u01fe\0\u0484\0\u041e\0\u01fe"+
184    "\0\u0264\0\u01fe\0\u04a6\0\u01fe\0\u04c8\0\u04ea\0\u050c\0\u052e"+
185    "\0\u01fe\0\u0550\0\u0572\0\u0594\0\u05b6\0\u05d8\0\u01fe\0\u05fa"+
186    "\0\u061c\0\u063e\0\u0660\0\u0682\0\u05b6\0\u050c\0\u052e\0\u01fe"+
187    "\0\u06a4\0\u06c6\0\u06e8\0\u070a\0\u072c\0\u074e\0\u0770\0\u0792"+
188    "\0\u07b4\0\u07d6\0\u07f8\0\u081a\0\u083c\0\u085e\0\u01fe\0\u0880"+
189    "\0\u01fe\0\u08a2\0\u08c4\0\u08e6\0\u0908\0\u092a\0\u01fe\0\u094c"+
190    "\0\u096e\0\u0990\0\u09b2\0\u01fe\0\u08a2\0\u09d4\0\u09f6\0\u0a18"+
191    "\0\u0a3a\0\u0a5c\0\u0a7e\0\u0aa0\0\u01fe\0\u01fe\0\u0ac2\0\u0ae4"+
192    "\0\u0b06\0\u0b28\0\u0b4a\0\u0b6c\0\u0b8e\0\u01fe";
193
194  private static int [] zzUnpackRowMap() {
195    int [] result = new int[118];
196    int offset = 0;
197    offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
198    return result;
199  }
200
201  private static int zzUnpackRowMap(String packed, int offset, int [] result) {
202    int i = 0;  /* index in packed string  */
203    int j = offset;  /* index in unpacked array */
204    int l = packed.length();
205    while (i < l) {
206      int high = packed.charAt(i++) << 16;
207      result[j++] = high | packed.charAt(i++);
208    }
209    return j;
210  }
211
212  /** 
213   * The transition table of the DFA
214   */
215  private static final int [] ZZ_TRANS = zzUnpackTrans();
216
217  private static final String ZZ_TRANS_PACKED_0 =
218    "\1\20\1\21\5\20\1\22\6\20\1\23\1\20\1\24"+
219    "\17\20\1\21\1\20\4\25\1\26\7\25\1\27\21\25"+
220    "\1\30\3\25\17\31\1\32\16\31\1\30\3\31\15\33"+
221    "\1\34\7\33\1\32\12\33\2\27\14\35\1\32\22\35"+
222    "\1\36\2\35\34\37\1\20\1\37\1\40\37\37\1\20"+
223    "\2\37\1\40\17\37\1\41\7\37\1\32\6\37\1\20"+
224    "\5\37\4\42\1\43\27\42\1\20\5\42\5\44\2\45"+
225    "\2\44\3\45\1\46\3\44\1\45\1\44\3\45\1\44"+
226    "\1\45\1\44\4\45\1\20\4\44\1\45\5\20\2\47"+
227    "\1\50\1\20\3\47\1\46\1\51\1\23\1\20\1\52"+
228    "\1\20\3\47\1\20\1\47\1\20\4\47\1\20\1\53"+
229    "\1\54\1\55\1\20\1\47\7\56\1\57\4\56\1\60"+
230    "\1\56\1\61\1\62\1\63\1\62\3\56\1\62\6\56"+
231    "\1\62\1\56\1\64\3\56\7\65\1\57\4\65\1\60"+
232    "\1\65\1\61\1\62\1\66\1\62\3\65\1\62\6\65"+
233    "\1\62\2\65\1\64\2\65\27\67\1\70\4\67\1\71"+
234    "\5\67\17\72\1\73\14\72\1\20\5\72\43\0\1\21"+
235    "\36\0\1\21\11\0\1\74\4\0\1\75\10\0\1\76"+
236    "\1\77\22\0\1\100\52\0\1\101\20\0\4\25\1\0"+
237    "\7\25\1\0\21\25\1\0\3\25\4\0\1\102\35\0"+
238    "\17\31\1\0\16\31\1\0\3\31\25\33\1\0\12\33"+
239    "\2\0\25\33\1\32\12\33\2\0\14\35\1\0\22\35"+
240    "\1\0\2\35\25\0\1\32\14\0\4\42\1\0\27\42"+
241    "\1\0\5\42\4\0\1\103\40\0\4\45\2\0\3\45"+
242    "\4\0\1\45\1\0\3\45\1\0\1\45\1\0\4\45"+
243    "\5\0\1\45\3\0\4\47\2\0\3\47\4\0\1\47"+
244    "\1\0\3\47\1\0\1\47\1\0\4\47\5\0\1\47"+
245    "\10\0\1\104\4\0\1\105\10\0\1\76\27\0\1\46"+
246    "\30\0\4\47\2\0\3\47\4\0\1\47\1\101\3\47"+
247    "\1\0\1\47\1\0\4\47\5\0\1\47\7\56\1\0"+
248    "\4\56\1\0\1\56\2\0\1\56\1\0\3\56\1\0"+
249    "\6\56\1\0\1\56\1\0\12\56\1\0\4\56\1\0"+
250    "\1\56\2\0\1\56\1\101\3\56\1\0\6\56\1\0"+
251    "\1\56\1\0\3\56\7\65\1\0\4\65\1\0\1\65"+
252    "\2\0\1\65\1\0\3\65\1\0\6\65\1\0\2\65"+
253    "\1\0\11\65\1\0\4\65\1\0\1\65\2\0\1\65"+
254    "\1\101\3\65\1\0\6\65\1\0\2\65\1\0\2\65"+
255    "\27\106\1\107\4\106\1\71\21\106\1\110\12\106\1\111"+
256    "\4\106\1\71\5\106\17\72\1\0\14\72\1\0\5\72"+
257    "\17\0\1\112\26\0\1\113\11\0\1\114\51\0\1\115"+
258    "\21\0\1\116\34\0\2\117\6\0\1\120\1\121\1\120"+
259    "\1\0\1\122\16\0\1\117\3\0\1\117\2\0\2\123"+
260    "\12\0\1\124\4\0\1\125\1\126\1\125\7\0\1\123"+
261    "\3\0\1\123\15\0\1\32\41\0\1\127\31\0\1\130"+
262    "\35\0\14\106\1\110\12\106\1\111\4\106\1\0\5\106"+
263    "\14\0\1\131\31\0\1\132\65\0\1\133\17\0\1\134"+
264    "\55\0\1\135\1\136\1\135\16\0\2\117\6\0\1\120"+
265    "\1\121\1\120\20\0\1\117\3\0\1\117\2\0\1\137"+
266    "\36\0\1\137\2\0\1\137\7\0\1\120\26\0\1\137"+
267    "\2\0\2\122\6\0\1\140\1\141\21\0\1\122\3\0"+
268    "\1\122\2\0\2\123\17\0\1\125\1\126\1\125\7\0"+
269    "\1\123\3\0\1\123\2\0\2\124\17\0\1\142\1\143"+
270    "\10\0\1\124\3\0\1\124\2\0\1\144\36\0\1\144"+
271    "\2\0\1\144\20\0\1\125\15\0\1\144\5\0\1\145"+
272    "\36\0\2\146\6\0\1\147\1\150\1\147\1\0\1\151"+
273    "\16\0\1\146\3\0\1\146\32\0\1\152\32\0\1\153"+
274    "\1\154\17\0\1\155\36\0\1\155\2\0\1\155\20\0"+
275    "\1\135\15\0\1\155\2\0\2\140\14\0\1\27\14\0"+
276    "\1\140\3\0\1\140\2\0\2\140\6\0\1\140\5\0"+
277    "\1\27\14\0\1\140\3\0\1\140\2\0\2\142\22\0"+
278    "\1\27\6\0\1\142\3\0\1\142\2\0\2\142\17\0"+
279    "\1\142\2\0\1\27\6\0\1\142\3\0\1\142\2\0"+
280    "\2\146\6\0\1\147\1\150\1\147\20\0\1\146\3\0"+
281    "\1\146\2\0\1\156\36\0\1\156\2\0\1\156\7\0"+
282    "\1\147\26\0\1\156\2\0\2\151\6\0\1\157\1\160"+
283    "\21\0\1\151\3\0\1\151\33\0\1\161\10\0\1\153"+
284    "\12\0\1\27\23\0\1\153\2\0\1\153\12\0\1\27"+
285    "\5\0\1\153\15\0\1\153\2\0\2\157\1\0\1\162"+
286    "\27\0\1\157\3\0\1\157\2\0\2\157\1\0\1\162"+
287    "\4\0\1\157\22\0\1\157\3\0\1\157\34\0\1\163"+
288    "\12\0\1\164\67\0\1\165\23\0\1\27\43\0\1\166"+
289    "\23\0";
290
291  private static int [] zzUnpackTrans() {
292    int [] result = new int[2992];
293    int offset = 0;
294    offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result);
295    return result;
296  }
297
298  private static int zzUnpackTrans(String packed, int offset, int [] result) {
299    int i = 0;       /* index in packed string  */
300    int j = offset;  /* index in unpacked array */
301    int l = packed.length();
302    while (i < l) {
303      int count = packed.charAt(i++);
304      int value = packed.charAt(i++);
305      value--;
306      do result[j++] = value; while (--count > 0);
307    }
308    return j;
309  }
310
311
312  /* error codes */
313  private static final int ZZ_UNKNOWN_ERROR = 0;
314  private static final int ZZ_NO_MATCH = 1;
315  private static final int ZZ_PUSHBACK_2BIG = 2;
316
317  /* error messages for the codes above */
318  private static final String ZZ_ERROR_MSG[] = {
319    "Unkown internal scanner error",
320    "Error: could not match input",
321    "Error: pushback value was too large"
322  };
323
324  /**
325   * ZZ_ATTRIBUTE[aState] contains the attributes of state <code>aState</code>
326   */
327  private static final int [] ZZ_ATTRIBUTE = zzUnpackAttribute();
328
329  private static final String ZZ_ATTRIBUTE_PACKED_0 =
330    "\5\1\3\0\1\1\2\0\2\1\1\0\1\1\1\11"+
331    "\6\1\2\11\1\1\1\11\3\1\3\11\3\1\1\11"+
332    "\1\1\1\11\4\1\3\11\2\1\1\11\1\1\1\11"+
333    "\1\1\1\11\4\1\1\11\2\1\1\0\1\1\1\0"+
334    "\1\11\10\0\1\11\16\0\1\11\1\0\1\11\1\1"+
335    "\4\0\1\11\4\0\1\11\10\0\2\11\7\0\1\11";
336
337  private static int [] zzUnpackAttribute() {
338    int [] result = new int[118];
339    int offset = 0;
340    offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
341    return result;
342  }
343
344  private static int zzUnpackAttribute(String packed, int offset, int [] result) {
345    int i = 0;       /* index in packed string  */
346    int j = offset;  /* index in unpacked array */
347    int l = packed.length();
348    while (i < l) {
349      int count = packed.charAt(i++);
350      int value = packed.charAt(i++);
351      do result[j++] = value; while (--count > 0);
352    }
353    return j;
354  }
355
356  /** the input device */
357  private java.io.Reader zzReader;
358
359  /** the current state of the DFA */
360  private int zzState;
361
362  /** the current lexical state */
363  private int zzLexicalState = YYINITIAL;
364
365  /** this buffer contains the current text to be matched and is
366      the source of the yytext() string */
367  private char zzBuffer[] = new char[ZZ_BUFFERSIZE];
368
369  /** the textposition at the last accepting state */
370  private int zzMarkedPos;
371
372  /** the textposition at the last state to be included in yytext */
373  private int zzPushbackPos;
374
375  /** the current text position in the buffer */
376  private int zzCurrentPos;
377
378  /** startRead marks the beginning of the yytext() string in the buffer */
379  private int zzStartRead;
380
381  /** endRead marks the last character in the buffer, that has been read
382      from input */
383  private int zzEndRead;
384
385  /** number of newlines encountered up to the start of the matched text */
386  private int yyline;
387
388  /** the number of characters up to the start of the matched text */
389  private int yychar;
390
391  /**
392   * the number of characters from the last newline up to the start of the 
393   * matched text
394   */
395  private int yycolumn;
396
397  /** 
398   * zzAtBOL == true <=> the scanner is currently at the beginning of a line
399   */
400  private boolean zzAtBOL = true;
401
402  /** zzAtEOF == true <=> the scanner is at the EOF */
403  private boolean zzAtEOF;
404
405  /* user code: */
406        /* styles */
407        
408        public static final byte PLAIN_STYLE = 1;
409        public static final byte CHAR_DATA = 2;
410        public static final byte TAG_SYMBOLS = 3;
411        public static final byte COMMENT = 4;
412        public static final byte ATTRIBUTE_VALUE = 5;
413        public static final byte ATTRIBUTE_NAME = 6;
414        public static final byte PROCESSING_INSTRUCTION = 7;
415        public static final byte TAG_NAME = 8;
416        public static final byte RIFE_TAG = 9;
417        public static final byte RIFE_NAME = 10;
418
419        /* Highlighter implementation */
420        
421        public int getStyleCount()
422        {
423                return 10;
424        }
425        
426        public byte getStartState()
427        {
428                return YYINITIAL+1;
429        }
430        
431        public byte getCurrentState()
432        {
433                return (byte) (yystate()+1);
434        }
435        
436        public void setState(byte newState)
437        {
438                yybegin(newState-1);
439        }
440        
441        public byte getNextToken()
442        {
443                try
444                {
445                        return (byte) yylex();
446                }
447                catch (IOException e)
448                {
449                        throw new InternalError();
450                }
451        }
452        
453        public int getTokenLength()
454        {
455                return yylength();
456        }
457        
458        public void setReader(Reader r)
459        {
460                this.zzReader = r;
461        }
462
463        public XmlHighlighter()
464        {
465        }
466        
467        private int mReturningState;
468        private int mReturningStateTag;
469
470
471  /**
472   * Creates a new scanner
473   * There is also a java.io.InputStream version of this constructor.
474   *
475   * @param   in  the java.io.Reader to read input from.
476   */
477  public XmlHighlighter(java.io.Reader in) {
478    this.zzReader = in;
479  }
480
481  /**
482   * Creates a new scanner.
483   * There is also java.io.Reader version of this constructor.
484   *
485   * @param   in  the java.io.Inputstream to read input from.
486   */
487  public XmlHighlighter(java.io.InputStream in) {
488    this(new java.io.InputStreamReader(in));
489  }
490
491  /** 
492   * Unpacks the compressed character translation table.
493   *
494   * @param packed   the packed character translation table
495   * @return         the unpacked character translation table
496   */
497  private static char [] zzUnpackCMap(String packed) {
498    char [] map = new char[0x10000];
499    int i = 0;  /* index in packed string  */
500    int j = 0;  /* index in unpacked array */
501    while (i < 1614) {
502      int  count = packed.charAt(i++);
503      char value = packed.charAt(i++);
504      do map[j++] = value; while (--count > 0);
505    }
506    return map;
507  }
508
509
510  /**
511   * Refills the input buffer.
512   *
513   * @return      <code>false</code>, iff there was new input.
514   * 
515   * @exception   java.io.IOException  if any I/O-Error occurs
516   */
517  private boolean zzRefill() throws java.io.IOException {
518
519    /* first: make room (if you can) */
520    if (zzStartRead > 0) {
521      System.arraycopy(zzBuffer, zzStartRead,
522                       zzBuffer, 0,
523                       zzEndRead-zzStartRead);
524
525      /* translate stored positions */
526      zzEndRead-= zzStartRead;
527      zzCurrentPos-= zzStartRead;
528      zzMarkedPos-= zzStartRead;
529      zzPushbackPos-= zzStartRead;
530      zzStartRead = 0;
531    }
532
533    /* is the buffer big enough? */
534    if (zzCurrentPos >= zzBuffer.length) {
535      /* if not: blow it up */
536      char newBuffer[] = new char[zzCurrentPos*2];
537      System.arraycopy(zzBuffer, 0, newBuffer, 0, zzBuffer.length);
538      zzBuffer = newBuffer;
539    }
540
541    /* finally: fill the buffer with new input */
542    int numRead = zzReader.read(zzBuffer, zzEndRead,
543                                            zzBuffer.length-zzEndRead);
544
545    if (numRead < 0) {
546      return true;
547    }
548    else {
549      zzEndRead+= numRead;
550      return false;
551    }
552  }
553
554    
555  /**
556   * Closes the input stream.
557   */
558  public final void yyclose() throws java.io.IOException {
559    zzAtEOF = true;            /* indicate end of file */
560    zzEndRead = zzStartRead;  /* invalidate buffer    */
561
562    if (zzReader != null)
563      zzReader.close();
564  }
565
566
567  /**
568   * Resets the scanner to read from a new input stream.
569   * Does not close the old reader.
570   *
571   * All internal variables are reset, the old input stream 
572   * <b>cannot</b> be reused (internal buffer is discarded and lost).
573   * Lexical state is set to <tt>ZZ_INITIAL</tt>.
574   *
575   * @param reader   the new input stream 
576   */
577  public final void yyreset(java.io.Reader reader) {
578    zzReader = reader;
579    zzAtBOL  = true;
580    zzAtEOF  = false;
581    zzEndRead = zzStartRead = 0;
582    zzCurrentPos = zzMarkedPos = zzPushbackPos = 0;
583    yyline = yychar = yycolumn = 0;
584    zzLexicalState = YYINITIAL;
585  }
586
587
588  /**
589   * Returns the current lexical state.
590   */
591  public final int yystate() {
592    return zzLexicalState;
593  }
594
595
596  /**
597   * Enters a new lexical state
598   *
599   * @param newState the new lexical state
600   */
601  public final void yybegin(int newState) {
602    zzLexicalState = newState;
603  }
604
605
606  /**
607   * Returns the text matched by the current regular expression.
608   */
609  public final String yytext() {
610    return new String( zzBuffer, zzStartRead, zzMarkedPos-zzStartRead );
611  }
612
613
614  /**
615   * Returns the character at position <tt>pos</tt> from the 
616   * matched text. 
617   * 
618   * It is equivalent to yytext().charAt(pos), but faster
619   *
620   * @param pos the position of the character to fetch. 
621   *            A value from 0 to yylength()-1.
622   *
623   * @return the character at position pos
624   */
625  public final char yycharat(int pos) {
626    return zzBuffer[zzStartRead+pos];
627  }
628
629
630  /**
631   * Returns the length of the matched text region.
632   */
633  public final int yylength() {
634    return zzMarkedPos-zzStartRead;
635  }
636
637
638  /**
639   * Reports an error that occured while scanning.
640   *
641   * In a wellformed scanner (no or only correct usage of 
642   * yypushback(int) and a match-all fallback rule) this method 
643   * will only be called with things that "Can't Possibly Happen".
644   * If this method is called, something is seriously wrong
645   * (e.g. a JFlex bug producing a faulty scanner etc.).
646   *
647   * Usual syntax/scanner level error handling should be done
648   * in error fallback rules.
649   *
650   * @param   errorCode  the code of the errormessage to display
651   */
652  private void zzScanError(int errorCode) {
653    String message;
654    try {
655      message = ZZ_ERROR_MSG[errorCode];
656    }
657    catch (ArrayIndexOutOfBoundsException e) {
658      message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
659    }
660
661    throw new Error(message);
662  } 
663
664
665  /**
666   * Pushes the specified amount of characters back into the input stream.
667   *
668   * They will be read again by then next call of the scanning method
669   *
670   * @param number  the number of characters to be read again.
671   *                This number must not be greater than yylength()!
672   */
673  public void yypushback(int number)  {
674    if ( number > yylength() )
675      zzScanError(ZZ_PUSHBACK_2BIG);
676
677    zzMarkedPos -= number;
678  }
679
680
681  /**
682   * Resumes scanning until the next regular expression is matched,
683   * the end of input is encountered or an I/O-Error occurs.
684   *
685   * @return      the next token
686   * @exception   java.io.IOException  if any I/O-Error occurs
687   */
688  public int yylex() throws java.io.IOException {
689    int zzInput;
690    int zzAction;
691
692    // cached fields:
693    int zzCurrentPosL;
694    int zzMarkedPosL;
695    int zzEndReadL = zzEndRead;
696    char [] zzBufferL = zzBuffer;
697    char [] zzCMapL = ZZ_CMAP;
698
699    int [] zzTransL = ZZ_TRANS;
700    int [] zzRowMapL = ZZ_ROWMAP;
701    int [] zzAttrL = ZZ_ATTRIBUTE;
702
703    while (true) {
704      zzMarkedPosL = zzMarkedPos;
705
706      zzAction = -1;
707
708      zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
709  
710      zzState = zzLexicalState;
711
712
713      zzForAction: {
714        while (true) {
715    
716          if (zzCurrentPosL < zzEndReadL)
717            zzInput = zzBufferL[zzCurrentPosL++];
718          else if (zzAtEOF) {
719            zzInput = YYEOF;
720            break zzForAction;
721          }
722          else {
723            // store back cached positions
724            zzCurrentPos  = zzCurrentPosL;
725            zzMarkedPos   = zzMarkedPosL;
726            boolean eof = zzRefill();
727            // get translated positions and possibly new buffer
728            zzCurrentPosL  = zzCurrentPos;
729            zzMarkedPosL   = zzMarkedPos;
730            zzBufferL      = zzBuffer;
731            zzEndReadL     = zzEndRead;
732            if (eof) {
733              zzInput = YYEOF;
734              break zzForAction;
735            }
736            else {
737              zzInput = zzBufferL[zzCurrentPosL++];
738            }
739          }
740          int zzNext = zzTransL[ zzRowMapL[zzState] + zzCMapL[zzInput] ];
741          if (zzNext == -1) break zzForAction;
742          zzState = zzNext;
743
744          int zzAttributes = zzAttrL[zzState];
745          if ( (zzAttributes & 1) == 1 ) {
746            zzAction = zzState;
747            zzMarkedPosL = zzCurrentPosL;
748            if ( (zzAttributes & 8) == 8 ) break zzForAction;
749          }
750
751        }
752      }
753
754      // store back cached position
755      zzMarkedPos = zzMarkedPosL;
756
757      switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
758        case 27: 
759          { yybegin(IN_COMMENT); return COMMENT;
760          }
761        case 33: break;
762        case 5: 
763          { return ATTRIBUTE_VALUE;
764          }
765        case 34: break;
766        case 4: 
767          { return COMMENT;
768          }
769        case 35: break;
770        case 21: 
771          { yybegin(IN_TAG); return ATTRIBUTE_VALUE;
772          }
773        case 36: break;
774        case 20: 
775          { yybegin(IN_TAG); return TAG_SYMBOLS;
776          }
777        case 37: break;
778        case 13: 
779          { yybegin(IN_TAG); return PLAIN_STYLE;
780          }
781        case 38: break;
782        case 14: 
783          { yybegin(IN_TAG); return TAG_NAME;
784          }
785        case 39: break;
786        case 3: 
787          { mReturningStateTag = yystate(); yybegin(IN_RIFE_NAME); return RIFE_NAME;
788          }
789        case 40: break;
790        case 10: 
791          { mReturningStateTag = yystate(); yybegin(IN_RIFE_NAME_QUOTED); return RIFE_NAME;
792          }
793        case 41: break;
794        case 31: 
795          { mReturningState = yystate(); yybegin(IN_RIFE_TAG_COMMENT); return RIFE_TAG;
796          }
797        case 42: break;
798        case 24: 
799          { yybegin(YYINITIAL); return PROCESSING_INSTRUCTION;
800          }
801        case 43: break;
802        case 28: 
803          { mReturningState = yystate(); yybegin(IN_RIFE_TAG_COMPACT); return RIFE_TAG;
804          }
805        case 44: break;
806        case 22: 
807          { return PROCESSING_INSTRUCTION;
808          }
809        case 45: break;
810        case 8: 
811          { mReturningStateTag = yystate(); yybegin(IN_RIFE_NAME_SINGLEQUOTED); return RIFE_NAME;
812          }
813        case 46: break;
814        case 15: 
815          { yybegin(YYINITIAL); return TAG_SYMBOLS;
816          }
817        case 47: break;
818        case 30: 
819          { mReturningState = yystate(); yybegin(IN_RIFE_TAG_REGULAR); return RIFE_TAG;
820          }
821        case 48: break;
822        case 11: 
823          { return RIFE_NAME;
824          }
825        case 49: break;
826        case 23: 
827          { yybegin(IN_PROCESSING_INSTRUCTION); return PROCESSING_INSTRUCTION;
828          }
829        case 50: break;
830        case 17: 
831          { return TAG_SYMBOLS;
832          }
833        case 51: break;
834        case 29: 
835          { mReturningState = yystate(); yybegin(IN_RIFE_TAG_VELOCITY); return RIFE_TAG;
836          }
837        case 52: break;
838        case 1: 
839          { return PLAIN_STYLE;
840          }
841        case 53: break;
842        case 2: 
843          { return RIFE_TAG;
844          }
845        case 54: break;
846        case 18: 
847          { yybegin(IN_SINGLE_QUOTE_STRING); return ATTRIBUTE_VALUE;
848          }
849        case 55: break;
850        case 26: 
851          { yybegin(YYINITIAL); return CHAR_DATA;
852          }
853        case 56: break;
854        case 25: 
855          { yybegin(YYINITIAL); return COMMENT;
856          }
857        case 57: break;
858        case 19: 
859          { yybegin(IN_DOUBLE_QUOTE_STRING); return ATTRIBUTE_VALUE;
860          }
861        case 58: break;
862        case 32: 
863          { yybegin(IN_CDATA_SECTION); return CHAR_DATA;
864          }
865        case 59: break;
866        case 12: 
867          { yybegin(mReturningStateTag); return RIFE_NAME;
868          }
869        case 60: break;
870        case 16: 
871          { return ATTRIBUTE_NAME;
872          }
873        case 61: break;
874        case 6: 
875          { return CHAR_DATA;
876          }
877        case 62: break;
878        case 9: 
879          { yybegin(mReturningState); return RIFE_TAG;
880          }
881        case 63: break;
882        case 7: 
883          { yybegin(TAG_START); return TAG_SYMBOLS;
884          }
885        case 64: break;
886        default: 
887          if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
888            zzAtEOF = true;
889            return YYEOF;
890          } 
891          else {
892            zzScanError(ZZ_NO_MATCH);
893          }
894      }
895    }
896  }
897
898
899}