mobile/android/thirdparty/org/json/simple/parser/Yylex.java

Wed, 31 Dec 2014 07:22:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:22:50 +0100
branch
TOR_BUG_3246
changeset 4
fc2d59ddac77
permissions
-rw-r--r--

Correct previous dual key logic pending first delivery installment.

michael@0 1 /* The following code was generated by JFlex 1.4.2 */
michael@0 2
michael@0 3 package org.json.simple.parser;
michael@0 4
michael@0 5 class Yylex {
michael@0 6
michael@0 7 /** This character denotes the end of file */
michael@0 8 public static final int YYEOF = -1;
michael@0 9
michael@0 10 /** initial size of the lookahead buffer */
michael@0 11 private static final int ZZ_BUFFERSIZE = 16384;
michael@0 12
michael@0 13 /** lexical states */
michael@0 14 public static final int YYINITIAL = 0;
michael@0 15 public static final int STRING_BEGIN = 2;
michael@0 16
michael@0 17 /**
michael@0 18 * ZZ_LEXSTATE[l] is the state in the DFA for the lexical state l
michael@0 19 * ZZ_LEXSTATE[l+1] is the state in the DFA for the lexical state l
michael@0 20 * at the beginning of a line
michael@0 21 * l is of the form l = 2*k, k a non negative integer
michael@0 22 */
michael@0 23 private static final int ZZ_LEXSTATE[] = {
michael@0 24 0, 0, 1, 1
michael@0 25 };
michael@0 26
michael@0 27 /**
michael@0 28 * Translates characters to character classes
michael@0 29 */
michael@0 30 private static final String ZZ_CMAP_PACKED =
michael@0 31 "\11\0\1\7\1\7\2\0\1\7\22\0\1\7\1\0\1\11\10\0"+
michael@0 32 "\1\6\1\31\1\2\1\4\1\12\12\3\1\32\6\0\4\1\1\5"+
michael@0 33 "\1\1\24\0\1\27\1\10\1\30\3\0\1\22\1\13\2\1\1\21"+
michael@0 34 "\1\14\5\0\1\23\1\0\1\15\3\0\1\16\1\24\1\17\1\20"+
michael@0 35 "\5\0\1\25\1\0\1\26\uff82\0";
michael@0 36
michael@0 37 /**
michael@0 38 * Translates characters to character classes
michael@0 39 */
michael@0 40 private static final char [] ZZ_CMAP = zzUnpackCMap(ZZ_CMAP_PACKED);
michael@0 41
michael@0 42 /**
michael@0 43 * Translates DFA states to action switch labels.
michael@0 44 */
michael@0 45 private static final int [] ZZ_ACTION = zzUnpackAction();
michael@0 46
michael@0 47 private static final String ZZ_ACTION_PACKED_0 =
michael@0 48 "\2\0\2\1\1\2\1\3\1\4\3\1\1\5\1\6"+
michael@0 49 "\1\7\1\10\1\11\1\12\1\13\1\14\1\15\5\0"+
michael@0 50 "\1\14\1\16\1\17\1\20\1\21\1\22\1\23\1\24"+
michael@0 51 "\1\0\1\25\1\0\1\25\4\0\1\26\1\27\2\0"+
michael@0 52 "\1\30";
michael@0 53
michael@0 54 private static int [] zzUnpackAction() {
michael@0 55 int [] result = new int[45];
michael@0 56 int offset = 0;
michael@0 57 offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
michael@0 58 return result;
michael@0 59 }
michael@0 60
michael@0 61 private static int zzUnpackAction(String packed, int offset, int [] result) {
michael@0 62 int i = 0; /* index in packed string */
michael@0 63 int j = offset; /* index in unpacked array */
michael@0 64 int l = packed.length();
michael@0 65 while (i < l) {
michael@0 66 int count = packed.charAt(i++);
michael@0 67 int value = packed.charAt(i++);
michael@0 68 do result[j++] = value; while (--count > 0);
michael@0 69 }
michael@0 70 return j;
michael@0 71 }
michael@0 72
michael@0 73
michael@0 74 /**
michael@0 75 * Translates a state to a row index in the transition table
michael@0 76 */
michael@0 77 private static final int [] ZZ_ROWMAP = zzUnpackRowMap();
michael@0 78
michael@0 79 private static final String ZZ_ROWMAP_PACKED_0 =
michael@0 80 "\0\0\0\33\0\66\0\121\0\154\0\207\0\66\0\242"+
michael@0 81 "\0\275\0\330\0\66\0\66\0\66\0\66\0\66\0\66"+
michael@0 82 "\0\363\0\u010e\0\66\0\u0129\0\u0144\0\u015f\0\u017a\0\u0195"+
michael@0 83 "\0\66\0\66\0\66\0\66\0\66\0\66\0\66\0\66"+
michael@0 84 "\0\u01b0\0\u01cb\0\u01e6\0\u01e6\0\u0201\0\u021c\0\u0237\0\u0252"+
michael@0 85 "\0\66\0\66\0\u026d\0\u0288\0\66";
michael@0 86
michael@0 87 private static int [] zzUnpackRowMap() {
michael@0 88 int [] result = new int[45];
michael@0 89 int offset = 0;
michael@0 90 offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
michael@0 91 return result;
michael@0 92 }
michael@0 93
michael@0 94 private static int zzUnpackRowMap(String packed, int offset, int [] result) {
michael@0 95 int i = 0; /* index in packed string */
michael@0 96 int j = offset; /* index in unpacked array */
michael@0 97 int l = packed.length();
michael@0 98 while (i < l) {
michael@0 99 int high = packed.charAt(i++) << 16;
michael@0 100 result[j++] = high | packed.charAt(i++);
michael@0 101 }
michael@0 102 return j;
michael@0 103 }
michael@0 104
michael@0 105 /**
michael@0 106 * The transition table of the DFA
michael@0 107 */
michael@0 108 private static final int ZZ_TRANS [] = {
michael@0 109 2, 2, 3, 4, 2, 2, 2, 5, 2, 6,
michael@0 110 2, 2, 7, 8, 2, 9, 2, 2, 2, 2,
michael@0 111 2, 10, 11, 12, 13, 14, 15, 16, 16, 16,
michael@0 112 16, 16, 16, 16, 16, 17, 18, 16, 16, 16,
michael@0 113 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
michael@0 114 16, 16, 16, 16, -1, -1, -1, -1, -1, -1,
michael@0 115 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
michael@0 116 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
michael@0 117 -1, -1, -1, -1, 4, -1, -1, -1, -1, -1,
michael@0 118 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
michael@0 119 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
michael@0 120 -1, 4, 19, 20, -1, -1, -1, -1, -1, -1,
michael@0 121 -1, -1, -1, -1, -1, 20, -1, -1, -1, -1,
michael@0 122 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
michael@0 123 -1, -1, 5, -1, -1, -1, -1, -1, -1, -1,
michael@0 124 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
michael@0 125 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
michael@0 126 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
michael@0 127 21, -1, -1, -1, -1, -1, -1, -1, -1, -1,
michael@0 128 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
michael@0 129 -1, -1, -1, -1, -1, 22, -1, -1, -1, -1,
michael@0 130 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
michael@0 131 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
michael@0 132 23, -1, -1, -1, -1, -1, -1, -1, -1, -1,
michael@0 133 -1, -1, -1, 16, 16, 16, 16, 16, 16, 16,
michael@0 134 16, -1, -1, 16, 16, 16, 16, 16, 16, 16,
michael@0 135 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
michael@0 136 -1, -1, -1, -1, -1, -1, -1, -1, 24, 25,
michael@0 137 26, 27, 28, 29, 30, 31, 32, -1, -1, -1,
michael@0 138 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
michael@0 139 33, -1, -1, -1, -1, -1, -1, -1, -1, -1,
michael@0 140 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
michael@0 141 -1, -1, -1, -1, -1, -1, 34, 35, -1, -1,
michael@0 142 34, -1, -1, -1, -1, -1, -1, -1, -1, -1,
michael@0 143 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
michael@0 144 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
michael@0 145 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
michael@0 146 36, -1, -1, -1, -1, -1, -1, -1, -1, -1,
michael@0 147 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
michael@0 148 -1, -1, -1, -1, -1, -1, -1, 37, -1, -1,
michael@0 149 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
michael@0 150 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
michael@0 151 -1, 38, -1, -1, -1, -1, -1, -1, -1, -1,
michael@0 152 -1, -1, -1, 39, -1, 39, -1, 39, -1, -1,
michael@0 153 -1, -1, -1, 39, 39, -1, -1, -1, -1, 39,
michael@0 154 39, -1, -1, -1, -1, -1, -1, -1, -1, -1,
michael@0 155 -1, -1, 33, -1, 20, -1, -1, -1, -1, -1,
michael@0 156 -1, -1, -1, -1, -1, -1, 20, -1, -1, -1,
michael@0 157 -1, -1, -1, -1, -1, -1, -1, -1, -1, 35,
michael@0 158 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
michael@0 159 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
michael@0 160 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
michael@0 161 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
michael@0 162 -1, -1, -1, 38, -1, -1, -1, -1, -1, -1,
michael@0 163 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
michael@0 164 -1, -1, -1, -1, -1, -1, -1, -1, -1, 40,
michael@0 165 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
michael@0 166 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
michael@0 167 -1, -1, -1, -1, 41, -1, -1, -1, -1, -1,
michael@0 168 -1, -1, -1, -1, -1, 42, -1, 42, -1, 42,
michael@0 169 -1, -1, -1, -1, -1, 42, 42, -1, -1, -1,
michael@0 170 -1, 42, 42, -1, -1, -1, -1, -1, -1, -1,
michael@0 171 -1, -1, 43, -1, 43, -1, 43, -1, -1, -1,
michael@0 172 -1, -1, 43, 43, -1, -1, -1, -1, 43, 43,
michael@0 173 -1, -1, -1, -1, -1, -1, -1, -1, -1, 44,
michael@0 174 -1, 44, -1, 44, -1, -1, -1, -1, -1, 44,
michael@0 175 44, -1, -1, -1, -1, 44, 44, -1, -1, -1,
michael@0 176 -1, -1, -1, -1, -1,
michael@0 177 };
michael@0 178
michael@0 179 /* error codes */
michael@0 180 private static final int ZZ_UNKNOWN_ERROR = 0;
michael@0 181 private static final int ZZ_NO_MATCH = 1;
michael@0 182 private static final int ZZ_PUSHBACK_2BIG = 2;
michael@0 183
michael@0 184 /* error messages for the codes above */
michael@0 185 private static final String ZZ_ERROR_MSG[] = {
michael@0 186 "Unkown internal scanner error",
michael@0 187 "Error: could not match input",
michael@0 188 "Error: pushback value was too large"
michael@0 189 };
michael@0 190
michael@0 191 /**
michael@0 192 * ZZ_ATTRIBUTE[aState] contains the attributes of state <code>aState</code>
michael@0 193 */
michael@0 194 private static final int [] ZZ_ATTRIBUTE = zzUnpackAttribute();
michael@0 195
michael@0 196 private static final String ZZ_ATTRIBUTE_PACKED_0 =
michael@0 197 "\2\0\1\11\3\1\1\11\3\1\6\11\2\1\1\11"+
michael@0 198 "\5\0\10\11\1\0\1\1\1\0\1\1\4\0\2\11"+
michael@0 199 "\2\0\1\11";
michael@0 200
michael@0 201 private static int [] zzUnpackAttribute() {
michael@0 202 int [] result = new int[45];
michael@0 203 int offset = 0;
michael@0 204 offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
michael@0 205 return result;
michael@0 206 }
michael@0 207
michael@0 208 private static int zzUnpackAttribute(String packed, int offset, int [] result) {
michael@0 209 int i = 0; /* index in packed string */
michael@0 210 int j = offset; /* index in unpacked array */
michael@0 211 int l = packed.length();
michael@0 212 while (i < l) {
michael@0 213 int count = packed.charAt(i++);
michael@0 214 int value = packed.charAt(i++);
michael@0 215 do result[j++] = value; while (--count > 0);
michael@0 216 }
michael@0 217 return j;
michael@0 218 }
michael@0 219
michael@0 220 /** the input device */
michael@0 221 private java.io.Reader zzReader;
michael@0 222
michael@0 223 /** the current state of the DFA */
michael@0 224 private int zzState;
michael@0 225
michael@0 226 /** the current lexical state */
michael@0 227 private int zzLexicalState = YYINITIAL;
michael@0 228
michael@0 229 /** this buffer contains the current text to be matched and is
michael@0 230 the source of the yytext() string */
michael@0 231 private char zzBuffer[] = new char[ZZ_BUFFERSIZE];
michael@0 232
michael@0 233 /** the textposition at the last accepting state */
michael@0 234 private int zzMarkedPos;
michael@0 235
michael@0 236 /** the current text position in the buffer */
michael@0 237 private int zzCurrentPos;
michael@0 238
michael@0 239 /** startRead marks the beginning of the yytext() string in the buffer */
michael@0 240 private int zzStartRead;
michael@0 241
michael@0 242 /** endRead marks the last character in the buffer, that has been read
michael@0 243 from input */
michael@0 244 private int zzEndRead;
michael@0 245
michael@0 246 /** number of newlines encountered up to the start of the matched text */
michael@0 247 private int yyline;
michael@0 248
michael@0 249 /** the number of characters up to the start of the matched text */
michael@0 250 private int yychar;
michael@0 251
michael@0 252 /**
michael@0 253 * the number of characters from the last newline up to the start of the
michael@0 254 * matched text
michael@0 255 */
michael@0 256 private int yycolumn;
michael@0 257
michael@0 258 /**
michael@0 259 * zzAtBOL == true <=> the scanner is currently at the beginning of a line
michael@0 260 */
michael@0 261 private boolean zzAtBOL = true;
michael@0 262
michael@0 263 /** zzAtEOF == true <=> the scanner is at the EOF */
michael@0 264 private boolean zzAtEOF;
michael@0 265
michael@0 266 /* user code: */
michael@0 267 private StringBuffer sb=new StringBuffer();
michael@0 268
michael@0 269 int getPosition(){
michael@0 270 return yychar;
michael@0 271 }
michael@0 272
michael@0 273
michael@0 274
michael@0 275 /**
michael@0 276 * Creates a new scanner
michael@0 277 * There is also a java.io.InputStream version of this constructor.
michael@0 278 *
michael@0 279 * @param in the java.io.Reader to read input from.
michael@0 280 */
michael@0 281 Yylex(java.io.Reader in) {
michael@0 282 this.zzReader = in;
michael@0 283 }
michael@0 284
michael@0 285 /**
michael@0 286 * Creates a new scanner.
michael@0 287 * There is also java.io.Reader version of this constructor.
michael@0 288 *
michael@0 289 * @param in the java.io.Inputstream to read input from.
michael@0 290 */
michael@0 291 Yylex(java.io.InputStream in) {
michael@0 292 this(new java.io.InputStreamReader(in));
michael@0 293 }
michael@0 294
michael@0 295 /**
michael@0 296 * Unpacks the compressed character translation table.
michael@0 297 *
michael@0 298 * @param packed the packed character translation table
michael@0 299 * @return the unpacked character translation table
michael@0 300 */
michael@0 301 private static char [] zzUnpackCMap(String packed) {
michael@0 302 char [] map = new char[0x10000];
michael@0 303 int i = 0; /* index in packed string */
michael@0 304 int j = 0; /* index in unpacked array */
michael@0 305 while (i < 90) {
michael@0 306 int count = packed.charAt(i++);
michael@0 307 char value = packed.charAt(i++);
michael@0 308 do map[j++] = value; while (--count > 0);
michael@0 309 }
michael@0 310 return map;
michael@0 311 }
michael@0 312
michael@0 313
michael@0 314 /**
michael@0 315 * Refills the input buffer.
michael@0 316 *
michael@0 317 * @return <code>false</code>, iff there was new input.
michael@0 318 *
michael@0 319 * @exception java.io.IOException if any I/O-Error occurs
michael@0 320 */
michael@0 321 private boolean zzRefill() throws java.io.IOException {
michael@0 322
michael@0 323 /* first: make room (if you can) */
michael@0 324 if (zzStartRead > 0) {
michael@0 325 System.arraycopy(zzBuffer, zzStartRead,
michael@0 326 zzBuffer, 0,
michael@0 327 zzEndRead-zzStartRead);
michael@0 328
michael@0 329 /* translate stored positions */
michael@0 330 zzEndRead-= zzStartRead;
michael@0 331 zzCurrentPos-= zzStartRead;
michael@0 332 zzMarkedPos-= zzStartRead;
michael@0 333 zzStartRead = 0;
michael@0 334 }
michael@0 335
michael@0 336 /* is the buffer big enough? */
michael@0 337 if (zzCurrentPos >= zzBuffer.length) {
michael@0 338 /* if not: blow it up */
michael@0 339 char newBuffer[] = new char[zzCurrentPos*2];
michael@0 340 System.arraycopy(zzBuffer, 0, newBuffer, 0, zzBuffer.length);
michael@0 341 zzBuffer = newBuffer;
michael@0 342 }
michael@0 343
michael@0 344 /* finally: fill the buffer with new input */
michael@0 345 int numRead = zzReader.read(zzBuffer, zzEndRead,
michael@0 346 zzBuffer.length-zzEndRead);
michael@0 347
michael@0 348 if (numRead > 0) {
michael@0 349 zzEndRead+= numRead;
michael@0 350 return false;
michael@0 351 }
michael@0 352 // unlikely but not impossible: read 0 characters, but not at end of stream
michael@0 353 if (numRead == 0) {
michael@0 354 int c = zzReader.read();
michael@0 355 if (c == -1) {
michael@0 356 return true;
michael@0 357 } else {
michael@0 358 zzBuffer[zzEndRead++] = (char) c;
michael@0 359 return false;
michael@0 360 }
michael@0 361 }
michael@0 362
michael@0 363 // numRead < 0
michael@0 364 return true;
michael@0 365 }
michael@0 366
michael@0 367
michael@0 368 /**
michael@0 369 * Closes the input stream.
michael@0 370 */
michael@0 371 public final void yyclose() throws java.io.IOException {
michael@0 372 zzAtEOF = true; /* indicate end of file */
michael@0 373 zzEndRead = zzStartRead; /* invalidate buffer */
michael@0 374
michael@0 375 if (zzReader != null)
michael@0 376 zzReader.close();
michael@0 377 }
michael@0 378
michael@0 379
michael@0 380 /**
michael@0 381 * Resets the scanner to read from a new input stream.
michael@0 382 * Does not close the old reader.
michael@0 383 *
michael@0 384 * All internal variables are reset, the old input stream
michael@0 385 * <b>cannot</b> be reused (internal buffer is discarded and lost).
michael@0 386 * Lexical state is set to <tt>ZZ_INITIAL</tt>.
michael@0 387 *
michael@0 388 * @param reader the new input stream
michael@0 389 */
michael@0 390 public final void yyreset(java.io.Reader reader) {
michael@0 391 zzReader = reader;
michael@0 392 zzAtBOL = true;
michael@0 393 zzAtEOF = false;
michael@0 394 zzEndRead = zzStartRead = 0;
michael@0 395 zzCurrentPos = zzMarkedPos = 0;
michael@0 396 yyline = yychar = yycolumn = 0;
michael@0 397 zzLexicalState = YYINITIAL;
michael@0 398 }
michael@0 399
michael@0 400
michael@0 401 /**
michael@0 402 * Returns the current lexical state.
michael@0 403 */
michael@0 404 public final int yystate() {
michael@0 405 return zzLexicalState;
michael@0 406 }
michael@0 407
michael@0 408
michael@0 409 /**
michael@0 410 * Enters a new lexical state
michael@0 411 *
michael@0 412 * @param newState the new lexical state
michael@0 413 */
michael@0 414 public final void yybegin(int newState) {
michael@0 415 zzLexicalState = newState;
michael@0 416 }
michael@0 417
michael@0 418
michael@0 419 /**
michael@0 420 * Returns the text matched by the current regular expression.
michael@0 421 */
michael@0 422 public final String yytext() {
michael@0 423 return new String( zzBuffer, zzStartRead, zzMarkedPos-zzStartRead );
michael@0 424 }
michael@0 425
michael@0 426
michael@0 427 /**
michael@0 428 * Returns the character at position <tt>pos</tt> from the
michael@0 429 * matched text.
michael@0 430 *
michael@0 431 * It is equivalent to yytext().charAt(pos), but faster
michael@0 432 *
michael@0 433 * @param pos the position of the character to fetch.
michael@0 434 * A value from 0 to yylength()-1.
michael@0 435 *
michael@0 436 * @return the character at position pos
michael@0 437 */
michael@0 438 public final char yycharat(int pos) {
michael@0 439 return zzBuffer[zzStartRead+pos];
michael@0 440 }
michael@0 441
michael@0 442
michael@0 443 /**
michael@0 444 * Returns the length of the matched text region.
michael@0 445 */
michael@0 446 public final int yylength() {
michael@0 447 return zzMarkedPos-zzStartRead;
michael@0 448 }
michael@0 449
michael@0 450
michael@0 451 /**
michael@0 452 * Reports an error that occured while scanning.
michael@0 453 *
michael@0 454 * In a wellformed scanner (no or only correct usage of
michael@0 455 * yypushback(int) and a match-all fallback rule) this method
michael@0 456 * will only be called with things that "Can't Possibly Happen".
michael@0 457 * If this method is called, something is seriously wrong
michael@0 458 * (e.g. a JFlex bug producing a faulty scanner etc.).
michael@0 459 *
michael@0 460 * Usual syntax/scanner level error handling should be done
michael@0 461 * in error fallback rules.
michael@0 462 *
michael@0 463 * @param errorCode the code of the errormessage to display
michael@0 464 */
michael@0 465 private void zzScanError(int errorCode) {
michael@0 466 String message;
michael@0 467 try {
michael@0 468 message = ZZ_ERROR_MSG[errorCode];
michael@0 469 }
michael@0 470 catch (ArrayIndexOutOfBoundsException e) {
michael@0 471 message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
michael@0 472 }
michael@0 473
michael@0 474 throw new Error(message);
michael@0 475 }
michael@0 476
michael@0 477
michael@0 478 /**
michael@0 479 * Pushes the specified amount of characters back into the input stream.
michael@0 480 *
michael@0 481 * They will be read again by then next call of the scanning method
michael@0 482 *
michael@0 483 * @param number the number of characters to be read again.
michael@0 484 * This number must not be greater than yylength()!
michael@0 485 */
michael@0 486 public void yypushback(int number) {
michael@0 487 if ( number > yylength() )
michael@0 488 zzScanError(ZZ_PUSHBACK_2BIG);
michael@0 489
michael@0 490 zzMarkedPos -= number;
michael@0 491 }
michael@0 492
michael@0 493
michael@0 494 /**
michael@0 495 * Resumes scanning until the next regular expression is matched,
michael@0 496 * the end of input is encountered or an I/O-Error occurs.
michael@0 497 *
michael@0 498 * @return the next token
michael@0 499 * @exception java.io.IOException if any I/O-Error occurs
michael@0 500 */
michael@0 501 public Yytoken yylex() throws java.io.IOException, ParseException {
michael@0 502 int zzInput;
michael@0 503 int zzAction;
michael@0 504
michael@0 505 // cached fields:
michael@0 506 int zzCurrentPosL;
michael@0 507 int zzMarkedPosL;
michael@0 508 int zzEndReadL = zzEndRead;
michael@0 509 char [] zzBufferL = zzBuffer;
michael@0 510 char [] zzCMapL = ZZ_CMAP;
michael@0 511
michael@0 512 int [] zzTransL = ZZ_TRANS;
michael@0 513 int [] zzRowMapL = ZZ_ROWMAP;
michael@0 514 int [] zzAttrL = ZZ_ATTRIBUTE;
michael@0 515
michael@0 516 while (true) {
michael@0 517 zzMarkedPosL = zzMarkedPos;
michael@0 518
michael@0 519 yychar+= zzMarkedPosL-zzStartRead;
michael@0 520
michael@0 521 zzAction = -1;
michael@0 522
michael@0 523 zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
michael@0 524
michael@0 525 zzState = ZZ_LEXSTATE[zzLexicalState];
michael@0 526
michael@0 527
michael@0 528 zzForAction: {
michael@0 529 while (true) {
michael@0 530
michael@0 531 if (zzCurrentPosL < zzEndReadL)
michael@0 532 zzInput = zzBufferL[zzCurrentPosL++];
michael@0 533 else if (zzAtEOF) {
michael@0 534 zzInput = YYEOF;
michael@0 535 break zzForAction;
michael@0 536 }
michael@0 537 else {
michael@0 538 // store back cached positions
michael@0 539 zzCurrentPos = zzCurrentPosL;
michael@0 540 zzMarkedPos = zzMarkedPosL;
michael@0 541 boolean eof = zzRefill();
michael@0 542 // get translated positions and possibly new buffer
michael@0 543 zzCurrentPosL = zzCurrentPos;
michael@0 544 zzMarkedPosL = zzMarkedPos;
michael@0 545 zzBufferL = zzBuffer;
michael@0 546 zzEndReadL = zzEndRead;
michael@0 547 if (eof) {
michael@0 548 zzInput = YYEOF;
michael@0 549 break zzForAction;
michael@0 550 }
michael@0 551 else {
michael@0 552 zzInput = zzBufferL[zzCurrentPosL++];
michael@0 553 }
michael@0 554 }
michael@0 555 int zzNext = zzTransL[ zzRowMapL[zzState] + zzCMapL[zzInput] ];
michael@0 556 if (zzNext == -1) break zzForAction;
michael@0 557 zzState = zzNext;
michael@0 558
michael@0 559 int zzAttributes = zzAttrL[zzState];
michael@0 560 if ( (zzAttributes & 1) == 1 ) {
michael@0 561 zzAction = zzState;
michael@0 562 zzMarkedPosL = zzCurrentPosL;
michael@0 563 if ( (zzAttributes & 8) == 8 ) break zzForAction;
michael@0 564 }
michael@0 565
michael@0 566 }
michael@0 567 }
michael@0 568
michael@0 569 // store back cached position
michael@0 570 zzMarkedPos = zzMarkedPosL;
michael@0 571
michael@0 572 switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
michael@0 573 case 11:
michael@0 574 { sb.append(yytext());
michael@0 575 }
michael@0 576 case 25: break;
michael@0 577 case 4:
michael@0 578 { sb.delete(0, sb.length());yybegin(STRING_BEGIN);
michael@0 579 }
michael@0 580 case 26: break;
michael@0 581 case 16:
michael@0 582 { sb.append('\b');
michael@0 583 }
michael@0 584 case 27: break;
michael@0 585 case 6:
michael@0 586 { return new Yytoken(Yytoken.TYPE_RIGHT_BRACE,null);
michael@0 587 }
michael@0 588 case 28: break;
michael@0 589 case 23:
michael@0 590 { Boolean val=Boolean.valueOf(yytext()); return new Yytoken(Yytoken.TYPE_VALUE, val);
michael@0 591 }
michael@0 592 case 29: break;
michael@0 593 case 22:
michael@0 594 { return new Yytoken(Yytoken.TYPE_VALUE, null);
michael@0 595 }
michael@0 596 case 30: break;
michael@0 597 case 13:
michael@0 598 { yybegin(YYINITIAL);return new Yytoken(Yytoken.TYPE_VALUE, sb.toString());
michael@0 599 }
michael@0 600 case 31: break;
michael@0 601 case 12:
michael@0 602 { sb.append('\\');
michael@0 603 }
michael@0 604 case 32: break;
michael@0 605 case 21:
michael@0 606 { Double val=Double.valueOf(yytext()); return new Yytoken(Yytoken.TYPE_VALUE, val);
michael@0 607 }
michael@0 608 case 33: break;
michael@0 609 case 1:
michael@0 610 { throw new ParseException(yychar, ParseException.ERROR_UNEXPECTED_CHAR, new Character(yycharat(0)));
michael@0 611 }
michael@0 612 case 34: break;
michael@0 613 case 8:
michael@0 614 { return new Yytoken(Yytoken.TYPE_RIGHT_SQUARE,null);
michael@0 615 }
michael@0 616 case 35: break;
michael@0 617 case 19:
michael@0 618 { sb.append('\r');
michael@0 619 }
michael@0 620 case 36: break;
michael@0 621 case 15:
michael@0 622 { sb.append('/');
michael@0 623 }
michael@0 624 case 37: break;
michael@0 625 case 10:
michael@0 626 { return new Yytoken(Yytoken.TYPE_COLON,null);
michael@0 627 }
michael@0 628 case 38: break;
michael@0 629 case 14:
michael@0 630 { sb.append('"');
michael@0 631 }
michael@0 632 case 39: break;
michael@0 633 case 5:
michael@0 634 { return new Yytoken(Yytoken.TYPE_LEFT_BRACE,null);
michael@0 635 }
michael@0 636 case 40: break;
michael@0 637 case 17:
michael@0 638 { sb.append('\f');
michael@0 639 }
michael@0 640 case 41: break;
michael@0 641 case 24:
michael@0 642 { try{
michael@0 643 int ch=Integer.parseInt(yytext().substring(2),16);
michael@0 644 sb.append((char)ch);
michael@0 645 }
michael@0 646 catch(Exception e){
michael@0 647 throw new ParseException(yychar, ParseException.ERROR_UNEXPECTED_EXCEPTION, e);
michael@0 648 }
michael@0 649 }
michael@0 650 case 42: break;
michael@0 651 case 20:
michael@0 652 { sb.append('\t');
michael@0 653 }
michael@0 654 case 43: break;
michael@0 655 case 7:
michael@0 656 { return new Yytoken(Yytoken.TYPE_LEFT_SQUARE,null);
michael@0 657 }
michael@0 658 case 44: break;
michael@0 659 case 2:
michael@0 660 { Long val=Long.valueOf(yytext()); return new Yytoken(Yytoken.TYPE_VALUE, val);
michael@0 661 }
michael@0 662 case 45: break;
michael@0 663 case 18:
michael@0 664 { sb.append('\n');
michael@0 665 }
michael@0 666 case 46: break;
michael@0 667 case 9:
michael@0 668 { return new Yytoken(Yytoken.TYPE_COMMA,null);
michael@0 669 }
michael@0 670 case 47: break;
michael@0 671 case 3:
michael@0 672 {
michael@0 673 }
michael@0 674 case 48: break;
michael@0 675 default:
michael@0 676 if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
michael@0 677 zzAtEOF = true;
michael@0 678 return null;
michael@0 679 }
michael@0 680 else {
michael@0 681 zzScanError(ZZ_NO_MATCH);
michael@0 682 }
michael@0 683 }
michael@0 684 }
michael@0 685 }
michael@0 686
michael@0 687
michael@0 688 }

mercurial