1 // $ANTLR 3.1.1 c:\\Users\\leo\\work\\eclipse\\workspace\\xerial\\xerial-core\\src\\main\\java\\org\\xerial\\silk\\impl\\InLineJSON.g 2009-01-30 21:13:12
3 //--------------------------------------
6 // InLineJSONParser.java
9 //--------------------------------------
10 package org.xerial.silk.impl;
13 import org.antlr.runtime.*;
14 import java.util.Stack;
15 import java.util.List;
16 import java.util.ArrayList;
18 public class InLineJSONParser extends Parser {
19 public static final String[] tokenNames = new String[] {
20 "<invalid>", "<EOR>", "<DOWN>", "<UP>", "WhiteSpace", "Digit", "Letter", "HexDigit", "UnicodeChar", "EscapeSequence", "StringChar", "StringChar_s", "String", "Colon", "Comma", "Integer", "Frac", "Exp", "Double", "LBrace", "RBrace", "LBracket", "RBracket", "'true'", "'false'", "'null'"
22 public static final int RBrace=20;
23 public static final int LBracket=21;
24 public static final int T__23=23;
25 public static final int Digit=5;
26 public static final int Frac=16;
27 public static final int HexDigit=7;
28 public static final int Exp=17;
29 public static final int UnicodeChar=8;
30 public static final int StringChar=10;
31 public static final int String=12;
32 public static final int Letter=6;
33 public static final int Comma=14;
34 public static final int EscapeSequence=9;
35 public static final int EOF=-1;
36 public static final int T__24=24;
37 public static final int StringChar_s=11;
38 public static final int Integer=15;
39 public static final int LBrace=19;
40 public static final int Double=18;
41 public static final int RBracket=22;
42 public static final int T__25=25;
43 public static final int WhiteSpace=4;
44 public static final int Colon=13;
50 public InLineJSONParser(TokenStream input) {
51 this(input, new RecognizerSharedState());
53 public InLineJSONParser(TokenStream input, RecognizerSharedState state) {
59 public String[] getTokenNames() { return InLineJSONParser.tokenNames; }
60 public String getGrammarFileName() { return "c:\\Users\\leo\\work\\eclipse\\workspace\\xerial\\xerial-core\\src\\main\\java\\org\\xerial\\silk\\impl\\InLineJSON.g"; }
64 // $ANTLR start "jsonObjectFragment"
65 // c:\\Users\\leo\\work\\eclipse\\workspace\\xerial\\xerial-core\\src\\main\\java\\org\\xerial\\silk\\impl\\InLineJSON.g:96:1: jsonObjectFragment : jsonElement ( Comma jsonElement )* ;
66 public final void jsonObjectFragment() throws RecognitionException {
68 // c:\\Users\\leo\\work\\eclipse\\workspace\\xerial\\xerial-core\\src\\main\\java\\org\\xerial\\silk\\impl\\InLineJSON.g:96:19: ( jsonElement ( Comma jsonElement )* )
69 // c:\\Users\\leo\\work\\eclipse\\workspace\\xerial\\xerial-core\\src\\main\\java\\org\\xerial\\silk\\impl\\InLineJSON.g:96:21: jsonElement ( Comma jsonElement )*
71 pushFollow(FOLLOW_jsonElement_in_jsonObjectFragment369);
76 // c:\\Users\\leo\\work\\eclipse\\workspace\\xerial\\xerial-core\\src\\main\\java\\org\\xerial\\silk\\impl\\InLineJSON.g:96:33: ( Comma jsonElement )*
80 int LA1_0 = input.LA(1);
82 if ( (LA1_0==Comma) ) {
89 // c:\\Users\\leo\\work\\eclipse\\workspace\\xerial\\xerial-core\\src\\main\\java\\org\\xerial\\silk\\impl\\InLineJSON.g:96:34: Comma jsonElement
91 match(input,Comma,FOLLOW_Comma_in_jsonObjectFragment372);
92 pushFollow(FOLLOW_jsonElement_in_jsonObjectFragment374);
110 catch (RecognitionException re) {
118 // $ANTLR end "jsonObjectFragment"
121 // $ANTLR start "jsonArrayFragment"
122 // c:\\Users\\leo\\work\\eclipse\\workspace\\xerial\\xerial-core\\src\\main\\java\\org\\xerial\\silk\\impl\\InLineJSON.g:97:1: jsonArrayFragment : jsonValue ( Comma jsonValue )* ;
123 public final void jsonArrayFragment() throws RecognitionException {
125 // c:\\Users\\leo\\work\\eclipse\\workspace\\xerial\\xerial-core\\src\\main\\java\\org\\xerial\\silk\\impl\\InLineJSON.g:97:18: ( jsonValue ( Comma jsonValue )* )
126 // c:\\Users\\leo\\work\\eclipse\\workspace\\xerial\\xerial-core\\src\\main\\java\\org\\xerial\\silk\\impl\\InLineJSON.g:97:20: jsonValue ( Comma jsonValue )*
128 pushFollow(FOLLOW_jsonValue_in_jsonArrayFragment382);
133 // c:\\Users\\leo\\work\\eclipse\\workspace\\xerial\\xerial-core\\src\\main\\java\\org\\xerial\\silk\\impl\\InLineJSON.g:97:30: ( Comma jsonValue )*
137 int LA2_0 = input.LA(1);
139 if ( (LA2_0==Comma) ) {
146 // c:\\Users\\leo\\work\\eclipse\\workspace\\xerial\\xerial-core\\src\\main\\java\\org\\xerial\\silk\\impl\\InLineJSON.g:97:31: Comma jsonValue
148 match(input,Comma,FOLLOW_Comma_in_jsonArrayFragment385);
149 pushFollow(FOLLOW_jsonValue_in_jsonArrayFragment387);
167 catch (RecognitionException re) {
175 // $ANTLR end "jsonArrayFragment"
178 // $ANTLR start "jsonObject"
179 // c:\\Users\\leo\\work\\eclipse\\workspace\\xerial\\xerial-core\\src\\main\\java\\org\\xerial\\silk\\impl\\InLineJSON.g:99:1: jsonObject : LBrace jsonElement ( ',' jsonElement )* RBrace ;
180 public final void jsonObject() throws RecognitionException {
182 // c:\\Users\\leo\\work\\eclipse\\workspace\\xerial\\xerial-core\\src\\main\\java\\org\\xerial\\silk\\impl\\InLineJSON.g:99:11: ( LBrace jsonElement ( ',' jsonElement )* RBrace )
183 // c:\\Users\\leo\\work\\eclipse\\workspace\\xerial\\xerial-core\\src\\main\\java\\org\\xerial\\silk\\impl\\InLineJSON.g:99:13: LBrace jsonElement ( ',' jsonElement )* RBrace
185 match(input,LBrace,FOLLOW_LBrace_in_jsonObject396);
186 pushFollow(FOLLOW_jsonElement_in_jsonObject398);
191 // c:\\Users\\leo\\work\\eclipse\\workspace\\xerial\\xerial-core\\src\\main\\java\\org\\xerial\\silk\\impl\\InLineJSON.g:99:32: ( ',' jsonElement )*
195 int LA3_0 = input.LA(1);
197 if ( (LA3_0==Comma) ) {
204 // c:\\Users\\leo\\work\\eclipse\\workspace\\xerial\\xerial-core\\src\\main\\java\\org\\xerial\\silk\\impl\\InLineJSON.g:99:33: ',' jsonElement
206 match(input,Comma,FOLLOW_Comma_in_jsonObject401);
207 pushFollow(FOLLOW_jsonElement_in_jsonObject403);
221 match(input,RBrace,FOLLOW_RBrace_in_jsonObject407);
226 catch (RecognitionException re) {
234 // $ANTLR end "jsonObject"
237 // $ANTLR start "jsonElement"
238 // c:\\Users\\leo\\work\\eclipse\\workspace\\xerial\\xerial-core\\src\\main\\java\\org\\xerial\\silk\\impl\\InLineJSON.g:100:1: jsonElement : String Colon jsonValue ;
239 public final void jsonElement() throws RecognitionException {
241 // c:\\Users\\leo\\work\\eclipse\\workspace\\xerial\\xerial-core\\src\\main\\java\\org\\xerial\\silk\\impl\\InLineJSON.g:100:12: ( String Colon jsonValue )
242 // c:\\Users\\leo\\work\\eclipse\\workspace\\xerial\\xerial-core\\src\\main\\java\\org\\xerial\\silk\\impl\\InLineJSON.g:100:14: String Colon jsonValue
244 match(input,String,FOLLOW_String_in_jsonElement413);
245 match(input,Colon,FOLLOW_Colon_in_jsonElement415);
246 pushFollow(FOLLOW_jsonValue_in_jsonElement417);
255 catch (RecognitionException re) {
263 // $ANTLR end "jsonElement"
266 // $ANTLR start "jsonArray"
267 // c:\\Users\\leo\\work\\eclipse\\workspace\\xerial\\xerial-core\\src\\main\\java\\org\\xerial\\silk\\impl\\InLineJSON.g:101:1: jsonArray : LBracket jsonValue ( ',' jsonValue )* RBracket ;
268 public final void jsonArray() throws RecognitionException {
270 // c:\\Users\\leo\\work\\eclipse\\workspace\\xerial\\xerial-core\\src\\main\\java\\org\\xerial\\silk\\impl\\InLineJSON.g:101:10: ( LBracket jsonValue ( ',' jsonValue )* RBracket )
271 // c:\\Users\\leo\\work\\eclipse\\workspace\\xerial\\xerial-core\\src\\main\\java\\org\\xerial\\silk\\impl\\InLineJSON.g:101:12: LBracket jsonValue ( ',' jsonValue )* RBracket
273 match(input,LBracket,FOLLOW_LBracket_in_jsonArray424);
274 pushFollow(FOLLOW_jsonValue_in_jsonArray426);
279 // c:\\Users\\leo\\work\\eclipse\\workspace\\xerial\\xerial-core\\src\\main\\java\\org\\xerial\\silk\\impl\\InLineJSON.g:101:31: ( ',' jsonValue )*
283 int LA4_0 = input.LA(1);
285 if ( (LA4_0==Comma) ) {
292 // c:\\Users\\leo\\work\\eclipse\\workspace\\xerial\\xerial-core\\src\\main\\java\\org\\xerial\\silk\\impl\\InLineJSON.g:101:32: ',' jsonValue
294 match(input,Comma,FOLLOW_Comma_in_jsonArray429);
295 pushFollow(FOLLOW_jsonValue_in_jsonArray431);
309 match(input,RBracket,FOLLOW_RBracket_in_jsonArray435);
314 catch (RecognitionException re) {
322 // $ANTLR end "jsonArray"
325 // $ANTLR start "jsonValue"
326 // c:\\Users\\leo\\work\\eclipse\\workspace\\xerial\\xerial-core\\src\\main\\java\\org\\xerial\\silk\\impl\\InLineJSON.g:103:1: jsonValue : ( jsonObject | jsonArray | String | Integer | Double | 'true' | 'false' | 'null' );
327 public final void jsonValue() throws RecognitionException {
329 // c:\\Users\\leo\\work\\eclipse\\workspace\\xerial\\xerial-core\\src\\main\\java\\org\\xerial\\silk\\impl\\InLineJSON.g:104:2: ( jsonObject | jsonArray | String | Integer | Double | 'true' | 'false' | 'null' )
331 switch ( input.LA(1) ) {
373 NoViableAltException nvae =
374 new NoViableAltException("", 5, 0, input);
381 // c:\\Users\\leo\\work\\eclipse\\workspace\\xerial\\xerial-core\\src\\main\\java\\org\\xerial\\silk\\impl\\InLineJSON.g:104:4: jsonObject
383 pushFollow(FOLLOW_jsonObject_in_jsonValue444);
392 // c:\\Users\\leo\\work\\eclipse\\workspace\\xerial\\xerial-core\\src\\main\\java\\org\\xerial\\silk\\impl\\InLineJSON.g:105:4: jsonArray
394 pushFollow(FOLLOW_jsonArray_in_jsonValue449);
403 // c:\\Users\\leo\\work\\eclipse\\workspace\\xerial\\xerial-core\\src\\main\\java\\org\\xerial\\silk\\impl\\InLineJSON.g:106:4: String
405 match(input,String,FOLLOW_String_in_jsonValue454);
410 // c:\\Users\\leo\\work\\eclipse\\workspace\\xerial\\xerial-core\\src\\main\\java\\org\\xerial\\silk\\impl\\InLineJSON.g:107:4: Integer
412 match(input,Integer,FOLLOW_Integer_in_jsonValue459);
417 // c:\\Users\\leo\\work\\eclipse\\workspace\\xerial\\xerial-core\\src\\main\\java\\org\\xerial\\silk\\impl\\InLineJSON.g:108:4: Double
419 match(input,Double,FOLLOW_Double_in_jsonValue464);
424 // c:\\Users\\leo\\work\\eclipse\\workspace\\xerial\\xerial-core\\src\\main\\java\\org\\xerial\\silk\\impl\\InLineJSON.g:109:4: 'true'
426 match(input,23,FOLLOW_23_in_jsonValue469);
431 // c:\\Users\\leo\\work\\eclipse\\workspace\\xerial\\xerial-core\\src\\main\\java\\org\\xerial\\silk\\impl\\InLineJSON.g:110:4: 'false'
433 match(input,24,FOLLOW_24_in_jsonValue474);
438 // c:\\Users\\leo\\work\\eclipse\\workspace\\xerial\\xerial-core\\src\\main\\java\\org\\xerial\\silk\\impl\\InLineJSON.g:111:4: 'null'
440 match(input,25,FOLLOW_25_in_jsonValue479);
447 catch (RecognitionException re) {
455 // $ANTLR end "jsonValue"
462 public static final BitSet FOLLOW_jsonElement_in_jsonObjectFragment369 = new BitSet(new long[]{0x0000000000004002L});
463 public static final BitSet FOLLOW_Comma_in_jsonObjectFragment372 = new BitSet(new long[]{0x0000000000001000L});
464 public static final BitSet FOLLOW_jsonElement_in_jsonObjectFragment374 = new BitSet(new long[]{0x0000000000004002L});
465 public static final BitSet FOLLOW_jsonValue_in_jsonArrayFragment382 = new BitSet(new long[]{0x0000000000004002L});
466 public static final BitSet FOLLOW_Comma_in_jsonArrayFragment385 = new BitSet(new long[]{0x0000000003AC9000L});
467 public static final BitSet FOLLOW_jsonValue_in_jsonArrayFragment387 = new BitSet(new long[]{0x0000000000004002L});
468 public static final BitSet FOLLOW_LBrace_in_jsonObject396 = new BitSet(new long[]{0x0000000000001000L});
469 public static final BitSet FOLLOW_jsonElement_in_jsonObject398 = new BitSet(new long[]{0x0000000000104000L});
470 public static final BitSet FOLLOW_Comma_in_jsonObject401 = new BitSet(new long[]{0x0000000000001000L});
471 public static final BitSet FOLLOW_jsonElement_in_jsonObject403 = new BitSet(new long[]{0x0000000000104000L});
472 public static final BitSet FOLLOW_RBrace_in_jsonObject407 = new BitSet(new long[]{0x0000000000000002L});
473 public static final BitSet FOLLOW_String_in_jsonElement413 = new BitSet(new long[]{0x0000000000002000L});
474 public static final BitSet FOLLOW_Colon_in_jsonElement415 = new BitSet(new long[]{0x0000000003AC9000L});
475 public static final BitSet FOLLOW_jsonValue_in_jsonElement417 = new BitSet(new long[]{0x0000000000000002L});
476 public static final BitSet FOLLOW_LBracket_in_jsonArray424 = new BitSet(new long[]{0x0000000003AC9000L});
477 public static final BitSet FOLLOW_jsonValue_in_jsonArray426 = new BitSet(new long[]{0x0000000000404000L});
478 public static final BitSet FOLLOW_Comma_in_jsonArray429 = new BitSet(new long[]{0x0000000003AC9000L});
479 public static final BitSet FOLLOW_jsonValue_in_jsonArray431 = new BitSet(new long[]{0x0000000000404000L});
480 public static final BitSet FOLLOW_RBracket_in_jsonArray435 = new BitSet(new long[]{0x0000000000000002L});
481 public static final BitSet FOLLOW_jsonObject_in_jsonValue444 = new BitSet(new long[]{0x0000000000000002L});
482 public static final BitSet FOLLOW_jsonArray_in_jsonValue449 = new BitSet(new long[]{0x0000000000000002L});
483 public static final BitSet FOLLOW_String_in_jsonValue454 = new BitSet(new long[]{0x0000000000000002L});
484 public static final BitSet FOLLOW_Integer_in_jsonValue459 = new BitSet(new long[]{0x0000000000000002L});
485 public static final BitSet FOLLOW_Double_in_jsonValue464 = new BitSet(new long[]{0x0000000000000002L});
486 public static final BitSet FOLLOW_23_in_jsonValue469 = new BitSet(new long[]{0x0000000000000002L});
487 public static final BitSet FOLLOW_24_in_jsonValue474 = new BitSet(new long[]{0x0000000000000002L});
488 public static final BitSet FOLLOW_25_in_jsonValue479 = new BitSet(new long[]{0x0000000000000002L});