|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152 |
- /* A Bison parser, made by GNU Bison 2.4.2. */
-
- /* Skeleton implementation for Bison LALR(1) parsers in C++
-
- Copyright (C) 2002-2010 Free Software Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
- /* As a special exception, you may create a larger work that contains
- part or all of the Bison parser skeleton and distribute that work
- under terms of your choice, so long as that work isn't itself a
- parser generator using the skeleton or a modified version thereof
- as a parser skeleton. Alternatively, if you modify or redistribute
- the parser skeleton itself, you may (at your option) remove this
- special exception, which will cause the skeleton and the resulting
- Bison output files to be licensed under the GNU General Public
- License without this special exception.
-
- This special exception was added by the Free Software Foundation in
- version 2.2 of Bison. */
-
- // Take the name prefix into account.
- #define yylex lollex
-
- /* First part of user declarations. */
-
- /* Line 310 of lalr1.cc */
- #line 1 "scenesetup-parser.y"
-
- //
- // Lol Engine
- //
- // Copyright: (c) 2013 Benjamin "Touky" Huet <huet.benjamin@gmail.com>
- // (c) 2013 Sam Hocevar <sam@hocevar.net>
- // This program is free software; you can redistribute it and/or
- // modify it under the terms of the Do What The Fuck You Want To
- // Public License, Version 2, as published by Sam Hocevar. See
- // http://www.wtfpl.net/ for more details.
- //
-
- #if defined HAVE_CONFIG_H
- # include "config.h"
- #endif
-
- #include "core.h"
- #include "../scenesetup.h"
-
-
-
- /* Line 310 of lalr1.cc */
- #line 63 "generated/scenesetup-parser.cpp"
-
-
- #include "scenesetup-parser.h"
-
- /* User implementation prologue. */
-
- /* Line 316 of lalr1.cc */
- #line 76 "scenesetup-parser.y"
-
- #include "../scenesetup-compiler.h"
-
- #undef yylex
- #define yylex uc.m_lexer->lex
-
- /* HACK: workaround for Bison who insists on using exceptions */
- #define try if (true)
- #define catch(...) if (false)
- #define throw (void)0
-
-
- /* Line 316 of lalr1.cc */
- #line 85 "generated/scenesetup-parser.cpp"
-
- #ifndef YY_
- # if defined YYENABLE_NLS && YYENABLE_NLS
- # if ENABLE_NLS
- # include <libintl.h> /* FIXME: INFRINGES ON USER NAME SPACE */
- # define YY_(msgid) dgettext ("bison-runtime", msgid)
- # endif
- # endif
- # ifndef YY_
- # define YY_(msgid) msgid
- # endif
- #endif
-
- /* Suppress unused-variable warnings by "using" E. */
- #define YYUSE(e) ((void) (e))
-
- /* Enable debugging if requested. */
- #if YYDEBUG
-
- /* A pseudo ostream that takes yydebug_ into account. */
- # define YYCDEBUG if (yydebug_) (*yycdebug_)
-
- # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
- do { \
- if (yydebug_) \
- { \
- *yycdebug_ << Title << ' '; \
- yy_symbol_print_ ((Type), (Value), (Location)); \
- *yycdebug_ << std::endl; \
- } \
- } while (false)
-
- # define YY_REDUCE_PRINT(Rule) \
- do { \
- if (yydebug_) \
- yy_reduce_print_ (Rule); \
- } while (false)
-
- # define YY_STACK_PRINT() \
- do { \
- if (yydebug_) \
- yystack_print_ (); \
- } while (false)
-
- #else /* !YYDEBUG */
-
- # define YYCDEBUG if (false) std::cerr
- # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
- # define YY_REDUCE_PRINT(Rule)
- # define YY_STACK_PRINT()
-
- #endif /* !YYDEBUG */
-
- #define yyerrok (yyerrstatus_ = 0)
- #define yyclearin (yychar = yyempty_)
-
- #define YYACCEPT goto yyacceptlab
- #define YYABORT goto yyabortlab
- #define YYERROR goto yyerrorlab
- #define YYRECOVERING() (!!yyerrstatus_)
-
-
- namespace lol {
-
- /* Line 379 of lalr1.cc */
- #line 151 "generated/scenesetup-parser.cpp"
- #if YYERROR_VERBOSE
-
- /* Return YYSTR after stripping away unnecessary quotes and
- backslashes, so that it's suitable for yyerror. The heuristic is
- that double-quoting is unnecessary unless the string contains an
- apostrophe, a comma, or backslash (other than backslash-backslash).
- YYSTR is taken from yytname. */
- std::string
- SceneSetupParser::yytnamerr_ (const char *yystr)
- {
- if (*yystr == '"')
- {
- std::string yyr = "";
- char const *yyp = yystr;
-
- for (;;)
- switch (*++yyp)
- {
- case '\'':
- case ',':
- goto do_not_strip_quotes;
-
- case '\\':
- if (*++yyp != '\\')
- goto do_not_strip_quotes;
- /* Fall through. */
- default:
- yyr += *yyp;
- break;
-
- case '"':
- return yyr;
- }
- do_not_strip_quotes: ;
- }
-
- return yystr;
- }
-
- #endif
-
- /// Build a parser object.
- SceneSetupParser::SceneSetupParser (class SceneSetupCompiler& uc_yyarg)
- :
- #if YYDEBUG
- yydebug_ (false),
- yycdebug_ (&std::cerr),
- #endif
- uc (uc_yyarg)
- {
- }
-
- SceneSetupParser::~SceneSetupParser ()
- {
- }
-
- #if YYDEBUG
- /*--------------------------------.
- | Print this symbol on YYOUTPUT. |
- `--------------------------------*/
-
- inline void
- SceneSetupParser::yy_symbol_value_print_ (int yytype,
- const semantic_type* yyvaluep, const location_type* yylocationp)
- {
- YYUSE (yylocationp);
- YYUSE (yyvaluep);
- switch (yytype)
- {
- default:
- break;
- }
- }
-
-
- void
- SceneSetupParser::yy_symbol_print_ (int yytype,
- const semantic_type* yyvaluep, const location_type* yylocationp)
- {
- *yycdebug_ << (yytype < yyntokens_ ? "token" : "nterm")
- << ' ' << yytname_[yytype] << " ("
- << *yylocationp << ": ";
- yy_symbol_value_print_ (yytype, yyvaluep, yylocationp);
- *yycdebug_ << ')';
- }
- #endif
-
- void
- SceneSetupParser::yydestruct_ (const char* yymsg,
- int yytype, semantic_type* yyvaluep, location_type* yylocationp)
- {
- YYUSE (yylocationp);
- YYUSE (yymsg);
- YYUSE (yyvaluep);
-
- YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
-
- switch (yytype)
- {
-
- default:
- break;
- }
- }
-
- void
- SceneSetupParser::yypop_ (unsigned int n)
- {
- yystate_stack_.pop (n);
- yysemantic_stack_.pop (n);
- yylocation_stack_.pop (n);
- }
-
- #if YYDEBUG
- std::ostream&
- SceneSetupParser::debug_stream () const
- {
- return *yycdebug_;
- }
-
- void
- SceneSetupParser::set_debug_stream (std::ostream& o)
- {
- yycdebug_ = &o;
- }
-
-
- SceneSetupParser::debug_level_type
- SceneSetupParser::debug_level () const
- {
- return yydebug_;
- }
-
- void
- SceneSetupParser::set_debug_level (debug_level_type l)
- {
- yydebug_ = l;
- }
- #endif
-
- int
- SceneSetupParser::parse ()
- {
- /// Lookahead and lookahead in internal form.
- int yychar = yyempty_;
- int yytoken = 0;
-
- /* State. */
- int yyn;
- int yylen = 0;
- int yystate = 0;
-
- /* Error handling. */
- int yynerrs_ = 0;
- int yyerrstatus_ = 0;
-
- /// Semantic value of the lookahead.
- semantic_type yylval;
- /// Location of the lookahead.
- location_type yylloc;
- /// The locations where the error started and ended.
- location_type yyerror_range[2];
-
- /// $$.
- semantic_type yyval;
- /// @$.
- location_type yyloc;
-
- int yyresult;
-
- YYCDEBUG << "Starting parse" << std::endl;
-
-
- /* Initialize the stacks. The initial state will be pushed in
- yynewstate, since the latter expects the semantical and the
- location values to have been already stored, initialize these
- stacks with a primary value. */
- yystate_stack_ = state_stack_type (0);
- yysemantic_stack_ = semantic_stack_type (0);
- yylocation_stack_ = location_stack_type (0);
- yysemantic_stack_.push (yylval);
- yylocation_stack_.push (yylloc);
-
- /* New state. */
- yynewstate:
- yystate_stack_.push (yystate);
- YYCDEBUG << "Entering state " << yystate << std::endl;
-
- /* Accept? */
- if (yystate == yyfinal_)
- goto yyacceptlab;
-
- goto yybackup;
-
- /* Backup. */
- yybackup:
-
- /* Try to take a decision without lookahead. */
- yyn = yypact_[yystate];
- if (yyn == yypact_ninf_)
- goto yydefault;
-
- /* Read a lookahead token. */
- if (yychar == yyempty_)
- {
- YYCDEBUG << "Reading a token: ";
- yychar = yylex (&yylval, &yylloc);
- }
-
-
- /* Convert token to internal form. */
- if (yychar <= yyeof_)
- {
- yychar = yytoken = yyeof_;
- YYCDEBUG << "Now at end of input." << std::endl;
- }
- else
- {
- yytoken = yytranslate_ (yychar);
- YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
- }
-
- /* If the proper action on seeing token YYTOKEN is to reduce or to
- detect an error, take that action. */
- yyn += yytoken;
- if (yyn < 0 || yylast_ < yyn || yycheck_[yyn] != yytoken)
- goto yydefault;
-
- /* Reduce or error. */
- yyn = yytable_[yyn];
- if (yyn <= 0)
- {
- if (yyn == 0 || yyn == yytable_ninf_)
- goto yyerrlab;
- yyn = -yyn;
- goto yyreduce;
- }
-
- /* Shift the lookahead token. */
- YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
-
- /* Discard the token being shifted. */
- yychar = yyempty_;
-
- yysemantic_stack_.push (yylval);
- yylocation_stack_.push (yylloc);
-
- /* Count tokens shifted since error; after three, turn off error
- status. */
- if (yyerrstatus_)
- --yyerrstatus_;
-
- yystate = yyn;
- goto yynewstate;
-
- /*-----------------------------------------------------------.
- | yydefault -- do the default action for the current state. |
- `-----------------------------------------------------------*/
- yydefault:
- yyn = yydefact_[yystate];
- if (yyn == 0)
- goto yyerrlab;
- goto yyreduce;
-
- /*-----------------------------.
- | yyreduce -- Do a reduction. |
- `-----------------------------*/
- yyreduce:
- yylen = yyr2_[yyn];
- /* If YYLEN is nonzero, implement the default value of the action:
- `$$ = $1'. Otherwise, use the top of the stack.
-
- Otherwise, the following line sets YYVAL to garbage.
- This behavior is undocumented and Bison
- users should not rely upon it. */
- if (yylen)
- yyval = yysemantic_stack_[yylen - 1];
- else
- yyval = yysemantic_stack_[0];
-
- {
- slice<location_type, location_stack_type> slice (yylocation_stack_, yylen);
- YYLLOC_DEFAULT (yyloc, slice, yylen);
- }
- YY_REDUCE_PRINT (yyn);
- switch (yyn)
- {
- case 12:
-
- /* Line 677 of lalr1.cc */
- #line 116 "scenesetup-parser.y"
- { uc.m_sstp.m_lights << new Light(); uc.m_last_cmd = "ADDLIGHT"; }
- break;
-
- case 13:
-
- /* Line 677 of lalr1.cc */
- #line 117 "scenesetup-parser.y"
- { uc.m_sstp.m_lights << new Light(); uc.m_last_cmd = "ADDLIGHT";
- uc.m_sstp.m_lights.Last()->SetPosition(vec4(vec3::zero, (yysemantic_stack_[(2) - (2)].fval))); }
- break;
-
- case 14:
-
- /* Line 677 of lalr1.cc */
- #line 122 "scenesetup-parser.y"
- { if (uc.m_last_cmd == "ADDLIGHT")
- uc.m_sstp.m_lights.Last()->SetPosition(vec4(vec3((yysemantic_stack_[(2) - (2)].vval)[0], (yysemantic_stack_[(2) - (2)].vval)[1], (yysemantic_stack_[(2) - (2)].vval)[2]), uc.m_sstp.m_lights.Last()->GetPosition().w)); }
- break;
-
- case 15:
-
- /* Line 677 of lalr1.cc */
- #line 124 "scenesetup-parser.y"
- { if (uc.m_last_cmd == "ADDLIGHT")
- { /* */ } }
- break;
-
- case 16:
-
- /* Line 677 of lalr1.cc */
- #line 126 "scenesetup-parser.y"
- { if (uc.m_last_cmd == "ADDLIGHT")
- uc.m_sstp.m_lights.Last()->SetColor(vec4((yysemantic_stack_[(2) - (2)].vval)[0], (yysemantic_stack_[(2) - (2)].vval)[1], (yysemantic_stack_[(2) - (2)].vval)[2], (yysemantic_stack_[(2) - (2)].vval)[3])); }
- break;
-
- case 17:
-
- /* Line 677 of lalr1.cc */
- #line 128 "scenesetup-parser.y"
- { uint32_t x = (yysemantic_stack_[(2) - (2)].u32val);
- ivec4 v(x >> 24, (x >> 16) & 0xff, (x >> 8) & 0xff, x & 0xff);
- vec4 vv = vec4(v) * (1.f / 255.f);
- if (uc.m_last_cmd == "ADDLIGHT")
- uc.m_sstp.m_lights.Last()->SetColor(vv); }
- break;
-
- case 18:
-
- /* Line 677 of lalr1.cc */
- #line 136 "scenesetup-parser.y"
- { uc.m_sstp.m_clear_color = vec4((yysemantic_stack_[(2) - (2)].vval)[0], (yysemantic_stack_[(2) - (2)].vval)[1], (yysemantic_stack_[(2) - (2)].vval)[2], (yysemantic_stack_[(2) - (2)].vval)[3]); }
- break;
-
- case 19:
-
- /* Line 677 of lalr1.cc */
- #line 137 "scenesetup-parser.y"
- { uc.m_sstp.m_clear_color = vec4((yysemantic_stack_[(5) - (2)].vval)[0], (yysemantic_stack_[(5) - (2)].vval)[1], (yysemantic_stack_[(5) - (2)].vval)[2], 1.f); }
- break;
-
- case 20:
-
- /* Line 677 of lalr1.cc */
- #line 138 "scenesetup-parser.y"
- { uint32_t x = (yysemantic_stack_[(2) - (2)].u32val); ivec4 v(x >> 24, (x >> 16) & 0xff, (x >> 8) & 0xff, x & 0xff);
- uc.m_sstp.m_clear_color = vec4(v) * (1.f / 255.f); }
- break;
-
- case 21:
-
- /* Line 677 of lalr1.cc */
- #line 140 "scenesetup-parser.y"
- { uc.m_sstp.m_show_gizmo = (yysemantic_stack_[(2) - (2)].bval); }
- break;
-
- case 22:
-
- /* Line 677 of lalr1.cc */
- #line 141 "scenesetup-parser.y"
- { uc.m_sstp.m_show_lights = (yysemantic_stack_[(2) - (2)].bval); }
- break;
-
- case 23:
-
- /* Line 677 of lalr1.cc */
- #line 145 "scenesetup-parser.y"
- { uc.m_sstp.m_custom_cmd.Push((yysemantic_stack_[(3) - (2)].svval), (yysemantic_stack_[(3) - (3)].sval)); }
- break;
-
- case 24:
-
- /* Line 677 of lalr1.cc */
- #line 151 "scenesetup-parser.y"
- { (yyval.fval) = (yysemantic_stack_[(1) - (1)].fval); }
- break;
-
- case 25:
-
- /* Line 677 of lalr1.cc */
- #line 152 "scenesetup-parser.y"
- { (yyval.fval) = -(yysemantic_stack_[(2) - (2)].fval); }
- break;
-
- case 26:
-
- /* Line 677 of lalr1.cc */
- #line 153 "scenesetup-parser.y"
- { (yyval.fval) = (float)(yysemantic_stack_[(1) - (1)].ival); }
- break;
-
- case 27:
-
- /* Line 677 of lalr1.cc */
- #line 154 "scenesetup-parser.y"
- { (yyval.fval) = -(float)(yysemantic_stack_[(2) - (2)].ival); }
- break;
-
- case 28:
-
- /* Line 677 of lalr1.cc */
- #line 158 "scenesetup-parser.y"
- { (yyval.ival) = (yysemantic_stack_[(1) - (1)].ival); }
- break;
-
- case 29:
-
- /* Line 677 of lalr1.cc */
- #line 159 "scenesetup-parser.y"
- { (yyval.ival) = -(yysemantic_stack_[(2) - (2)].ival); }
- break;
-
- case 30:
-
- /* Line 677 of lalr1.cc */
- #line 160 "scenesetup-parser.y"
- { (yyval.ival) = (int)(yysemantic_stack_[(1) - (1)].fval); }
- break;
-
- case 31:
-
- /* Line 677 of lalr1.cc */
- #line 161 "scenesetup-parser.y"
- { (yyval.ival) = -(int)(yysemantic_stack_[(2) - (2)].fval); }
- break;
-
- case 32:
-
- /* Line 677 of lalr1.cc */
- #line 166 "scenesetup-parser.y"
- { (yyval.vval)[0] = (yysemantic_stack_[(3) - (2)].fval); (yyval.vval)[1] = (yysemantic_stack_[(3) - (2)].fval); (yyval.vval)[2] = (yysemantic_stack_[(3) - (2)].fval); }
- break;
-
- case 33:
-
- /* Line 677 of lalr1.cc */
- #line 167 "scenesetup-parser.y"
- { (yyval.vval)[0] = (yysemantic_stack_[(5) - (2)].fval); (yyval.vval)[1] = (yysemantic_stack_[(5) - (3)].fval); (yyval.vval)[2] = (yysemantic_stack_[(5) - (4)].fval); }
- break;
-
- case 34:
-
- /* Line 677 of lalr1.cc */
- #line 176 "scenesetup-parser.y"
- { (yyval.vval)[0] = (yysemantic_stack_[(3) - (2)].fval); (yyval.vval)[1] = (yysemantic_stack_[(3) - (2)].fval); (yyval.vval)[2] = (yysemantic_stack_[(3) - (2)].fval); (yyval.vval)[3] = (yysemantic_stack_[(3) - (2)].fval); }
- break;
-
- case 35:
-
- /* Line 677 of lalr1.cc */
- #line 177 "scenesetup-parser.y"
- { (yyval.vval)[0] = (yysemantic_stack_[(6) - (2)].fval); (yyval.vval)[1] = (yysemantic_stack_[(6) - (3)].fval); (yyval.vval)[2] = (yysemantic_stack_[(6) - (4)].fval); (yyval.vval)[3] = (yysemantic_stack_[(6) - (5)].fval); }
- break;
-
- case 36:
-
- /* Line 677 of lalr1.cc */
- #line 182 "scenesetup-parser.y"
- { (yyval.bval) = (yysemantic_stack_[(1) - (1)].bval); }
- break;
-
- case 37:
-
- /* Line 677 of lalr1.cc */
- #line 183 "scenesetup-parser.y"
- { (yyval.bval) = !!(yysemantic_stack_[(1) - (1)].ival); }
- break;
-
- case 38:
-
- /* Line 677 of lalr1.cc */
- #line 184 "scenesetup-parser.y"
- { (yyval.bval) = !!(yysemantic_stack_[(1) - (1)].fval); }
- break;
-
- case 39:
-
- /* Line 677 of lalr1.cc */
- #line 188 "scenesetup-parser.y"
- { (yyval.svval) = (yysemantic_stack_[(1) - (1)].svval); }
- break;
-
- case 40:
-
- /* Line 677 of lalr1.cc */
- #line 192 "scenesetup-parser.y"
- { String t = (yysemantic_stack_[(1) - (1)].sval);
- t.Replace('"', ' ', true);
- free((yysemantic_stack_[(1) - (1)].sval));
- (yyval.sval) = strdup((const char *)t.C()); }
- break;
-
- case 41:
-
- /* Line 677 of lalr1.cc */
- #line 196 "scenesetup-parser.y"
- { String t = (yysemantic_stack_[(2) - (1)].sval);
- t += (yysemantic_stack_[(2) - (2)].sval);
- t.Replace('"', ' ', true);
- free((yysemantic_stack_[(2) - (1)].sval));
- free((yysemantic_stack_[(2) - (2)].sval));
- (yyval.sval) = strdup((const char *)t.C()); }
- break;
-
-
-
- /* Line 677 of lalr1.cc */
- #line 669 "generated/scenesetup-parser.cpp"
- default:
- break;
- }
- YY_SYMBOL_PRINT ("-> $$ =", yyr1_[yyn], &yyval, &yyloc);
-
- yypop_ (yylen);
- yylen = 0;
- YY_STACK_PRINT ();
-
- yysemantic_stack_.push (yyval);
- yylocation_stack_.push (yyloc);
-
- /* Shift the result of the reduction. */
- yyn = yyr1_[yyn];
- yystate = yypgoto_[yyn - yyntokens_] + yystate_stack_[0];
- if (0 <= yystate && yystate <= yylast_
- && yycheck_[yystate] == yystate_stack_[0])
- yystate = yytable_[yystate];
- else
- yystate = yydefgoto_[yyn - yyntokens_];
- goto yynewstate;
-
- /*------------------------------------.
- | yyerrlab -- here on detecting error |
- `------------------------------------*/
- yyerrlab:
- /* If not already recovering from an error, report this error. */
- if (!yyerrstatus_)
- {
- ++yynerrs_;
- error (yylloc, yysyntax_error_ (yystate, yytoken));
- }
-
- yyerror_range[0] = yylloc;
- if (yyerrstatus_ == 3)
- {
- /* If just tried and failed to reuse lookahead token after an
- error, discard it. */
-
- if (yychar <= yyeof_)
- {
- /* Return failure if at end of input. */
- if (yychar == yyeof_)
- YYABORT;
- }
- else
- {
- yydestruct_ ("Error: discarding", yytoken, &yylval, &yylloc);
- yychar = yyempty_;
- }
- }
-
- /* Else will try to reuse lookahead token after shifting the error
- token. */
- goto yyerrlab1;
-
-
- /*---------------------------------------------------.
- | yyerrorlab -- error raised explicitly by YYERROR. |
- `---------------------------------------------------*/
- yyerrorlab:
-
- /* Pacify compilers like GCC when the user code never invokes
- YYERROR and the label yyerrorlab therefore never appears in user
- code. */
- if (false)
- goto yyerrorlab;
-
- yyerror_range[0] = yylocation_stack_[yylen - 1];
- /* Do not reclaim the symbols of the rule which action triggered
- this YYERROR. */
- yypop_ (yylen);
- yylen = 0;
- yystate = yystate_stack_[0];
- goto yyerrlab1;
-
- /*-------------------------------------------------------------.
- | yyerrlab1 -- common code for both syntax error and YYERROR. |
- `-------------------------------------------------------------*/
- yyerrlab1:
- yyerrstatus_ = 3; /* Each real token shifted decrements this. */
-
- for (;;)
- {
- yyn = yypact_[yystate];
- if (yyn != yypact_ninf_)
- {
- yyn += yyterror_;
- if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == yyterror_)
- {
- yyn = yytable_[yyn];
- if (0 < yyn)
- break;
- }
- }
-
- /* Pop the current state because it cannot handle the error token. */
- if (yystate_stack_.height () == 1)
- YYABORT;
-
- yyerror_range[0] = yylocation_stack_[0];
- yydestruct_ ("Error: popping",
- yystos_[yystate],
- &yysemantic_stack_[0], &yylocation_stack_[0]);
- yypop_ ();
- yystate = yystate_stack_[0];
- YY_STACK_PRINT ();
- }
-
- yyerror_range[1] = yylloc;
- // Using YYLLOC is tempting, but would change the location of
- // the lookahead. YYLOC is available though.
- YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2);
- yysemantic_stack_.push (yylval);
- yylocation_stack_.push (yyloc);
-
- /* Shift the error token. */
- YY_SYMBOL_PRINT ("Shifting", yystos_[yyn],
- &yysemantic_stack_[0], &yylocation_stack_[0]);
-
- yystate = yyn;
- goto yynewstate;
-
- /* Accept. */
- yyacceptlab:
- yyresult = 0;
- goto yyreturn;
-
- /* Abort. */
- yyabortlab:
- yyresult = 1;
- goto yyreturn;
-
- yyreturn:
- if (yychar != yyempty_)
- yydestruct_ ("Cleanup: discarding lookahead", yytoken, &yylval, &yylloc);
-
- /* Do not reclaim the symbols of the rule which action triggered
- this YYABORT or YYACCEPT. */
- yypop_ (yylen);
- while (yystate_stack_.height () != 1)
- {
- yydestruct_ ("Cleanup: popping",
- yystos_[yystate_stack_[0]],
- &yysemantic_stack_[0],
- &yylocation_stack_[0]);
- yypop_ ();
- }
-
- return yyresult;
- }
-
- // Generate an error message.
- std::string
- SceneSetupParser::yysyntax_error_ (int yystate, int tok)
- {
- std::string res;
- YYUSE (yystate);
- #if YYERROR_VERBOSE
- int yyn = yypact_[yystate];
- if (yypact_ninf_ < yyn && yyn <= yylast_)
- {
- /* Start YYX at -YYN if negative to avoid negative indexes in
- YYCHECK. */
- int yyxbegin = yyn < 0 ? -yyn : 0;
-
- /* Stay within bounds of both yycheck and yytname. */
- int yychecklim = yylast_ - yyn + 1;
- int yyxend = yychecklim < yyntokens_ ? yychecklim : yyntokens_;
- int count = 0;
- for (int x = yyxbegin; x < yyxend; ++x)
- if (yycheck_[x + yyn] == x && x != yyterror_)
- ++count;
-
- // FIXME: This method of building the message is not compatible
- // with internationalization. It should work like yacc.c does it.
- // That is, first build a string that looks like this:
- // "syntax error, unexpected %s or %s or %s"
- // Then, invoke YY_ on this string.
- // Finally, use the string as a format to output
- // yytname_[tok], etc.
- // Until this gets fixed, this message appears in English only.
- res = "syntax error, unexpected ";
- res += yytnamerr_ (yytname_[tok]);
- if (count < 5)
- {
- count = 0;
- for (int x = yyxbegin; x < yyxend; ++x)
- if (yycheck_[x + yyn] == x && x != yyterror_)
- {
- res += (!count++) ? ", expecting " : " or ";
- res += yytnamerr_ (yytname_[x]);
- }
- }
- }
- else
- #endif
- res = YY_("syntax error");
- return res;
- }
-
-
- /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
- STATE-NUM. */
- const signed char SceneSetupParser::yypact_ninf_ = -20;
- const signed char
- SceneSetupParser::yypact_[] =
- {
- 38, 4, -18, -18, -7, 14, 16, 16, -10, 15,
- 21, 38, 38, -20, -20, -20, -20, -20, -20, -20,
- 6, -20, 4, -20, -20, -20, 4, -20, -20, -20,
- -20, -20, -20, -20, -20, -20, 7, -20, -20, -20,
- -20, -20, -20, 6, -20, -20, -9, -5, 18, 7,
- -20, -20, -20, -20, 4, -20, 4, -18, -20, 10,
- 4, -20, -20, 17, -20
- };
-
- /* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
- doesn't specify something else to do. Zero means the default is an
- error. */
- const unsigned char
- SceneSetupParser::yydefact_[] =
- {
- 0, 12, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 3, 5, 6, 8, 9, 10, 11, 24, 26,
- 0, 13, 0, 14, 15, 17, 0, 16, 20, 18,
- 38, 37, 36, 21, 22, 39, 0, 1, 2, 4,
- 7, 24, 26, 0, 25, 27, 0, 0, 0, 40,
- 23, 25, 27, 32, 0, 34, 0, 0, 41, 0,
- 0, 19, 33, 0, 35
- };
-
- /* YYPGOTO[NTERM-NUM]. */
- const signed char
- SceneSetupParser::yypgoto_[] =
- {
- -20, -20, 25, -20, -20, 27, -20, -20, -20, -20,
- -20, -19, 8, -3, 35, 43, -20, 3
- };
-
- /* YYDEFGOTO[NTERM-NUM]. */
- const signed char
- SceneSetupParser::yydefgoto_[] =
- {
- -1, 9, 10, 11, 12, 13, 14, 15, 16, 48,
- 17, 21, 45, 23, 27, 33, 36, 50
- };
-
- /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
- positive, shift that token. If negative, reduce the rule which
- number is the opposite. If zero, do what YYDEFACT says. */
- const signed char SceneSetupParser::yytable_ninf_ = -1;
- const unsigned char
- SceneSetupParser::yytable_[] =
- {
- 24, 44, 22, 46, 18, 19, 35, 47, 18, 19,
- 20, 25, 53, 26, 20, 37, 55, 18, 19, 41,
- 42, 38, 49, 20, 51, 43, 57, 54, 56, 30,
- 31, 62, 28, 32, 26, 59, 39, 60, 64, 40,
- 29, 63, 1, 2, 3, 4, 5, 6, 7, 8,
- 34, 52, 58, 0, 61
- };
-
- /* YYCHECK. */
- const signed char
- SceneSetupParser::yycheck_[] =
- {
- 3, 20, 20, 22, 13, 14, 16, 26, 13, 14,
- 19, 18, 21, 20, 19, 0, 21, 13, 14, 13,
- 14, 0, 15, 19, 43, 19, 8, 46, 47, 13,
- 14, 21, 18, 17, 20, 54, 11, 56, 21, 12,
- 5, 60, 4, 5, 6, 7, 8, 9, 10, 11,
- 7, 43, 49, -1, 57
- };
-
- /* STOS_[STATE-NUM] -- The (internal number of the) accessing
- symbol of state STATE-NUM. */
- const unsigned char
- SceneSetupParser::yystos_[] =
- {
- 0, 4, 5, 6, 7, 8, 9, 10, 11, 23,
- 24, 25, 26, 27, 28, 29, 30, 32, 13, 14,
- 19, 33, 20, 35, 35, 18, 20, 36, 18, 36,
- 13, 14, 17, 37, 37, 16, 38, 0, 0, 24,
- 27, 13, 14, 19, 33, 34, 33, 33, 31, 15,
- 39, 33, 34, 21, 33, 21, 33, 8, 39, 33,
- 33, 35, 21, 33, 21
- };
-
- #if YYDEBUG
- /* TOKEN_NUMBER_[YYLEX-NUM] -- Internal symbol number corresponding
- to YYLEX-NUM. */
- const unsigned short int
- SceneSetupParser::yytoken_number_[] =
- {
- 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
- 265, 266, 267, 268, 269, 270, 271, 272, 273, 45,
- 40, 41
- };
- #endif
-
- /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
- const unsigned char
- SceneSetupParser::yyr1_[] =
- {
- 0, 22, 23, 24, 24, 25, 26, 26, 27, 27,
- 27, 27, 28, 28, 29, 29, 29, 29, 31, 30,
- 30, 30, 30, 32, 33, 33, 33, 33, 34, 34,
- 34, 34, 35, 35, 36, 36, 37, 37, 37, 38,
- 39, 39
- };
-
- /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
- const unsigned char
- SceneSetupParser::yyr2_[] =
- {
- 0, 2, 2, 1, 2, 1, 1, 2, 1, 1,
- 1, 1, 1, 2, 2, 2, 2, 2, 0, 5,
- 2, 2, 2, 3, 1, 2, 1, 2, 1, 2,
- 1, 2, 3, 5, 3, 6, 1, 1, 1, 1,
- 1, 2
- };
-
- #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
- /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
- First, the terminals, then, starting at \a yyntokens_, nonterminals. */
- const char*
- const SceneSetupParser::yytname_[] =
- {
- "T_END", "error", "$undefined", "T_COLOR", "T_ADDLIGHT",
- "T_OBJPOSITION", "T_OBJLOOKAT", "T_OBJCOLOR", "T_CLEARCOLOR",
- "T_SHOWGIZMO", "T_SHOWLIGHT", "T_CUSTOMCMD", "T_ERROR", "F_NUMBER",
- "I_NUMBER", "STRING", "STRING_VAR", "BOOLEAN", "COLOR", "'-'", "'('",
- "')'", "$accept", "sstp_description", "sstp_expression_list",
- "sstp_expression", "sstp_command_list", "sstp_command", "light_command",
- "setup_command", "scene_command", "$@1", "custom_command", "fv", "iv",
- "v3", "v4", "bv", "svv", "sv", 0
- };
- #endif
-
- #if YYDEBUG
- /* YYRHS -- A `-1'-separated list of the rules' RHS. */
- const SceneSetupParser::rhs_number_type
- SceneSetupParser::yyrhs_[] =
- {
- 23, 0, -1, 24, 0, -1, 25, -1, 25, 24,
- -1, 26, -1, 27, -1, 26, 27, -1, 28, -1,
- 29, -1, 30, -1, 32, -1, 4, -1, 4, 33,
- -1, 5, 35, -1, 6, 35, -1, 7, 36, -1,
- 7, 18, -1, -1, 8, 36, 31, 8, 35, -1,
- 8, 18, -1, 9, 37, -1, 10, 37, -1, 11,
- 38, 39, -1, 13, -1, 19, 33, -1, 14, -1,
- 19, 34, -1, 14, -1, 19, 34, -1, 13, -1,
- 19, 33, -1, 20, 33, 21, -1, 20, 33, 33,
- 33, 21, -1, 20, 33, 21, -1, 20, 33, 33,
- 33, 33, 21, -1, 17, -1, 14, -1, 13, -1,
- 16, -1, 15, -1, 15, 39, -1
- };
-
- /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
- YYRHS. */
- const unsigned char
- SceneSetupParser::yyprhs_[] =
- {
- 0, 0, 3, 6, 8, 11, 13, 15, 18, 20,
- 22, 24, 26, 28, 31, 34, 37, 40, 43, 44,
- 50, 53, 56, 59, 63, 65, 68, 70, 73, 75,
- 78, 80, 83, 87, 93, 97, 104, 106, 108, 110,
- 112, 114
- };
-
- /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
- const unsigned char
- SceneSetupParser::yyrline_[] =
- {
- 0, 91, 91, 95, 96, 100, 104, 105, 109, 110,
- 111, 112, 116, 117, 122, 124, 126, 128, 136, 136,
- 138, 140, 141, 145, 151, 152, 153, 154, 158, 159,
- 160, 161, 166, 167, 176, 177, 182, 183, 184, 188,
- 192, 196
- };
-
- // Print the state stack on the debug stream.
- void
- SceneSetupParser::yystack_print_ ()
- {
- *yycdebug_ << "Stack now";
- for (state_stack_type::const_iterator i = yystate_stack_.begin ();
- i != yystate_stack_.end (); ++i)
- *yycdebug_ << ' ' << *i;
- *yycdebug_ << std::endl;
- }
-
- // Report on the debug stream that the rule \a yyrule is going to be reduced.
- void
- SceneSetupParser::yy_reduce_print_ (int yyrule)
- {
- unsigned int yylno = yyrline_[yyrule];
- int yynrhs = yyr2_[yyrule];
- /* Print the symbols being reduced, and their result. */
- *yycdebug_ << "Reducing stack by rule " << yyrule - 1
- << " (line " << yylno << "):" << std::endl;
- /* The symbols being reduced. */
- for (int yyi = 0; yyi < yynrhs; yyi++)
- YY_SYMBOL_PRINT (" $" << yyi + 1 << " =",
- yyrhs_[yyprhs_[yyrule] + yyi],
- &(yysemantic_stack_[(yynrhs) - (yyi + 1)]),
- &(yylocation_stack_[(yynrhs) - (yyi + 1)]));
- }
- #endif // YYDEBUG
-
- /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
- SceneSetupParser::token_number_type
- SceneSetupParser::yytranslate_ (int t)
- {
- static
- const token_number_type
- translate_table[] =
- {
- 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 20, 21, 2, 2, 2, 19, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
- 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
- 15, 16, 17, 18
- };
- if ((unsigned int) t <= yyuser_token_number_max_)
- return translate_table[t];
- else
- return yyundef_token_;
- }
-
- const int SceneSetupParser::yyeof_ = 0;
- const int SceneSetupParser::yylast_ = 54;
- const int SceneSetupParser::yynnts_ = 18;
- const int SceneSetupParser::yyempty_ = -2;
- const int SceneSetupParser::yyfinal_ = 37;
- const int SceneSetupParser::yyterror_ = 1;
- const int SceneSetupParser::yyerrcode_ = 256;
- const int SceneSetupParser::yyntokens_ = 22;
-
- const unsigned int SceneSetupParser::yyuser_token_number_max_ = 273;
- const SceneSetupParser::token_number_type SceneSetupParser::yyundef_token_ = 2;
-
-
- } // lol
-
- /* Line 1053 of lalr1.cc */
- #line 1140 "generated/scenesetup-parser.cpp"
-
-
- /* Line 1055 of lalr1.cc */
- #line 204 "scenesetup-parser.y"
-
-
- void lol::SceneSetupParser::error(const SceneSetupParser::location_type& l,
- const std::string& m)
- {
- uc.Error(l, m);
- }
-
-
|