Ignore:
Timestamp:
Feb 26, 2013, 2:43:45 PM (7 years ago)
Author:
sam
Message:

base: start removing occurrences of NULL on our long journey to nullptr.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/generated/lolfx-parser.cpp

    r2410 r2506  
    1 /* A Bison parser, made by GNU Bison 2.4.2.  */
     1/* A Bison parser, made by GNU Bison 2.5.  */
    22
    33/* Skeleton implementation for Bison LALR(1) parsers in C++
    44   
    5       Copyright (C) 2002-2010 Free Software Foundation, Inc.
     5      Copyright (C) 2002-2011 Free Software Foundation, Inc.
    66   
    77   This program is free software: you can redistribute it and/or modify
     
    3636/* First part of user declarations.  */
    3737
    38 /* Line 310 of lalr1.cc  */
     38/* Line 293 of lalr1.cc  */
    3939#line 1 "gpu/lolfx-parser.y"
    4040
     
    5959
    6060
    61 /* Line 310 of lalr1.cc  */
     61/* Line 293 of lalr1.cc  */
    6262#line 63 "generated/lolfx-parser.cpp"
    6363
     
    6767/* User implementation prologue.  */
    6868
    69 /* Line 316 of lalr1.cc  */
     69/* Line 299 of lalr1.cc  */
    7070#line 241 "gpu/lolfx-parser.y"
    7171
     
    7676
    7777
    78 /* Line 316 of lalr1.cc  */
     78/* Line 299 of lalr1.cc  */
    7979#line 80 "generated/lolfx-parser.cpp"
    8080
     
    9191#endif
    9292
     93/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
     94   If N is 0, then set CURRENT to the empty location which ends
     95   the previous symbol: RHS[0] (always defined).  */
     96
     97#define YYRHSLOC(Rhs, K) ((Rhs)[K])
     98#ifndef YYLLOC_DEFAULT
     99# define YYLLOC_DEFAULT(Current, Rhs, N)                               \
     100 do                                                                    \
     101   if (N)                                                              \
     102     {                                                                 \
     103       (Current).begin = YYRHSLOC (Rhs, 1).begin;                      \
     104       (Current).end   = YYRHSLOC (Rhs, N).end;                        \
     105     }                                                                 \
     106   else                                                                \
     107     {                                                                 \
     108       (Current).begin = (Current).end = YYRHSLOC (Rhs, 0).end;        \
     109     }                                                                 \
     110 while (false)
     111#endif
     112
    93113/* Suppress unused-variable warnings by "using" E.  */
    94114#define YYUSE(e) ((void) (e))
     
    142162namespace lol {
    143163
    144 /* Line 379 of lalr1.cc  */
    145 #line 146 "generated/lolfx-parser.cpp"
    146 #if YYERROR_VERBOSE
     164/* Line 382 of lalr1.cc  */
     165#line 166 "generated/lolfx-parser.cpp"
    147166
    148167  /* Return YYSTR after stripping away unnecessary quotes and
     
    183202  }
    184203
    185 #endif
    186204
    187205  /// Build a parser object.
     
    284302#endif
    285303
     304  inline bool
     305  LolFxParser::yy_pact_value_is_default_ (int yyvalue)
     306  {
     307    return yyvalue == yypact_ninf_;
     308  }
     309
     310  inline bool
     311  LolFxParser::yy_table_value_is_error_ (int yyvalue)
     312  {
     313    return yyvalue == yytable_ninf_;
     314  }
     315
    286316  int
    287317  LolFxParser::parse ()
     
    305335    location_type yylloc;
    306336    /// The locations where the error started and ended.
    307     location_type yyerror_range[2];
     337    location_type yyerror_range[3];
    308338
    309339    /// $$.
     
    343373    /* Try to take a decision without lookahead.  */
    344374    yyn = yypact_[yystate];
    345     if (yyn == yypact_ninf_)
     375    if (yy_pact_value_is_default_ (yyn))
    346376      goto yydefault;
    347377
     
    376406    if (yyn <= 0)
    377407      {
    378         if (yyn == 0 || yyn == yytable_ninf_)
    379         goto yyerrlab;
     408        if (yy_table_value_is_error_ (yyn))
     409          goto yyerrlab;
    380410        yyn = -yyn;
    381411        goto yyreduce;
     
    433463          case 202:
    434464
    435 /* Line 677 of lalr1.cc  */
     465/* Line 690 of lalr1.cc  */
    436466#line 728 "gpu/lolfx-parser.y"
    437467    { std::cout << "New tech " << std::endl; }
     
    440470  case 203:
    441471
    442 /* Line 677 of lalr1.cc  */
     472/* Line 690 of lalr1.cc  */
    443473#line 736 "gpu/lolfx-parser.y"
    444474    { std::cout << "New name " << (yysemantic_stack_[(1) - (1)].sval) << std::endl; }
     
    447477  case 204:
    448478
    449 /* Line 677 of lalr1.cc  */
     479/* Line 690 of lalr1.cc  */
    450480#line 737 "gpu/lolfx-parser.y"
    451481    { std::cout << "New name " << (yysemantic_stack_[(1) - (1)].sval) << std::endl; }
     
    454484  case 207:
    455485
    456 /* Line 677 of lalr1.cc  */
     486/* Line 690 of lalr1.cc  */
    457487#line 750 "gpu/lolfx-parser.y"
    458488    { std::cout << "New pass " << std::endl; }
     
    461491  case 226:
    462492
    463 /* Line 677 of lalr1.cc  */
     493/* Line 690 of lalr1.cc  */
    464494#line 786 "gpu/lolfx-parser.y"
    465495    { std::cout << "new shader" << std::endl; }
     
    468498
    469499
    470 /* Line 677 of lalr1.cc  */
    471 #line 472 "generated/lolfx-parser.cpp"
     500/* Line 690 of lalr1.cc  */
     501#line 502 "generated/lolfx-parser.cpp"
    472502        default:
    473503          break;
    474504      }
     505    /* User semantic actions sometimes alter yychar, and that requires
     506       that yytoken be updated with the new translation.  We take the
     507       approach of translating immediately before every use of yytoken.
     508       One alternative is translating here after every semantic action,
     509       but that translation would be missed if the semantic action
     510       invokes YYABORT, YYACCEPT, or YYERROR immediately after altering
     511       yychar.  In the case of YYABORT or YYACCEPT, an incorrect
     512       destructor might then be invoked immediately.  In the case of
     513       YYERROR, subsequent parser actions might lead to an incorrect
     514       destructor call or verbose syntax error message before the
     515       lookahead is translated.  */
    475516    YY_SYMBOL_PRINT ("-> $$ =", yyr1_[yyn], &yyval, &yyloc);
    476517
     
    496537  `------------------------------------*/
    497538  yyerrlab:
     539    /* Make sure we have latest lookahead translation.  See comments at
     540       user semantic actions for why this is necessary.  */
     541    yytoken = yytranslate_ (yychar);
     542
    498543    /* If not already recovering from an error, report this error.  */
    499544    if (!yyerrstatus_)
    500545      {
    501546        ++yynerrs_;
     547        if (yychar == yyempty_)
     548          yytoken = yyempty_;
    502549        error (yylloc, yysyntax_error_ (yystate, yytoken));
    503550      }
    504551
    505     yyerror_range[0] = yylloc;
     552    yyerror_range[1] = yylloc;
    506553    if (yyerrstatus_ == 3)
    507554      {
     
    538585      goto yyerrorlab;
    539586
    540     yyerror_range[0] = yylocation_stack_[yylen - 1];
     587    yyerror_range[1] = yylocation_stack_[yylen - 1];
    541588    /* Do not reclaim the symbols of the rule which action triggered
    542589       this YYERROR.  */
     
    555602      {
    556603        yyn = yypact_[yystate];
    557         if (yyn != yypact_ninf_)
     604        if (!yy_pact_value_is_default_ (yyn))
    558605        {
    559606          yyn += yyterror_;
     
    570617        YYABORT;
    571618
    572         yyerror_range[0] = yylocation_stack_[0];
     619        yyerror_range[1] = yylocation_stack_[0];
    573620        yydestruct_ ("Error: popping",
    574621                     yystos_[yystate],
     
    579626      }
    580627
    581     yyerror_range[1] = yylloc;
     628    yyerror_range[2] = yylloc;
    582629    // Using YYLLOC is tempting, but would change the location of
    583630    // the lookahead.  YYLOC is available though.
    584     YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2);
     631    YYLLOC_DEFAULT (yyloc, yyerror_range, 2);
    585632    yysemantic_stack_.push (yylval);
    586633    yylocation_stack_.push (yyloc);
     
    605652  yyreturn:
    606653    if (yychar != yyempty_)
    607       yydestruct_ ("Cleanup: discarding lookahead", yytoken, &yylval, &yylloc);
     654      {
     655        /* Make sure we have latest lookahead translation.  See comments
     656           at user semantic actions for why this is necessary.  */
     657        yytoken = yytranslate_ (yychar);
     658        yydestruct_ ("Cleanup: discarding lookahead", yytoken, &yylval,
     659                     &yylloc);
     660      }
    608661
    609662    /* Do not reclaim the symbols of the rule which action triggered
     
    624677  // Generate an error message.
    625678  std::string
    626   LolFxParser::yysyntax_error_ (int yystate, int tok)
     679  LolFxParser::yysyntax_error_ (int yystate, int yytoken)
    627680  {
    628     std::string res;
    629     YYUSE (yystate);
    630 #if YYERROR_VERBOSE
    631     int yyn = yypact_[yystate];
    632     if (yypact_ninf_ < yyn && yyn <= yylast_)
     681    std::string yyres;
     682    // Number of reported tokens (one for the "unexpected", one per
     683    // "expected").
     684    size_t yycount = 0;
     685    // Its maximum.
     686    enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
     687    // Arguments of yyformat.
     688    char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
     689
     690    /* There are many possibilities here to consider:
     691       - If this state is a consistent state with a default action, then
     692         the only way this function was invoked is if the default action
     693         is an error action.  In that case, don't check for expected
     694         tokens because there are none.
     695       - The only way there can be no lookahead present (in yytoken) is
     696         if this state is a consistent state with a default action.
     697         Thus, detecting the absence of a lookahead is sufficient to
     698         determine that there is no unexpected or expected token to
     699         report.  In that case, just report a simple "syntax error".
     700       - Don't assume there isn't a lookahead just because this state is
     701         a consistent state with a default action.  There might have
     702         been a previous inconsistent state, consistent state with a
     703         non-default action, or user semantic action that manipulated
     704         yychar.
     705       - Of course, the expected token list depends on states to have
     706         correct lookahead information, and it depends on the parser not
     707         to perform extra reductions after fetching a lookahead from the
     708         scanner and before detecting a syntax error.  Thus, state
     709         merging (from LALR or IELR) and default reductions corrupt the
     710         expected token list.  However, the list is correct for
     711         canonical LR with one exception: it will still contain any
     712         token that will not be accepted due to an error action in a
     713         later state.
     714    */
     715    if (yytoken != yyempty_)
    633716      {
    634         /* Start YYX at -YYN if negative to avoid negative indexes in
    635            YYCHECK.  */
    636         int yyxbegin = yyn < 0 ? -yyn : 0;
    637 
    638         /* Stay within bounds of both yycheck and yytname.  */
    639         int yychecklim = yylast_ - yyn + 1;
    640         int yyxend = yychecklim < yyntokens_ ? yychecklim : yyntokens_;
    641         int count = 0;
    642         for (int x = yyxbegin; x < yyxend; ++x)
    643           if (yycheck_[x + yyn] == x && x != yyterror_)
    644             ++count;
    645 
    646         // FIXME: This method of building the message is not compatible
    647         // with internationalization.  It should work like yacc.c does it.
    648         // That is, first build a string that looks like this:
    649         // "syntax error, unexpected %s or %s or %s"
    650         // Then, invoke YY_ on this string.
    651         // Finally, use the string as a format to output
    652         // yytname_[tok], etc.
    653         // Until this gets fixed, this message appears in English only.
    654         res = "syntax error, unexpected ";
    655         res += yytnamerr_ (yytname_[tok]);
    656         if (count < 5)
    657           {
    658             count = 0;
    659             for (int x = yyxbegin; x < yyxend; ++x)
    660               if (yycheck_[x + yyn] == x && x != yyterror_)
    661                 {
    662                   res += (!count++) ? ", expecting " : " or ";
    663                   res += yytnamerr_ (yytname_[x]);
    664                 }
    665           }
     717        yyarg[yycount++] = yytname_[yytoken];
     718        int yyn = yypact_[yystate];
     719        if (!yy_pact_value_is_default_ (yyn))
     720          {
     721            /* Start YYX at -YYN if negative to avoid negative indexes in
     722               YYCHECK.  In other words, skip the first -YYN actions for
     723               this state because they are default actions.  */
     724            int yyxbegin = yyn < 0 ? -yyn : 0;
     725            /* Stay within bounds of both yycheck and yytname.  */
     726            int yychecklim = yylast_ - yyn + 1;
     727            int yyxend = yychecklim < yyntokens_ ? yychecklim : yyntokens_;
     728            for (int yyx = yyxbegin; yyx < yyxend; ++yyx)
     729              if (yycheck_[yyx + yyn] == yyx && yyx != yyterror_
     730                  && !yy_table_value_is_error_ (yytable_[yyx + yyn]))
     731                {
     732                  if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
     733                    {
     734                      yycount = 1;
     735                      break;
     736                    }
     737                  else
     738                    yyarg[yycount++] = yytname_[yyx];
     739                }
     740          }
    666741      }
    667     else
    668 #endif
    669       res = YY_("syntax error");
    670     return res;
     742
     743    char const* yyformat = 0;
     744    switch (yycount)
     745      {
     746#define YYCASE_(N, S)                         \
     747        case N:                               \
     748          yyformat = S;                       \
     749        break
     750        YYCASE_(0, YY_("syntax error"));
     751        YYCASE_(1, YY_("syntax error, unexpected %s"));
     752        YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
     753        YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
     754        YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
     755        YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
     756#undef YYCASE_
     757      }
     758
     759    // Argument number.
     760    size_t yyi = 0;
     761    for (char const* yyp = yyformat; *yyp; ++yyp)
     762      if (yyp[0] == '%' && yyp[1] == 's' && yyi < yycount)
     763        {
     764          yyres += yytnamerr_ (yyarg[yyi++]);
     765          ++yyp;
     766        }
     767      else
     768        yyres += *yyp;
     769    return yyres;
    671770  }
    672771
     
    747846  };
    748847
    749   /* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
    750      doesn't specify something else to do.  Zero means the default is an
    751      error.  */
     848  /* YYDEFACT[S] -- default reduction number in state S.  Performed when
     849     YYTABLE doesn't specify something else to do.  Zero means the
     850     default is an error.  */
    752851  const unsigned short int
    753852  LolFxParser::yydefact_[] =
     
    856955  /* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
    857956     positive, shift that token.  If negative, reduce the rule which
    858      number is the opposite.  If zero, do what YYDEFACT says.  */
     957     number is the opposite.  If YYTABLE_NINF_, syntax error.  */
    859958  const short int LolFxParser::yytable_ninf_ = -323;
    860959  const short int
     
    37923891} // lol
    37933892
    3794 /* Line 1053 of lalr1.cc  */
    3795 #line 3796 "generated/lolfx-parser.cpp"
    3796 
    3797 
    3798 /* Line 1055 of lalr1.cc  */
     3893/* Line 1136 of lalr1.cc  */
     3894#line 3895 "generated/lolfx-parser.cpp"
     3895
     3896
     3897/* Line 1138 of lalr1.cc  */
    37993898#line 1298 "gpu/lolfx-parser.y"
    38003899
Note: See TracChangeset for help on using the changeset viewer.