00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #include "json_parser.hh"
00037
00038
00039
00040
00041
00042 #line 43 "json_parser.cc"
00043
00044 #ifndef YY_
00045 # if defined YYENABLE_NLS && YYENABLE_NLS
00046 # if ENABLE_NLS
00047 # include <libintl.h>
00048 # define YY_(msgid) dgettext ("bison-runtime", msgid)
00049 # endif
00050 # endif
00051 # ifndef YY_
00052 # define YY_(msgid) msgid
00053 # endif
00054 #endif
00055
00056
00057 #define YYUSE(e) ((void) (e))
00058
00059
00060 # define YYCDEBUG \
00061 for (bool yydebugcond_ = yydebug_; yydebugcond_; yydebugcond_ = false) \
00062 (*yycdebug_)
00063
00064
00065 #if YYDEBUG
00066
00067 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
00068 do { \
00069 if (yydebug_) \
00070 { \
00071 *yycdebug_ << Title << ' '; \
00072 yy_symbol_print_ ((Type), (Value), (Location)); \
00073 *yycdebug_ << std::endl; \
00074 } \
00075 } while (false)
00076
00077 # define YY_REDUCE_PRINT(Rule) \
00078 do { \
00079 if (yydebug_) \
00080 yy_reduce_print_ (Rule); \
00081 } while (false)
00082
00083 # define YY_STACK_PRINT() \
00084 do { \
00085 if (yydebug_) \
00086 yystack_print_ (); \
00087 } while (false)
00088
00089 #else
00090
00091 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
00092 # define YY_REDUCE_PRINT(Rule)
00093 # define YY_STACK_PRINT()
00094
00095 #endif
00096
00097 #define YYACCEPT goto yyacceptlab
00098 #define YYABORT goto yyabortlab
00099 #define YYERROR goto yyerrorlab
00100
00101 namespace yy
00102 {
00103 #if YYERROR_VERBOSE
00104
00105
00106
00107
00108
00109
00110 std::string
00111 json_parser::yytnamerr_ (const char *yystr)
00112 {
00113 if (*yystr == '"')
00114 {
00115 std::string yyr = "";
00116 char const *yyp = yystr;
00117
00118 for (;;)
00119 switch (*++yyp)
00120 {
00121 case '\'':
00122 case ',':
00123 goto do_not_strip_quotes;
00124
00125 case '\\':
00126 if (*++yyp != '\\')
00127 goto do_not_strip_quotes;
00128
00129 default:
00130 yyr += *yyp;
00131 break;
00132
00133 case '"':
00134 return yyr;
00135 }
00136 do_not_strip_quotes: ;
00137 }
00138
00139 return yystr;
00140 }
00141
00142 #endif
00143
00145 json_parser::json_parser (QJson::ParserPrivate* driver_yyarg)
00146 : yydebug_ (false),
00147 yycdebug_ (&std::cerr),
00148 driver (driver_yyarg)
00149 {
00150 }
00151
00152 json_parser::~json_parser ()
00153 {
00154 }
00155
00156 #if YYDEBUG
00157
00158
00159
00160
00161 inline void
00162 json_parser::yy_symbol_value_print_ (int yytype,
00163 const semantic_type* yyvaluep, const location_type* yylocationp)
00164 {
00165 YYUSE (yylocationp);
00166 YYUSE (yyvaluep);
00167 switch (yytype)
00168 {
00169 default:
00170 break;
00171 }
00172 }
00173
00174
00175 void
00176 json_parser::yy_symbol_print_ (int yytype,
00177 const semantic_type* yyvaluep, const location_type* yylocationp)
00178 {
00179 *yycdebug_ << (yytype < yyntokens_ ? "token" : "nterm")
00180 << ' ' << yytname_[yytype] << " ("
00181 << *yylocationp << ": ";
00182 yy_symbol_value_print_ (yytype, yyvaluep, yylocationp);
00183 *yycdebug_ << ')';
00184 }
00185 #endif
00186
00187 void
00188 json_parser::yydestruct_ (const char* yymsg,
00189 int yytype, semantic_type* yyvaluep, location_type* yylocationp)
00190 {
00191 YYUSE (yylocationp);
00192 YYUSE (yymsg);
00193 YYUSE (yyvaluep);
00194
00195 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
00196
00197 switch (yytype)
00198 {
00199
00200 default:
00201 break;
00202 }
00203 }
00204
00205 void
00206 json_parser::yypop_ (unsigned int n)
00207 {
00208 yystate_stack_.pop (n);
00209 yysemantic_stack_.pop (n);
00210 yylocation_stack_.pop (n);
00211 }
00212
00213 std::ostream&
00214 json_parser::debug_stream () const
00215 {
00216 return *yycdebug_;
00217 }
00218
00219 void
00220 json_parser::set_debug_stream (std::ostream& o)
00221 {
00222 yycdebug_ = &o;
00223 }
00224
00225
00226 json_parser::debug_level_type
00227 json_parser::debug_level () const
00228 {
00229 return yydebug_;
00230 }
00231
00232 void
00233 json_parser::set_debug_level (debug_level_type l)
00234 {
00235 yydebug_ = l;
00236 }
00237
00238
00239 int
00240 json_parser::parse ()
00241 {
00243 int yychar = yyempty_;
00244 int yytoken = 0;
00245
00246
00247 int yyn;
00248 int yylen = 0;
00249 int yystate = 0;
00250
00251
00252 int yynerrs_ = 0;
00253 int yyerrstatus_ = 0;
00254
00256 semantic_type yylval;
00258 location_type yylloc;
00260 location yyerror_range[2];
00261
00263 semantic_type yyval;
00265 location_type yyloc;
00266
00267 int yyresult;
00268
00269 YYCDEBUG << "Starting parse" << std::endl;
00270
00271
00272
00273
00274
00275
00276 yystate_stack_ = state_stack_type (0);
00277 yysemantic_stack_ = semantic_stack_type (0);
00278 yylocation_stack_ = location_stack_type (0);
00279 yysemantic_stack_.push (yylval);
00280 yylocation_stack_.push (yylloc);
00281
00282
00283 yynewstate:
00284 yystate_stack_.push (yystate);
00285 YYCDEBUG << "Entering state " << yystate << std::endl;
00286 goto yybackup;
00287
00288
00289 yybackup:
00290
00291
00292 yyn = yypact_[yystate];
00293 if (yyn == yypact_ninf_)
00294 goto yydefault;
00295
00296
00297 if (yychar == yyempty_)
00298 {
00299 YYCDEBUG << "Reading a token: ";
00300 yychar = yylex (&yylval, &yylloc, driver);
00301 }
00302
00303
00304
00305 if (yychar <= yyeof_)
00306 {
00307 yychar = yytoken = yyeof_;
00308 YYCDEBUG << "Now at end of input." << std::endl;
00309 }
00310 else
00311 {
00312 yytoken = yytranslate_ (yychar);
00313 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
00314 }
00315
00316
00317
00318 yyn += yytoken;
00319 if (yyn < 0 || yylast_ < yyn || yycheck_[yyn] != yytoken)
00320 goto yydefault;
00321
00322
00323 yyn = yytable_[yyn];
00324 if (yyn <= 0)
00325 {
00326 if (yyn == 0 || yyn == yytable_ninf_)
00327 goto yyerrlab;
00328 yyn = -yyn;
00329 goto yyreduce;
00330 }
00331
00332
00333 if (yyn == yyfinal_)
00334 goto yyacceptlab;
00335
00336
00337 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
00338
00339
00340 if (yychar != yyeof_)
00341 yychar = yyempty_;
00342
00343 yysemantic_stack_.push (yylval);
00344 yylocation_stack_.push (yylloc);
00345
00346
00347
00348 if (yyerrstatus_)
00349 --yyerrstatus_;
00350
00351 yystate = yyn;
00352 goto yynewstate;
00353
00354
00355
00356
00357 yydefault:
00358 yyn = yydefact_[yystate];
00359 if (yyn == 0)
00360 goto yyerrlab;
00361 goto yyreduce;
00362
00363
00364
00365
00366 yyreduce:
00367 yylen = yyr2_[yyn];
00368
00369
00370
00371
00372
00373
00374 if (yylen)
00375 yyval = yysemantic_stack_[yylen - 1];
00376 else
00377 yyval = yysemantic_stack_[0];
00378
00379 {
00380 slice<location_type, location_stack_type> slice (yylocation_stack_, yylen);
00381 YYLLOC_DEFAULT (yyloc, slice, yylen);
00382 }
00383 YY_REDUCE_PRINT (yyn);
00384 switch (yyn)
00385 {
00386 case 2:
00387 #line 80 "json_parser.yy"
00388 {
00389 driver->m_result = (yysemantic_stack_[(1) - (1)]);
00390 qjsonDebug() << "json_parser - parsing finished";
00391 ;}
00392 break;
00393
00394 case 3:
00395 #line 85 "json_parser.yy"
00396 {(yyval) = (yysemantic_stack_[(1) - (1)]); ;}
00397 break;
00398
00399 case 4:
00400 #line 86 "json_parser.yy"
00401 {(yyval) = (yysemantic_stack_[(1) - (1)]); ;}
00402 break;
00403
00404 case 5:
00405 #line 88 "json_parser.yy"
00406 {
00407 qCritical()<< "json_parser - syntax error found, "
00408 << "forcing abort";
00409 YYABORT;
00410 ;}
00411 break;
00412
00413 case 7:
00414 #line 95 "json_parser.yy"
00415 { (yyval) = (yysemantic_stack_[(3) - (2)]); ;}
00416 break;
00417
00418 case 8:
00419 #line 97 "json_parser.yy"
00420 { (yyval) = QVariant (QVariantMap()); ;}
00421 break;
00422
00423 case 9:
00424 #line 98 "json_parser.yy"
00425 {
00426 QVariantMap members = (yysemantic_stack_[(2) - (2)]).toMap();
00427 (yysemantic_stack_[(2) - (2)]) = QVariant();
00428 (yyval) = QVariant(members.unite ((yysemantic_stack_[(2) - (1)]).toMap()));
00429 ;}
00430 break;
00431
00432 case 10:
00433 #line 104 "json_parser.yy"
00434 { (yyval) = QVariant (QVariantMap()); ;}
00435 break;
00436
00437 case 11:
00438 #line 105 "json_parser.yy"
00439 {
00440 QVariantMap members = (yysemantic_stack_[(3) - (3)]).toMap();
00441 (yysemantic_stack_[(3) - (3)]) = QVariant();
00442 (yyval) = QVariant(members.unite ((yysemantic_stack_[(3) - (2)]).toMap()));
00443 ;}
00444 break;
00445
00446 case 12:
00447 #line 111 "json_parser.yy"
00448 {
00449 QVariantMap pair;
00450 pair.insert ((yysemantic_stack_[(3) - (1)]).toString(), QVariant((yysemantic_stack_[(3) - (3)])));
00451 (yyval) = QVariant (pair);
00452 ;}
00453 break;
00454
00455 case 13:
00456 #line 117 "json_parser.yy"
00457 { (yyval) = (yysemantic_stack_[(3) - (2)]); ;}
00458 break;
00459
00460 case 14:
00461 #line 119 "json_parser.yy"
00462 { (yyval) = QVariant (QVariantList()); ;}
00463 break;
00464
00465 case 15:
00466 #line 120 "json_parser.yy"
00467 {
00468 QVariantList members = (yysemantic_stack_[(2) - (2)]).toList();
00469 (yysemantic_stack_[(2) - (2)]) = QVariant();
00470 members.prepend ((yysemantic_stack_[(2) - (1)]));
00471 (yyval) = QVariant(members);
00472 ;}
00473 break;
00474
00475 case 16:
00476 #line 127 "json_parser.yy"
00477 { (yyval) = QVariant (QVariantList()); ;}
00478 break;
00479
00480 case 17:
00481 #line 128 "json_parser.yy"
00482 {
00483 QVariantList members = (yysemantic_stack_[(3) - (3)]).toList();
00484 (yysemantic_stack_[(3) - (3)]) = QVariant();
00485 members.prepend ((yysemantic_stack_[(3) - (2)]));
00486 (yyval) = QVariant(members);
00487 ;}
00488 break;
00489
00490 case 18:
00491 #line 135 "json_parser.yy"
00492 { (yyval) = (yysemantic_stack_[(1) - (1)]); ;}
00493 break;
00494
00495 case 19:
00496 #line 136 "json_parser.yy"
00497 { (yyval) = (yysemantic_stack_[(1) - (1)]); ;}
00498 break;
00499
00500 case 20:
00501 #line 137 "json_parser.yy"
00502 { (yyval) = (yysemantic_stack_[(1) - (1)]); ;}
00503 break;
00504
00505 case 21:
00506 #line 138 "json_parser.yy"
00507 { (yyval) = (yysemantic_stack_[(1) - (1)]); ;}
00508 break;
00509
00510 case 22:
00511 #line 139 "json_parser.yy"
00512 { (yyval) = QVariant (true); ;}
00513 break;
00514
00515 case 23:
00516 #line 140 "json_parser.yy"
00517 { (yyval) = QVariant (false); ;}
00518 break;
00519
00520 case 24:
00521 #line 141 "json_parser.yy"
00522 {
00523 QVariant null_variant;
00524 (yyval) = null_variant;
00525 ;}
00526 break;
00527
00528 case 25:
00529 #line 146 "json_parser.yy"
00530 {
00531 if ((yysemantic_stack_[(1) - (1)]).toByteArray().startsWith('-')) {
00532 (yyval) = QVariant (QVariant::LongLong);
00533 (yyval).setValue((yysemantic_stack_[(1) - (1)]).toLongLong());
00534 }
00535 else {
00536 (yyval) = QVariant (QVariant::ULongLong);
00537 (yyval).setValue((yysemantic_stack_[(1) - (1)]).toULongLong());
00538 }
00539 ;}
00540 break;
00541
00542 case 26:
00543 #line 156 "json_parser.yy"
00544 {
00545 const QByteArray value = (yysemantic_stack_[(2) - (1)]).toByteArray() + (yysemantic_stack_[(2) - (2)]).toByteArray();
00546 (yyval) = QVariant(QVariant::Double);
00547 (yyval).setValue(value.toDouble());
00548 ;}
00549 break;
00550
00551 case 27:
00552 #line 161 "json_parser.yy"
00553 { (yyval) = QVariant ((yysemantic_stack_[(2) - (1)]).toByteArray() + (yysemantic_stack_[(2) - (2)]).toByteArray()); ;}
00554 break;
00555
00556 case 28:
00557 #line 162 "json_parser.yy"
00558 {
00559 const QByteArray value = (yysemantic_stack_[(3) - (1)]).toByteArray() + (yysemantic_stack_[(3) - (2)]).toByteArray() + (yysemantic_stack_[(3) - (3)]).toByteArray();
00560 (yyval) = QVariant (value);
00561 ;}
00562 break;
00563
00564 case 29:
00565 #line 167 "json_parser.yy"
00566 { (yyval) = QVariant ((yysemantic_stack_[(2) - (1)]).toByteArray() + (yysemantic_stack_[(2) - (2)]).toByteArray()); ;}
00567 break;
00568
00569 case 30:
00570 #line 168 "json_parser.yy"
00571 { (yyval) = QVariant (QByteArray("-") + (yysemantic_stack_[(3) - (2)]).toByteArray() + (yysemantic_stack_[(3) - (3)]).toByteArray()); ;}
00572 break;
00573
00574 case 31:
00575 #line 170 "json_parser.yy"
00576 { (yyval) = QVariant (QByteArray("")); ;}
00577 break;
00578
00579 case 32:
00580 #line 171 "json_parser.yy"
00581 {
00582 (yyval) = QVariant((yysemantic_stack_[(2) - (1)]).toByteArray() + (yysemantic_stack_[(2) - (2)]).toByteArray());
00583 ;}
00584 break;
00585
00586 case 33:
00587 #line 175 "json_parser.yy"
00588 {
00589 (yyval) = QVariant(QByteArray(".") + (yysemantic_stack_[(2) - (2)]).toByteArray());
00590 ;}
00591 break;
00592
00593 case 34:
00594 #line 179 "json_parser.yy"
00595 { (yyval) = QVariant((yysemantic_stack_[(2) - (1)]).toByteArray() + (yysemantic_stack_[(2) - (2)]).toByteArray()); ;}
00596 break;
00597
00598 case 35:
00599 #line 181 "json_parser.yy"
00600 { (yyval) = (yysemantic_stack_[(3) - (2)]); ;}
00601 break;
00602
00603 case 36:
00604 #line 183 "json_parser.yy"
00605 { (yyval) = QVariant (QString(QLatin1String(""))); ;}
00606 break;
00607
00608 case 37:
00609 #line 184 "json_parser.yy"
00610 {
00611 (yyval) = (yysemantic_stack_[(1) - (1)]);
00612 ;}
00613 break;
00614
00615
00616
00617 #line 618 "json_parser.cc"
00618 default: break;
00619 }
00620 YY_SYMBOL_PRINT ("-> $$ =", yyr1_[yyn], &yyval, &yyloc);
00621
00622 yypop_ (yylen);
00623 yylen = 0;
00624 YY_STACK_PRINT ();
00625
00626 yysemantic_stack_.push (yyval);
00627 yylocation_stack_.push (yyloc);
00628
00629
00630 yyn = yyr1_[yyn];
00631 yystate = yypgoto_[yyn - yyntokens_] + yystate_stack_[0];
00632 if (0 <= yystate && yystate <= yylast_
00633 && yycheck_[yystate] == yystate_stack_[0])
00634 yystate = yytable_[yystate];
00635 else
00636 yystate = yydefgoto_[yyn - yyntokens_];
00637 goto yynewstate;
00638
00639
00640
00641
00642 yyerrlab:
00643
00644 if (!yyerrstatus_)
00645 {
00646 ++yynerrs_;
00647 error (yylloc, yysyntax_error_ (yystate, yytoken));
00648 }
00649
00650 yyerror_range[0] = yylloc;
00651 if (yyerrstatus_ == 3)
00652 {
00653
00654
00655
00656 if (yychar <= yyeof_)
00657 {
00658
00659 if (yychar == yyeof_)
00660 YYABORT;
00661 }
00662 else
00663 {
00664 yydestruct_ ("Error: discarding", yytoken, &yylval, &yylloc);
00665 yychar = yyempty_;
00666 }
00667 }
00668
00669
00670
00671 goto yyerrlab1;
00672
00673
00674
00675
00676
00677 yyerrorlab:
00678
00679
00680
00681
00682 if (false)
00683 goto yyerrorlab;
00684
00685 yyerror_range[0] = yylocation_stack_[yylen - 1];
00686
00687
00688 yypop_ (yylen);
00689 yylen = 0;
00690 yystate = yystate_stack_[0];
00691 goto yyerrlab1;
00692
00693
00694
00695
00696 yyerrlab1:
00697 yyerrstatus_ = 3;
00698
00699 for (;;)
00700 {
00701 yyn = yypact_[yystate];
00702 if (yyn != yypact_ninf_)
00703 {
00704 yyn += yyterror_;
00705 if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == yyterror_)
00706 {
00707 yyn = yytable_[yyn];
00708 if (0 < yyn)
00709 break;
00710 }
00711 }
00712
00713
00714 if (yystate_stack_.height () == 1)
00715 YYABORT;
00716
00717 yyerror_range[0] = yylocation_stack_[0];
00718 yydestruct_ ("Error: popping",
00719 yystos_[yystate],
00720 &yysemantic_stack_[0], &yylocation_stack_[0]);
00721 yypop_ ();
00722 yystate = yystate_stack_[0];
00723 YY_STACK_PRINT ();
00724 }
00725
00726 if (yyn == yyfinal_)
00727 goto yyacceptlab;
00728
00729 yyerror_range[1] = yylloc;
00730
00731
00732 YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2);
00733 yysemantic_stack_.push (yylval);
00734 yylocation_stack_.push (yyloc);
00735
00736
00737 YY_SYMBOL_PRINT ("Shifting", yystos_[yyn],
00738 &yysemantic_stack_[0], &yylocation_stack_[0]);
00739
00740 yystate = yyn;
00741 goto yynewstate;
00742
00743
00744 yyacceptlab:
00745 yyresult = 0;
00746 goto yyreturn;
00747
00748
00749 yyabortlab:
00750 yyresult = 1;
00751 goto yyreturn;
00752
00753 yyreturn:
00754 if (yychar != yyeof_ && yychar != yyempty_)
00755 yydestruct_ ("Cleanup: discarding lookahead", yytoken, &yylval, &yylloc);
00756
00757
00758
00759 yypop_ (yylen);
00760 while (yystate_stack_.height () != 1)
00761 {
00762 yydestruct_ ("Cleanup: popping",
00763 yystos_[yystate_stack_[0]],
00764 &yysemantic_stack_[0],
00765 &yylocation_stack_[0]);
00766 yypop_ ();
00767 }
00768
00769 return yyresult;
00770 }
00771
00772
00773 std::string
00774 json_parser::yysyntax_error_ (int yystate, int tok)
00775 {
00776 std::string res;
00777 YYUSE (yystate);
00778 #if YYERROR_VERBOSE
00779 int yyn = yypact_[yystate];
00780 if (yypact_ninf_ < yyn && yyn <= yylast_)
00781 {
00782
00783
00784 int yyxbegin = yyn < 0 ? -yyn : 0;
00785
00786
00787 int yychecklim = yylast_ - yyn + 1;
00788 int yyxend = yychecklim < yyntokens_ ? yychecklim : yyntokens_;
00789 int count = 0;
00790 for (int x = yyxbegin; x < yyxend; ++x)
00791 if (yycheck_[x + yyn] == x && x != yyterror_)
00792 ++count;
00793
00794
00795
00796
00797
00798
00799
00800
00801
00802 res = "syntax error, unexpected ";
00803 res += yytnamerr_ (yytname_[tok]);
00804 if (count < 5)
00805 {
00806 count = 0;
00807 for (int x = yyxbegin; x < yyxend; ++x)
00808 if (yycheck_[x + yyn] == x && x != yyterror_)
00809 {
00810 res += (!count++) ? ", expecting " : " or ";
00811 res += yytnamerr_ (yytname_[x]);
00812 }
00813 }
00814 }
00815 else
00816 #endif
00817 res = YY_("syntax error");
00818 return res;
00819 }
00820
00821
00822
00823
00824 const signed char json_parser::yypact_ninf_ = -18;
00825 const signed char
00826 json_parser::yypact_[] =
00827 {
00828 5, -18, -18, 1, -2, 19, -18, -18, -18, 2,
00829 20, 17, 21, 16, 18, -18, -18, -18, -18, -18,
00830 24, 23, -18, -8, -18, -18, -18, 15, -18, 1,
00831 -18, -2, 18, 18, -18, -18, -2, -18, 18, 18,
00832 22, -18, -18, 17, -18, -18, -18, 23, -18, -18,
00833 -18, -18, -18
00834 };
00835
00836
00837
00838
00839 const unsigned char
00840 json_parser::yydefact_[] =
00841 {
00842 0, 6, 5, 8, 14, 0, 2, 3, 4, 36,
00843 0, 10, 0, 0, 31, 22, 23, 24, 20, 21,
00844 0, 16, 19, 25, 18, 1, 37, 0, 7, 0,
00845 9, 0, 31, 31, 29, 13, 0, 15, 31, 31,
00846 26, 27, 35, 10, 12, 30, 32, 16, 33, 34,
00847 28, 11, 17
00848 };
00849
00850
00851 const signed char
00852 json_parser::yypgoto_[] =
00853 {
00854 -18, -18, -18, 33, -18, -7, 6, 37, -18, -9,
00855 -13, -18, -18, -17, -18, -1, -3, -18
00856 };
00857
00858
00859 const signed char
00860 json_parser::yydefgoto_[] =
00861 {
00862 -1, 5, 6, 18, 10, 30, 11, 19, 20, 37,
00863 21, 22, 23, 34, 40, 41, 24, 27
00864 };
00865
00866
00867
00868
00869 const signed char json_parser::yytable_ninf_ = -1;
00870 const unsigned char
00871 json_parser::yytable_[] =
00872 {
00873 12, 3, 38, 4, 39, 1, 2, 13, 3, 14,
00874 4, 15, 16, 17, 9, 45, 46, 9, 44, 25,
00875 26, 48, 49, 47, 28, 29, 12, 32, 31, 33,
00876 35, 36, 42, 7, 39, 43, 51, 8, 52, 50
00877 };
00878
00879
00880 const unsigned char
00881 json_parser::yycheck_[] =
00882 {
00883 3, 3, 10, 5, 12, 0, 1, 9, 3, 11,
00884 5, 13, 14, 15, 16, 32, 33, 16, 31, 0,
00885 18, 38, 39, 36, 4, 8, 29, 11, 7, 11,
00886 6, 8, 17, 0, 12, 29, 43, 0, 47, 40
00887 };
00888
00889
00890
00891 const unsigned char
00892 json_parser::yystos_[] =
00893 {
00894 0, 0, 1, 3, 5, 20, 21, 22, 26, 16,
00895 23, 25, 35, 9, 11, 13, 14, 15, 22, 26,
00896 27, 29, 30, 31, 35, 0, 18, 36, 4, 8,
00897 24, 7, 11, 11, 32, 6, 8, 28, 10, 12,
00898 33, 34, 17, 25, 29, 32, 32, 29, 32, 32,
00899 34, 24, 28
00900 };
00901
00902 #if YYDEBUG
00903
00904
00905 const unsigned short int
00906 json_parser::yytoken_number_[] =
00907 {
00908 0, 256, 257, 1, 2, 3, 4, 5, 6, 7,
00909 8, 9, 10, 11, 12, 13, 14, 15, 16
00910 };
00911 #endif
00912
00913
00914 const unsigned char
00915 json_parser::yyr1_[] =
00916 {
00917 0, 19, 20, 21, 21, 21, 21, 22, 23, 23,
00918 24, 24, 25, 26, 27, 27, 28, 28, 29, 29,
00919 29, 29, 29, 29, 29, 30, 30, 30, 30, 31,
00920 31, 32, 32, 33, 34, 35, 36, 36
00921 };
00922
00923
00924 const unsigned char
00925 json_parser::yyr2_[] =
00926 {
00927 0, 2, 1, 1, 1, 1, 1, 3, 0, 2,
00928 0, 3, 3, 3, 0, 2, 0, 3, 1, 1,
00929 1, 1, 1, 1, 1, 1, 2, 2, 3, 2,
00930 3, 0, 2, 2, 2, 3, 0, 1
00931 };
00932
00933 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
00934
00935
00936 const char*
00937 const json_parser::yytname_[] =
00938 {
00939 "\"end of file\"", "error", "$undefined", "\"{\"", "\"}\"", "\"[\"",
00940 "\"]\"", "\":\"", "\",\"", "\"-\"", "\".\"", "\"digit\"",
00941 "\"exponential\"", "\"true\"", "\"false\"", "\"null\"",
00942 "\"open quotation mark\"", "\"close quotation mark\"", "\"string\"",
00943 "$accept", "start", "data", "object", "members", "r_members", "pair",
00944 "array", "values", "r_values", "value", "number", "int", "digits",
00945 "fract", "exp", "string", "string_arg", 0
00946 };
00947 #endif
00948
00949 #if YYDEBUG
00950
00951 const json_parser::rhs_number_type
00952 json_parser::yyrhs_[] =
00953 {
00954 20, 0, -1, 21, -1, 22, -1, 26, -1, 1,
00955 -1, 0, -1, 3, 23, 4, -1, -1, 25, 24,
00956 -1, -1, 8, 25, 24, -1, 35, 7, 29, -1,
00957 5, 27, 6, -1, -1, 29, 28, -1, -1, 8,
00958 29, 28, -1, 35, -1, 30, -1, 22, -1, 26,
00959 -1, 13, -1, 14, -1, 15, -1, 31, -1, 31,
00960 33, -1, 31, 34, -1, 31, 33, 34, -1, 11,
00961 32, -1, 9, 11, 32, -1, -1, 11, 32, -1,
00962 10, 32, -1, 12, 32, -1, 16, 36, 17, -1,
00963 -1, 18, -1
00964 };
00965
00966
00967
00968 const unsigned char
00969 json_parser::yyprhs_[] =
00970 {
00971 0, 0, 3, 5, 7, 9, 11, 13, 17, 18,
00972 21, 22, 26, 30, 34, 35, 38, 39, 43, 45,
00973 47, 49, 51, 53, 55, 57, 59, 62, 65, 69,
00974 72, 76, 77, 80, 83, 86, 90, 91
00975 };
00976
00977
00978 const unsigned char
00979 json_parser::yyrline_[] =
00980 {
00981 0, 80, 80, 85, 86, 87, 93, 95, 97, 98,
00982 104, 105, 111, 117, 119, 120, 127, 128, 135, 136,
00983 137, 138, 139, 140, 141, 146, 156, 161, 162, 167,
00984 168, 170, 171, 175, 179, 181, 183, 184
00985 };
00986
00987
00988 void
00989 json_parser::yystack_print_ ()
00990 {
00991 *yycdebug_ << "Stack now";
00992 for (state_stack_type::const_iterator i = yystate_stack_.begin ();
00993 i != yystate_stack_.end (); ++i)
00994 *yycdebug_ << ' ' << *i;
00995 *yycdebug_ << std::endl;
00996 }
00997
00998
00999 void
01000 json_parser::yy_reduce_print_ (int yyrule)
01001 {
01002 unsigned int yylno = yyrline_[yyrule];
01003 int yynrhs = yyr2_[yyrule];
01004
01005 *yycdebug_ << "Reducing stack by rule " << yyrule - 1
01006 << " (line " << yylno << "), ";
01007
01008 for (int yyi = 0; yyi < yynrhs; yyi++)
01009 YY_SYMBOL_PRINT (" $" << yyi + 1 << " =",
01010 yyrhs_[yyprhs_[yyrule] + yyi],
01011 &(yysemantic_stack_[(yynrhs) - (yyi + 1)]),
01012 &(yylocation_stack_[(yynrhs) - (yyi + 1)]));
01013 }
01014 #endif // YYDEBUG
01015
01016
01017 json_parser::token_number_type
01018 json_parser::yytranslate_ (int t)
01019 {
01020 static
01021 const token_number_type
01022 translate_table[] =
01023 {
01024 0, 3, 4, 5, 6, 7, 8, 9, 10, 11,
01025 12, 13, 14, 15, 16, 17, 18, 2, 2, 2,
01026 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
01027 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
01028 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
01029 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
01030 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
01031 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
01032 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
01033 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
01034 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
01035 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
01036 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
01037 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
01038 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
01039 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
01040 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
01041 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
01042 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
01043 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
01044 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
01045 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
01046 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
01047 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
01048 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
01049 2, 2, 2, 2, 2, 2, 1, 2
01050 };
01051 if ((unsigned int) t <= yyuser_token_number_max_)
01052 return translate_table[t];
01053 else
01054 return yyundef_token_;
01055 }
01056
01057 const int json_parser::yyeof_ = 0;
01058 const int json_parser::yylast_ = 39;
01059 const int json_parser::yynnts_ = 18;
01060 const int json_parser::yyempty_ = -2;
01061 const int json_parser::yyfinal_ = 25;
01062 const int json_parser::yyterror_ = 1;
01063 const int json_parser::yyerrcode_ = 256;
01064 const int json_parser::yyntokens_ = 19;
01065
01066 const unsigned int json_parser::yyuser_token_number_max_ = 257;
01067 const json_parser::token_number_type json_parser::yyundef_token_ = 2;
01068
01069 }
01070
01071 #line 188 "json_parser.yy"
01072
01073
01074 int yy::yylex(YYSTYPE *yylval, yy::location *yylloc, QJson::ParserPrivate* driver)
01075 {
01076 JSonScanner* scanner = driver->m_scanner;
01077 yylval->clear();
01078 int ret = scanner->yylex(yylval, yylloc);
01079
01080 qjsonDebug() << "json_parser::yylex - calling scanner yylval==|"
01081 << yylval->toByteArray() << "|, ret==|" << QString::number(ret) << "|";
01082
01083 return ret;
01084 }
01085
01086 void yy::json_parser::error (const yy::location& yyloc,
01087 const std::string& error)
01088 {
01089
01090
01091
01092
01093 qjsonDebug() << "json_parser::error [line" << yyloc.end.line << "] -" << error.c_str() ;
01094 driver->setError(QString::fromLatin1(error.c_str()), yyloc.end.line);
01095 }
01096