|
|
|
@@ -1,8 +1,8 @@ |
|
|
|
/* A Bison parser, made by GNU Bison 2.7.12-4996. */ |
|
|
|
/* A Bison parser, made by GNU Bison 2.4.2. */ |
|
|
|
|
|
|
|
/* Skeleton implementation for Bison LALR(1) parsers in C++ |
|
|
|
|
|
|
|
Copyright (C) 2002-2013 Free Software Foundation, Inc. |
|
|
|
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 |
|
|
|
@@ -34,7 +34,8 @@ |
|
|
|
#define yylex lollex |
|
|
|
|
|
|
|
/* First part of user declarations. */ |
|
|
|
/* Line 283 of lalr1.cc */ |
|
|
|
|
|
|
|
/* Line 310 of lalr1.cc */ |
|
|
|
#line 1 "gpu/lolfx-parser.y" |
|
|
|
|
|
|
|
// |
|
|
|
@@ -56,14 +57,16 @@ |
|
|
|
#include <string> |
|
|
|
|
|
|
|
|
|
|
|
/* Line 283 of lalr1.cc */ |
|
|
|
#line 61 "generated/lolfx-parser.cpp" |
|
|
|
|
|
|
|
/* Line 310 of lalr1.cc */ |
|
|
|
#line 63 "generated/lolfx-parser.cpp" |
|
|
|
|
|
|
|
|
|
|
|
#include "lolfx-parser.h" |
|
|
|
|
|
|
|
/* User implementation prologue. */ |
|
|
|
/* Line 289 of lalr1.cc */ |
|
|
|
|
|
|
|
/* Line 316 of lalr1.cc */ |
|
|
|
#line 241 "gpu/lolfx-parser.y" |
|
|
|
|
|
|
|
#include "gpu/lolfx-compiler.h" |
|
|
|
@@ -76,17 +79,9 @@ |
|
|
|
#define catch(...) if (false) |
|
|
|
#define throw (void)0 |
|
|
|
|
|
|
|
/* Line 289 of lalr1.cc */ |
|
|
|
#line 81 "generated/lolfx-parser.cpp" |
|
|
|
|
|
|
|
|
|
|
|
# ifndef YY_NULL |
|
|
|
# if defined __cplusplus && 201103L <= __cplusplus |
|
|
|
# define YY_NULL nullptr |
|
|
|
# else |
|
|
|
# define YY_NULL 0 |
|
|
|
# endif |
|
|
|
# endif |
|
|
|
/* Line 316 of lalr1.cc */ |
|
|
|
#line 85 "generated/lolfx-parser.cpp" |
|
|
|
|
|
|
|
#ifndef YY_ |
|
|
|
# if defined YYENABLE_NLS && YYENABLE_NLS |
|
|
|
@@ -100,27 +95,6 @@ |
|
|
|
# endif |
|
|
|
#endif |
|
|
|
|
|
|
|
#define YYRHSLOC(Rhs, K) ((Rhs)[K]) |
|
|
|
/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. |
|
|
|
If N is 0, then set CURRENT to the empty location which ends |
|
|
|
the previous symbol: RHS[0] (always defined). */ |
|
|
|
|
|
|
|
# ifndef YYLLOC_DEFAULT |
|
|
|
# define YYLLOC_DEFAULT(Current, Rhs, N) \ |
|
|
|
do \ |
|
|
|
if (N) \ |
|
|
|
{ \ |
|
|
|
(Current).begin = YYRHSLOC (Rhs, 1).begin; \ |
|
|
|
(Current).end = YYRHSLOC (Rhs, N).end; \ |
|
|
|
} \ |
|
|
|
else \ |
|
|
|
{ \ |
|
|
|
(Current).begin = (Current).end = YYRHSLOC (Rhs, 0).end; \ |
|
|
|
} \ |
|
|
|
while (/*CONSTCOND*/ false) |
|
|
|
# endif |
|
|
|
|
|
|
|
|
|
|
|
/* Suppress unused-variable warnings by "using" E. */ |
|
|
|
#define YYUSE(e) ((void) (e)) |
|
|
|
|
|
|
|
@@ -155,9 +129,9 @@ do { \ |
|
|
|
#else /* !YYDEBUG */ |
|
|
|
|
|
|
|
# define YYCDEBUG if (false) std::cerr |
|
|
|
# define YY_SYMBOL_PRINT(Title, Type, Value, Location) YYUSE(Type) |
|
|
|
# define YY_REDUCE_PRINT(Rule) static_cast<void>(0) |
|
|
|
# define YY_STACK_PRINT() static_cast<void>(0) |
|
|
|
# define YY_SYMBOL_PRINT(Title, Type, Value, Location) |
|
|
|
# define YY_REDUCE_PRINT(Rule) |
|
|
|
# define YY_STACK_PRINT() |
|
|
|
|
|
|
|
#endif /* !YYDEBUG */ |
|
|
|
|
|
|
|
@@ -171,8 +145,10 @@ do { \ |
|
|
|
|
|
|
|
|
|
|
|
namespace lol { |
|
|
|
/* Line 357 of lalr1.cc */ |
|
|
|
#line 176 "generated/lolfx-parser.cpp" |
|
|
|
|
|
|
|
/* Line 379 of lalr1.cc */ |
|
|
|
#line 151 "generated/lolfx-parser.cpp" |
|
|
|
#if YYERROR_VERBOSE |
|
|
|
|
|
|
|
/* Return YYSTR after stripping away unnecessary quotes and |
|
|
|
backslashes, so that it's suitable for yyerror. The heuristic is |
|
|
|
@@ -211,6 +187,7 @@ namespace lol { |
|
|
|
return yystr; |
|
|
|
} |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
/// Build a parser object. |
|
|
|
LolFxParser::LolFxParser (class LolFxCompiler& mc_yyarg) |
|
|
|
@@ -238,10 +215,11 @@ namespace lol { |
|
|
|
{ |
|
|
|
YYUSE (yylocationp); |
|
|
|
YYUSE (yyvaluep); |
|
|
|
std::ostream& yyo = debug_stream (); |
|
|
|
std::ostream& yyoutput = yyo; |
|
|
|
YYUSE (yyoutput); |
|
|
|
YYUSE (yytype); |
|
|
|
switch (yytype) |
|
|
|
{ |
|
|
|
default: |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@@ -265,10 +243,14 @@ namespace lol { |
|
|
|
YYUSE (yymsg); |
|
|
|
YYUSE (yyvaluep); |
|
|
|
|
|
|
|
if (yymsg) |
|
|
|
YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); |
|
|
|
YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); |
|
|
|
|
|
|
|
YYUSE (yytype); |
|
|
|
switch (yytype) |
|
|
|
{ |
|
|
|
|
|
|
|
default: |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void |
|
|
|
@@ -306,18 +288,6 @@ namespace lol { |
|
|
|
} |
|
|
|
#endif |
|
|
|
|
|
|
|
inline bool |
|
|
|
LolFxParser::yy_pact_value_is_default_ (int yyvalue) |
|
|
|
{ |
|
|
|
return yyvalue == yypact_ninf_; |
|
|
|
} |
|
|
|
|
|
|
|
inline bool |
|
|
|
LolFxParser::yy_table_value_is_error_ (int yyvalue) |
|
|
|
{ |
|
|
|
return yyvalue == yytable_ninf_; |
|
|
|
} |
|
|
|
|
|
|
|
int |
|
|
|
LolFxParser::parse () |
|
|
|
{ |
|
|
|
@@ -325,22 +295,21 @@ namespace lol { |
|
|
|
int yychar = yyempty_; |
|
|
|
int yytoken = 0; |
|
|
|
|
|
|
|
// State. |
|
|
|
/* State. */ |
|
|
|
int yyn; |
|
|
|
int yylen = 0; |
|
|
|
int yystate = 0; |
|
|
|
|
|
|
|
// Error handling. |
|
|
|
/* Error handling. */ |
|
|
|
int yynerrs_ = 0; |
|
|
|
int yyerrstatus_ = 0; |
|
|
|
|
|
|
|
/// Semantic value of the lookahead. |
|
|
|
static semantic_type yyval_default; |
|
|
|
semantic_type yylval = yyval_default; |
|
|
|
semantic_type yylval; |
|
|
|
/// Location of the lookahead. |
|
|
|
location_type yylloc; |
|
|
|
/// The locations where the error started and ended. |
|
|
|
location_type yyerror_range[3]; |
|
|
|
location_type yyerror_range[2]; |
|
|
|
|
|
|
|
/// $$. |
|
|
|
semantic_type yyval; |
|
|
|
@@ -349,10 +318,6 @@ namespace lol { |
|
|
|
|
|
|
|
int yyresult; |
|
|
|
|
|
|
|
// FIXME: This shoud be completely indented. It is not yet to |
|
|
|
// avoid gratuitous conflicts when merging into the master branch. |
|
|
|
try |
|
|
|
{ |
|
|
|
YYCDEBUG << "Starting parse" << std::endl; |
|
|
|
|
|
|
|
|
|
|
|
@@ -360,9 +325,9 @@ namespace lol { |
|
|
|
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_.clear (); |
|
|
|
yysemantic_stack_.clear (); |
|
|
|
yylocation_stack_.clear (); |
|
|
|
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); |
|
|
|
|
|
|
|
@@ -382,16 +347,17 @@ namespace lol { |
|
|
|
|
|
|
|
/* Try to take a decision without lookahead. */ |
|
|
|
yyn = yypact_[yystate]; |
|
|
|
if (yy_pact_value_is_default_ (yyn)) |
|
|
|
if (yyn == yypact_ninf_) |
|
|
|
goto yydefault; |
|
|
|
|
|
|
|
/* Read a lookahead token. */ |
|
|
|
if (yychar == yyempty_) |
|
|
|
{ |
|
|
|
YYCDEBUG << "Reading a token: "; |
|
|
|
yychar = yylex (&yylval, &yylloc); |
|
|
|
YYCDEBUG << "Reading a token: "; |
|
|
|
yychar = yylex (&yylval, &yylloc); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* Convert token to internal form. */ |
|
|
|
if (yychar <= yyeof_) |
|
|
|
{ |
|
|
|
@@ -414,8 +380,8 @@ namespace lol { |
|
|
|
yyn = yytable_[yyn]; |
|
|
|
if (yyn <= 0) |
|
|
|
{ |
|
|
|
if (yy_table_value_is_error_ (yyn)) |
|
|
|
goto yyerrlab; |
|
|
|
if (yyn == 0 || yyn == yytable_ninf_) |
|
|
|
goto yyerrlab; |
|
|
|
yyn = -yyn; |
|
|
|
goto yyreduce; |
|
|
|
} |
|
|
|
@@ -462,64 +428,55 @@ namespace lol { |
|
|
|
else |
|
|
|
yyval = yysemantic_stack_[0]; |
|
|
|
|
|
|
|
// Compute the default @$. |
|
|
|
{ |
|
|
|
slice<location_type, location_stack_type> slice (yylocation_stack_, yylen); |
|
|
|
YYLLOC_DEFAULT (yyloc, slice, yylen); |
|
|
|
} |
|
|
|
|
|
|
|
// Perform the reduction. |
|
|
|
YY_REDUCE_PRINT (yyn); |
|
|
|
switch (yyn) |
|
|
|
{ |
|
|
|
case 206: |
|
|
|
/* Line 664 of lalr1.cc */ |
|
|
|
case 206: |
|
|
|
|
|
|
|
/* Line 677 of lalr1.cc */ |
|
|
|
#line 734 "gpu/lolfx-parser.y" |
|
|
|
{ std::cout << "New tech " << std::endl; } |
|
|
|
break; |
|
|
|
|
|
|
|
case 207: |
|
|
|
/* Line 664 of lalr1.cc */ |
|
|
|
|
|
|
|
/* Line 677 of lalr1.cc */ |
|
|
|
#line 742 "gpu/lolfx-parser.y" |
|
|
|
{ std::cout << "New name " << (yysemantic_stack_[(1) - (1)].sval) << std::endl; } |
|
|
|
break; |
|
|
|
|
|
|
|
case 208: |
|
|
|
/* Line 664 of lalr1.cc */ |
|
|
|
|
|
|
|
/* Line 677 of lalr1.cc */ |
|
|
|
#line 743 "gpu/lolfx-parser.y" |
|
|
|
{ std::cout << "New name " << (yysemantic_stack_[(1) - (1)].sval) << std::endl; } |
|
|
|
break; |
|
|
|
|
|
|
|
case 211: |
|
|
|
/* Line 664 of lalr1.cc */ |
|
|
|
|
|
|
|
/* Line 677 of lalr1.cc */ |
|
|
|
#line 756 "gpu/lolfx-parser.y" |
|
|
|
{ std::cout << "New pass " << std::endl; } |
|
|
|
break; |
|
|
|
|
|
|
|
case 230: |
|
|
|
/* Line 664 of lalr1.cc */ |
|
|
|
|
|
|
|
/* Line 677 of lalr1.cc */ |
|
|
|
#line 792 "gpu/lolfx-parser.y" |
|
|
|
{ std::cout << "new shader" << std::endl; } |
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
/* Line 664 of lalr1.cc */ |
|
|
|
#line 508 "generated/lolfx-parser.cpp" |
|
|
|
default: |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
/* User semantic actions sometimes alter yychar, and that requires |
|
|
|
that yytoken be updated with the new translation. We take the |
|
|
|
approach of translating immediately before every use of yytoken. |
|
|
|
One alternative is translating here after every semantic action, |
|
|
|
but that translation would be missed if the semantic action |
|
|
|
invokes YYABORT, YYACCEPT, or YYERROR immediately after altering |
|
|
|
yychar. In the case of YYABORT or YYACCEPT, an incorrect |
|
|
|
destructor might then be invoked immediately. In the case of |
|
|
|
YYERROR, subsequent parser actions might lead to an incorrect |
|
|
|
destructor call or verbose syntax error message before the |
|
|
|
lookahead is translated. */ |
|
|
|
/* Line 677 of lalr1.cc */ |
|
|
|
#line 477 "generated/lolfx-parser.cpp" |
|
|
|
default: |
|
|
|
break; |
|
|
|
} |
|
|
|
YY_SYMBOL_PRINT ("-> $$ =", yyr1_[yyn], &yyval, &yyloc); |
|
|
|
|
|
|
|
yypop_ (yylen); |
|
|
|
@@ -543,35 +500,30 @@ namespace lol { |
|
|
|
| yyerrlab -- here on detecting error | |
|
|
|
`------------------------------------*/ |
|
|
|
yyerrlab: |
|
|
|
/* Make sure we have latest lookahead translation. See comments at |
|
|
|
user semantic actions for why this is necessary. */ |
|
|
|
yytoken = yytranslate_ (yychar); |
|
|
|
|
|
|
|
/* If not already recovering from an error, report this error. */ |
|
|
|
if (!yyerrstatus_) |
|
|
|
{ |
|
|
|
++yynerrs_; |
|
|
|
if (yychar == yyempty_) |
|
|
|
yytoken = yyempty_; |
|
|
|
error (yylloc, yysyntax_error_ (yystate, yytoken)); |
|
|
|
} |
|
|
|
|
|
|
|
yyerror_range[1] = yylloc; |
|
|
|
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_; |
|
|
|
} |
|
|
|
/* 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 |
|
|
|
@@ -590,7 +542,7 @@ namespace lol { |
|
|
|
if (false) |
|
|
|
goto yyerrorlab; |
|
|
|
|
|
|
|
yyerror_range[1] = yylocation_stack_[yylen - 1]; |
|
|
|
yyerror_range[0] = yylocation_stack_[yylen - 1]; |
|
|
|
/* Do not reclaim the symbols of the rule which action triggered |
|
|
|
this YYERROR. */ |
|
|
|
yypop_ (yylen); |
|
|
|
@@ -607,7 +559,7 @@ namespace lol { |
|
|
|
for (;;) |
|
|
|
{ |
|
|
|
yyn = yypact_[yystate]; |
|
|
|
if (!yy_pact_value_is_default_ (yyn)) |
|
|
|
if (yyn != yypact_ninf_) |
|
|
|
{ |
|
|
|
yyn += yyterror_; |
|
|
|
if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == yyterror_) |
|
|
|
@@ -620,9 +572,9 @@ namespace lol { |
|
|
|
|
|
|
|
/* Pop the current state because it cannot handle the error token. */ |
|
|
|
if (yystate_stack_.height () == 1) |
|
|
|
YYABORT; |
|
|
|
YYABORT; |
|
|
|
|
|
|
|
yyerror_range[1] = yylocation_stack_[0]; |
|
|
|
yyerror_range[0] = yylocation_stack_[0]; |
|
|
|
yydestruct_ ("Error: popping", |
|
|
|
yystos_[yystate], |
|
|
|
&yysemantic_stack_[0], &yylocation_stack_[0]); |
|
|
|
@@ -631,10 +583,10 @@ namespace lol { |
|
|
|
YY_STACK_PRINT (); |
|
|
|
} |
|
|
|
|
|
|
|
yyerror_range[2] = yylloc; |
|
|
|
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, 2); |
|
|
|
YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2); |
|
|
|
yysemantic_stack_.push (yylval); |
|
|
|
yylocation_stack_.push (yyloc); |
|
|
|
|
|
|
|
@@ -657,148 +609,70 @@ namespace lol { |
|
|
|
|
|
|
|
yyreturn: |
|
|
|
if (yychar != yyempty_) |
|
|
|
{ |
|
|
|
/* Make sure we have latest lookahead translation. See comments |
|
|
|
at user semantic actions for why this is necessary. */ |
|
|
|
yytoken = yytranslate_ (yychar); |
|
|
|
yydestruct_ ("Cleanup: discarding lookahead", yytoken, &yylval, |
|
|
|
&yylloc); |
|
|
|
} |
|
|
|
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 (1 < yystate_stack_.height ()) |
|
|
|
while (yystate_stack_.height () != 1) |
|
|
|
{ |
|
|
|
yydestruct_ ("Cleanup: popping", |
|
|
|
yystos_[yystate_stack_[0]], |
|
|
|
&yysemantic_stack_[0], |
|
|
|
&yylocation_stack_[0]); |
|
|
|
yypop_ (); |
|
|
|
yydestruct_ ("Cleanup: popping", |
|
|
|
yystos_[yystate_stack_[0]], |
|
|
|
&yysemantic_stack_[0], |
|
|
|
&yylocation_stack_[0]); |
|
|
|
yypop_ (); |
|
|
|
} |
|
|
|
|
|
|
|
return yyresult; |
|
|
|
} |
|
|
|
catch (...) |
|
|
|
{ |
|
|
|
YYCDEBUG << "Exception caught: cleaning lookahead and stack" |
|
|
|
<< std::endl; |
|
|
|
// Do not try to display the values of the reclaimed symbols, |
|
|
|
// as their printer might throw an exception. |
|
|
|
if (yychar != yyempty_) |
|
|
|
{ |
|
|
|
/* Make sure we have latest lookahead translation. See |
|
|
|
comments at user semantic actions for why this is |
|
|
|
necessary. */ |
|
|
|
yytoken = yytranslate_ (yychar); |
|
|
|
yydestruct_ (YY_NULL, yytoken, &yylval, &yylloc); |
|
|
|
} |
|
|
|
|
|
|
|
while (1 < yystate_stack_.height ()) |
|
|
|
{ |
|
|
|
yydestruct_ (YY_NULL, |
|
|
|
yystos_[yystate_stack_[0]], |
|
|
|
&yysemantic_stack_[0], |
|
|
|
&yylocation_stack_[0]); |
|
|
|
yypop_ (); |
|
|
|
} |
|
|
|
throw; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// Generate an error message. |
|
|
|
std::string |
|
|
|
LolFxParser::yysyntax_error_ (int yystate, int yytoken) |
|
|
|
LolFxParser::yysyntax_error_ (int yystate, int tok) |
|
|
|
{ |
|
|
|
std::string yyres; |
|
|
|
// Number of reported tokens (one for the "unexpected", one per |
|
|
|
// "expected"). |
|
|
|
size_t yycount = 0; |
|
|
|
// Its maximum. |
|
|
|
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; |
|
|
|
// Arguments of yyformat. |
|
|
|
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; |
|
|
|
|
|
|
|
/* There are many possibilities here to consider: |
|
|
|
- If this state is a consistent state with a default action, then |
|
|
|
the only way this function was invoked is if the default action |
|
|
|
is an error action. In that case, don't check for expected |
|
|
|
tokens because there are none. |
|
|
|
- The only way there can be no lookahead present (in yytoken) is |
|
|
|
if this state is a consistent state with a default action. |
|
|
|
Thus, detecting the absence of a lookahead is sufficient to |
|
|
|
determine that there is no unexpected or expected token to |
|
|
|
report. In that case, just report a simple "syntax error". |
|
|
|
- Don't assume there isn't a lookahead just because this state is |
|
|
|
a consistent state with a default action. There might have |
|
|
|
been a previous inconsistent state, consistent state with a |
|
|
|
non-default action, or user semantic action that manipulated |
|
|
|
yychar. |
|
|
|
- Of course, the expected token list depends on states to have |
|
|
|
correct lookahead information, and it depends on the parser not |
|
|
|
to perform extra reductions after fetching a lookahead from the |
|
|
|
scanner and before detecting a syntax error. Thus, state |
|
|
|
merging (from LALR or IELR) and default reductions corrupt the |
|
|
|
expected token list. However, the list is correct for |
|
|
|
canonical LR with one exception: it will still contain any |
|
|
|
token that will not be accepted due to an error action in a |
|
|
|
later state. |
|
|
|
*/ |
|
|
|
if (yytoken != yyempty_) |
|
|
|
{ |
|
|
|
yyarg[yycount++] = yytname_[yytoken]; |
|
|
|
int yyn = yypact_[yystate]; |
|
|
|
if (!yy_pact_value_is_default_ (yyn)) |
|
|
|
{ |
|
|
|
/* Start YYX at -YYN if negative to avoid negative indexes in |
|
|
|
YYCHECK. In other words, skip the first -YYN actions for |
|
|
|
this state because they are default actions. */ |
|
|
|
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_; |
|
|
|
for (int yyx = yyxbegin; yyx < yyxend; ++yyx) |
|
|
|
if (yycheck_[yyx + yyn] == yyx && yyx != yyterror_ |
|
|
|
&& !yy_table_value_is_error_ (yytable_[yyx + yyn])) |
|
|
|
{ |
|
|
|
if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) |
|
|
|
{ |
|
|
|
yycount = 1; |
|
|
|
break; |
|
|
|
} |
|
|
|
else |
|
|
|
yyarg[yycount++] = yytname_[yyx]; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
char const* yyformat = YY_NULL; |
|
|
|
switch (yycount) |
|
|
|
std::string res; |
|
|
|
YYUSE (yystate); |
|
|
|
#if YYERROR_VERBOSE |
|
|
|
int yyn = yypact_[yystate]; |
|
|
|
if (yypact_ninf_ < yyn && yyn <= yylast_) |
|
|
|
{ |
|
|
|
#define YYCASE_(N, S) \ |
|
|
|
case N: \ |
|
|
|
yyformat = S; \ |
|
|
|
break |
|
|
|
YYCASE_(0, YY_("syntax error")); |
|
|
|
YYCASE_(1, YY_("syntax error, unexpected %s")); |
|
|
|
YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); |
|
|
|
YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); |
|
|
|
YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); |
|
|
|
YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); |
|
|
|
#undef YYCASE_ |
|
|
|
/* 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]); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// Argument number. |
|
|
|
size_t yyi = 0; |
|
|
|
for (char const* yyp = yyformat; *yyp; ++yyp) |
|
|
|
if (yyp[0] == '%' && yyp[1] == 's' && yyi < yycount) |
|
|
|
{ |
|
|
|
yyres += yytnamerr_ (yyarg[yyi++]); |
|
|
|
++yyp; |
|
|
|
} |
|
|
|
else |
|
|
|
yyres += *yyp; |
|
|
|
return yyres; |
|
|
|
else |
|
|
|
#endif |
|
|
|
res = YY_("syntax error"); |
|
|
|
return res; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@@ -877,9 +751,9 @@ namespace lol { |
|
|
|
23, -557, -73, -70, -69, -68, -557, -557, -557, -557 |
|
|
|
}; |
|
|
|
|
|
|
|
/* YYDEFACT[S] -- default reduction number in state S. Performed when |
|
|
|
YYTABLE doesn't specify something else to do. Zero means the |
|
|
|
default is an error. */ |
|
|
|
/* 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 short int |
|
|
|
LolFxParser::yydefact_[] = |
|
|
|
{ |
|
|
|
@@ -986,7 +860,7 @@ namespace lol { |
|
|
|
|
|
|
|
/* 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 YYTABLE_NINF_, syntax error. */ |
|
|
|
number is the opposite. If zero, do what YYDEFACT says. */ |
|
|
|
const short int LolFxParser::yytable_ninf_ = -327; |
|
|
|
const short int |
|
|
|
LolFxParser::yytable_[] = |
|
|
|
@@ -3487,7 +3361,7 @@ namespace lol { |
|
|
|
2, 2, 3, 2, 1, 2, 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* |
|
|
|
@@ -3640,8 +3514,9 @@ namespace lol { |
|
|
|
"glsl_iteration_statement", "glsl_for_init_statement", |
|
|
|
"glsl_conditionopt", "glsl_for_rest_statement", "glsl_jump_statement", |
|
|
|
"glsl_translation_unit", "glsl_external_declaration", |
|
|
|
"glsl_function_definition", YY_NULL |
|
|
|
"glsl_function_definition", 0 |
|
|
|
}; |
|
|
|
#endif |
|
|
|
|
|
|
|
#if YYDEBUG |
|
|
|
/* YYRHS -- A `-1'-separated list of the rules' RHS. */ |
|
|
|
@@ -4017,9 +3892,12 @@ namespace lol { |
|
|
|
|
|
|
|
|
|
|
|
} // lol |
|
|
|
/* Line 1135 of lalr1.cc */ |
|
|
|
#line 4022 "generated/lolfx-parser.cpp" |
|
|
|
/* Line 1136 of lalr1.cc */ |
|
|
|
|
|
|
|
/* Line 1053 of lalr1.cc */ |
|
|
|
#line 3898 "generated/lolfx-parser.cpp" |
|
|
|
|
|
|
|
|
|
|
|
/* Line 1055 of lalr1.cc */ |
|
|
|
#line 1304 "gpu/lolfx-parser.y" |
|
|
|
|
|
|
|
|
|
|
|
@@ -4029,3 +3907,4 @@ void lol::LolFxParser::error(const LolFxParser::location_type& l, |
|
|
|
mc.Error(l, m); |
|
|
|
} |
|
|
|
|
|
|
|
|