OSDN Git Service

implemnted toString() methods
[xerial/xerial-core.git] / src / main / java / org / xerial / silk / impl / InLineJSONParser.java
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
2
3 //--------------------------------------
4 // XerialJ Project
5 //
6 // InLineJSONParser.java
7 // Since: Apr 26, 2007
8 //
9 //--------------------------------------
10 package org.xerial.silk.impl;
11
12
13 import org.antlr.runtime.*;
14 import java.util.Stack;
15 import java.util.List;
16 import java.util.ArrayList;
17
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'"
21     };
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;
45
46     // delegates
47     // delegators
48
49
50         public InLineJSONParser(TokenStream input) {
51             this(input, new RecognizerSharedState());
52         }
53         public InLineJSONParser(TokenStream input, RecognizerSharedState state) {
54             super(input, state);
55              
56         }
57         
58
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"; }
61
62
63
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 {
67         try {
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 )*
70             {
71             pushFollow(FOLLOW_jsonElement_in_jsonObjectFragment369);
72             jsonElement();
73
74             state._fsp--;
75
76             // c:\\Users\\leo\\work\\eclipse\\workspace\\xerial\\xerial-core\\src\\main\\java\\org\\xerial\\silk\\impl\\InLineJSON.g:96:33: ( Comma jsonElement )*
77             loop1:
78             do {
79                 int alt1=2;
80                 int LA1_0 = input.LA(1);
81
82                 if ( (LA1_0==Comma) ) {
83                     alt1=1;
84                 }
85
86
87                 switch (alt1) {
88                 case 1 :
89                     // c:\\Users\\leo\\work\\eclipse\\workspace\\xerial\\xerial-core\\src\\main\\java\\org\\xerial\\silk\\impl\\InLineJSON.g:96:34: Comma jsonElement
90                     {
91                     match(input,Comma,FOLLOW_Comma_in_jsonObjectFragment372); 
92                     pushFollow(FOLLOW_jsonElement_in_jsonObjectFragment374);
93                     jsonElement();
94
95                     state._fsp--;
96
97
98                     }
99                     break;
100
101                 default :
102                     break loop1;
103                 }
104             } while (true);
105
106
107             }
108
109         }
110         catch (RecognitionException re) {
111             reportError(re);
112             recover(input,re);
113         }
114         finally {
115         }
116         return ;
117     }
118     // $ANTLR end "jsonObjectFragment"
119
120
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 {
124         try {
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 )*
127             {
128             pushFollow(FOLLOW_jsonValue_in_jsonArrayFragment382);
129             jsonValue();
130
131             state._fsp--;
132
133             // c:\\Users\\leo\\work\\eclipse\\workspace\\xerial\\xerial-core\\src\\main\\java\\org\\xerial\\silk\\impl\\InLineJSON.g:97:30: ( Comma jsonValue )*
134             loop2:
135             do {
136                 int alt2=2;
137                 int LA2_0 = input.LA(1);
138
139                 if ( (LA2_0==Comma) ) {
140                     alt2=1;
141                 }
142
143
144                 switch (alt2) {
145                 case 1 :
146                     // c:\\Users\\leo\\work\\eclipse\\workspace\\xerial\\xerial-core\\src\\main\\java\\org\\xerial\\silk\\impl\\InLineJSON.g:97:31: Comma jsonValue
147                     {
148                     match(input,Comma,FOLLOW_Comma_in_jsonArrayFragment385); 
149                     pushFollow(FOLLOW_jsonValue_in_jsonArrayFragment387);
150                     jsonValue();
151
152                     state._fsp--;
153
154
155                     }
156                     break;
157
158                 default :
159                     break loop2;
160                 }
161             } while (true);
162
163
164             }
165
166         }
167         catch (RecognitionException re) {
168             reportError(re);
169             recover(input,re);
170         }
171         finally {
172         }
173         return ;
174     }
175     // $ANTLR end "jsonArrayFragment"
176
177
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 {
181         try {
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
184             {
185             match(input,LBrace,FOLLOW_LBrace_in_jsonObject396); 
186             pushFollow(FOLLOW_jsonElement_in_jsonObject398);
187             jsonElement();
188
189             state._fsp--;
190
191             // c:\\Users\\leo\\work\\eclipse\\workspace\\xerial\\xerial-core\\src\\main\\java\\org\\xerial\\silk\\impl\\InLineJSON.g:99:32: ( ',' jsonElement )*
192             loop3:
193             do {
194                 int alt3=2;
195                 int LA3_0 = input.LA(1);
196
197                 if ( (LA3_0==Comma) ) {
198                     alt3=1;
199                 }
200
201
202                 switch (alt3) {
203                 case 1 :
204                     // c:\\Users\\leo\\work\\eclipse\\workspace\\xerial\\xerial-core\\src\\main\\java\\org\\xerial\\silk\\impl\\InLineJSON.g:99:33: ',' jsonElement
205                     {
206                     match(input,Comma,FOLLOW_Comma_in_jsonObject401); 
207                     pushFollow(FOLLOW_jsonElement_in_jsonObject403);
208                     jsonElement();
209
210                     state._fsp--;
211
212
213                     }
214                     break;
215
216                 default :
217                     break loop3;
218                 }
219             } while (true);
220
221             match(input,RBrace,FOLLOW_RBrace_in_jsonObject407); 
222
223             }
224
225         }
226         catch (RecognitionException re) {
227             reportError(re);
228             recover(input,re);
229         }
230         finally {
231         }
232         return ;
233     }
234     // $ANTLR end "jsonObject"
235
236
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 {
240         try {
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
243             {
244             match(input,String,FOLLOW_String_in_jsonElement413); 
245             match(input,Colon,FOLLOW_Colon_in_jsonElement415); 
246             pushFollow(FOLLOW_jsonValue_in_jsonElement417);
247             jsonValue();
248
249             state._fsp--;
250
251
252             }
253
254         }
255         catch (RecognitionException re) {
256             reportError(re);
257             recover(input,re);
258         }
259         finally {
260         }
261         return ;
262     }
263     // $ANTLR end "jsonElement"
264
265
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 {
269         try {
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
272             {
273             match(input,LBracket,FOLLOW_LBracket_in_jsonArray424); 
274             pushFollow(FOLLOW_jsonValue_in_jsonArray426);
275             jsonValue();
276
277             state._fsp--;
278
279             // c:\\Users\\leo\\work\\eclipse\\workspace\\xerial\\xerial-core\\src\\main\\java\\org\\xerial\\silk\\impl\\InLineJSON.g:101:31: ( ',' jsonValue )*
280             loop4:
281             do {
282                 int alt4=2;
283                 int LA4_0 = input.LA(1);
284
285                 if ( (LA4_0==Comma) ) {
286                     alt4=1;
287                 }
288
289
290                 switch (alt4) {
291                 case 1 :
292                     // c:\\Users\\leo\\work\\eclipse\\workspace\\xerial\\xerial-core\\src\\main\\java\\org\\xerial\\silk\\impl\\InLineJSON.g:101:32: ',' jsonValue
293                     {
294                     match(input,Comma,FOLLOW_Comma_in_jsonArray429); 
295                     pushFollow(FOLLOW_jsonValue_in_jsonArray431);
296                     jsonValue();
297
298                     state._fsp--;
299
300
301                     }
302                     break;
303
304                 default :
305                     break loop4;
306                 }
307             } while (true);
308
309             match(input,RBracket,FOLLOW_RBracket_in_jsonArray435); 
310
311             }
312
313         }
314         catch (RecognitionException re) {
315             reportError(re);
316             recover(input,re);
317         }
318         finally {
319         }
320         return ;
321     }
322     // $ANTLR end "jsonArray"
323
324
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 {
328         try {
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' )
330             int alt5=8;
331             switch ( input.LA(1) ) {
332             case LBrace:
333                 {
334                 alt5=1;
335                 }
336                 break;
337             case LBracket:
338                 {
339                 alt5=2;
340                 }
341                 break;
342             case String:
343                 {
344                 alt5=3;
345                 }
346                 break;
347             case Integer:
348                 {
349                 alt5=4;
350                 }
351                 break;
352             case Double:
353                 {
354                 alt5=5;
355                 }
356                 break;
357             case 23:
358                 {
359                 alt5=6;
360                 }
361                 break;
362             case 24:
363                 {
364                 alt5=7;
365                 }
366                 break;
367             case 25:
368                 {
369                 alt5=8;
370                 }
371                 break;
372             default:
373                 NoViableAltException nvae =
374                     new NoViableAltException("", 5, 0, input);
375
376                 throw nvae;
377             }
378
379             switch (alt5) {
380                 case 1 :
381                     // c:\\Users\\leo\\work\\eclipse\\workspace\\xerial\\xerial-core\\src\\main\\java\\org\\xerial\\silk\\impl\\InLineJSON.g:104:4: jsonObject
382                     {
383                     pushFollow(FOLLOW_jsonObject_in_jsonValue444);
384                     jsonObject();
385
386                     state._fsp--;
387
388
389                     }
390                     break;
391                 case 2 :
392                     // c:\\Users\\leo\\work\\eclipse\\workspace\\xerial\\xerial-core\\src\\main\\java\\org\\xerial\\silk\\impl\\InLineJSON.g:105:4: jsonArray
393                     {
394                     pushFollow(FOLLOW_jsonArray_in_jsonValue449);
395                     jsonArray();
396
397                     state._fsp--;
398
399
400                     }
401                     break;
402                 case 3 :
403                     // c:\\Users\\leo\\work\\eclipse\\workspace\\xerial\\xerial-core\\src\\main\\java\\org\\xerial\\silk\\impl\\InLineJSON.g:106:4: String
404                     {
405                     match(input,String,FOLLOW_String_in_jsonValue454); 
406
407                     }
408                     break;
409                 case 4 :
410                     // c:\\Users\\leo\\work\\eclipse\\workspace\\xerial\\xerial-core\\src\\main\\java\\org\\xerial\\silk\\impl\\InLineJSON.g:107:4: Integer
411                     {
412                     match(input,Integer,FOLLOW_Integer_in_jsonValue459); 
413
414                     }
415                     break;
416                 case 5 :
417                     // c:\\Users\\leo\\work\\eclipse\\workspace\\xerial\\xerial-core\\src\\main\\java\\org\\xerial\\silk\\impl\\InLineJSON.g:108:4: Double
418                     {
419                     match(input,Double,FOLLOW_Double_in_jsonValue464); 
420
421                     }
422                     break;
423                 case 6 :
424                     // c:\\Users\\leo\\work\\eclipse\\workspace\\xerial\\xerial-core\\src\\main\\java\\org\\xerial\\silk\\impl\\InLineJSON.g:109:4: 'true'
425                     {
426                     match(input,23,FOLLOW_23_in_jsonValue469); 
427
428                     }
429                     break;
430                 case 7 :
431                     // c:\\Users\\leo\\work\\eclipse\\workspace\\xerial\\xerial-core\\src\\main\\java\\org\\xerial\\silk\\impl\\InLineJSON.g:110:4: 'false'
432                     {
433                     match(input,24,FOLLOW_24_in_jsonValue474); 
434
435                     }
436                     break;
437                 case 8 :
438                     // c:\\Users\\leo\\work\\eclipse\\workspace\\xerial\\xerial-core\\src\\main\\java\\org\\xerial\\silk\\impl\\InLineJSON.g:111:4: 'null'
439                     {
440                     match(input,25,FOLLOW_25_in_jsonValue479); 
441
442                     }
443                     break;
444
445             }
446         }
447         catch (RecognitionException re) {
448             reportError(re);
449             recover(input,re);
450         }
451         finally {
452         }
453         return ;
454     }
455     // $ANTLR end "jsonValue"
456
457     // Delegated rules
458
459
460  
461
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});
489
490 }