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