From d4766d410fd3659cf3c21fbdd5578801eece1387 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Sat, 2 Feb 2013 15:25:31 +0000 Subject: [PATCH] build: fix all vector/scalar type mismatches such as "vec2 * double" instead of "vec2 * float". --- src/easymesh/easymesh-parser.y | 4 +- src/easymesh/easymesh.cpp | 2 +- src/generated/easymesh-parser.cpp | 672 +++++++++++++++++------------ src/generated/easymesh-parser.h | 108 ++--- src/generated/easymesh-scanner.cpp | 232 +++++----- src/generated/location.hh | 4 +- src/generated/lolfx-parser.cpp | 253 +++++++---- src/generated/lolfx-parser.h | 65 +-- src/generated/position.hh | 4 +- src/generated/stack.hh | 8 +- src/lol/math/vector.h | 12 +- 11 files changed, 762 insertions(+), 602 deletions(-) diff --git a/src/easymesh/easymesh-parser.y b/src/easymesh/easymesh-parser.y index e6651ee9..9af1c0fb 100644 --- a/src/easymesh/easymesh-parser.y +++ b/src/easymesh/easymesh-parser.y @@ -109,11 +109,11 @@ color_command: T_COLOR args4 { mc.m_mesh.SetCurColor(vec4($2.f0, $2.f1, $2.f2, $2.f3)); } | T_COLOR COLOR { uint32_t x = $2; vec4 v(x >> 24, (x >> 16) & 0xff, (x >> 8) & 0xff, x & 0xff); - mc.m_mesh.SetCurColor(vec4(v) * (1. / 255)); } + mc.m_mesh.SetCurColor(vec4(v) * (1.f / 255)); } | T_BGCOLOR args4 { mc.m_mesh.SetCurColor2(vec4($2.f0, $2.f1, $2.f2, $2.f3)); } | T_BGCOLOR COLOR { uint32_t x = $2; vec4 v(x >> 24, (x >> 16) & 0xff, (x >> 8) & 0xff, x & 0xff); - mc.m_mesh.SetCurColor2(vec4(v) * (1. / 255)); } + mc.m_mesh.SetCurColor2(vec4(v) * (1.f / 255)); } ; transform_command: diff --git a/src/easymesh/easymesh.cpp b/src/easymesh/easymesh.cpp index cf10c029..ae788560 100644 --- a/src/easymesh/easymesh.cpp +++ b/src/easymesh/easymesh.cpp @@ -880,7 +880,7 @@ void EasyMesh::AppendCapsule(int ndivisions, float h, float r) for (int v = 0, x = 0, y = 0; x < ndivisions + 1; v++) { - vec3 p[] = { a + x * vb + y * vc, + vec3 p[] = { a + (float)x * vb + (float)y * vc, p[0] + vb, p[0] + vc, p[0] + vb + vc }; diff --git a/src/generated/easymesh-parser.cpp b/src/generated/easymesh-parser.cpp index ede49c8a..cd01cd55 100644 --- a/src/generated/easymesh-parser.cpp +++ b/src/generated/easymesh-parser.cpp @@ -1,8 +1,8 @@ -/* A Bison parser, made by GNU Bison 2.4.2. */ +/* A Bison parser, made by GNU Bison 2.5. */ /* Skeleton implementation for Bison LALR(1) parsers in C++ - Copyright (C) 2002-2010 Free Software Foundation, Inc. + Copyright (C) 2002-2011 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 @@ -35,7 +35,7 @@ /* First part of user declarations. */ -/* Line 310 of lalr1.cc */ +/* Line 293 of lalr1.cc */ #line 1 "easymesh/easymesh-parser.y" // @@ -61,7 +61,7 @@ -/* Line 310 of lalr1.cc */ +/* Line 293 of lalr1.cc */ #line 66 "generated/easymesh-parser.cpp" @@ -69,7 +69,7 @@ /* User implementation prologue. */ -/* Line 316 of lalr1.cc */ +/* Line 299 of lalr1.cc */ #line 66 "easymesh/easymesh-parser.y" #include "easymesh/easymesh-compiler.h" @@ -78,7 +78,7 @@ #define yylex mc.m_lexer->lex -/* Line 316 of lalr1.cc */ +/* Line 299 of lalr1.cc */ #line 83 "generated/easymesh-parser.cpp" #ifndef YY_ @@ -93,6 +93,26 @@ # endif #endif +/* 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). */ + +#define YYRHSLOC(Rhs, K) ((Rhs)[K]) +#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 (false) +#endif + /* Suppress unused-variable warnings by "using" E. */ #define YYUSE(e) ((void) (e)) @@ -144,9 +164,8 @@ do { \ namespace lol { -/* Line 379 of lalr1.cc */ -#line 149 "generated/easymesh-parser.cpp" -#if YYERROR_VERBOSE +/* Line 382 of lalr1.cc */ +#line 169 "generated/easymesh-parser.cpp" /* Return YYSTR after stripping away unnecessary quotes and backslashes, so that it's suitable for yyerror. The heuristic is @@ -185,7 +204,6 @@ namespace lol { return yystr; } -#endif /// Build a parser object. EasyMeshParser::EasyMeshParser (class EasyMeshCompiler& mc_yyarg) @@ -286,6 +304,18 @@ namespace lol { } #endif + inline bool + EasyMeshParser::yy_pact_value_is_default_ (int yyvalue) + { + return yyvalue == yypact_ninf_; + } + + inline bool + EasyMeshParser::yy_table_value_is_error_ (int yyvalue) + { + return yyvalue == yytable_ninf_; + } + int EasyMeshParser::parse () { @@ -307,7 +337,7 @@ namespace lol { /// Location of the lookahead. location_type yylloc; /// The locations where the error started and ended. - location_type yyerror_range[2]; + location_type yyerror_range[3]; /// $$. semantic_type yyval; @@ -345,7 +375,7 @@ namespace lol { /* Try to take a decision without lookahead. */ yyn = yypact_[yystate]; - if (yyn == yypact_ninf_) + if (yy_pact_value_is_default_ (yyn)) goto yydefault; /* Read a lookahead token. */ @@ -378,8 +408,8 @@ namespace lol { yyn = yytable_[yyn]; if (yyn <= 0) { - if (yyn == 0 || yyn == yytable_ninf_) - goto yyerrlab; + if (yy_table_value_is_error_ (yyn)) + goto yyerrlab; yyn = -yyn; goto yyreduce; } @@ -435,402 +465,420 @@ namespace lol { { case 7: -/* Line 677 of lalr1.cc */ +/* Line 690 of lalr1.cc */ #line 90 "easymesh/easymesh-parser.y" { mc.m_mesh.OpenBrace(); } break; case 8: -/* Line 677 of lalr1.cc */ +/* Line 690 of lalr1.cc */ #line 94 "easymesh/easymesh-parser.y" { mc.m_mesh.CloseBrace(); } break; case 14: -/* Line 677 of lalr1.cc */ +/* Line 690 of lalr1.cc */ #line 109 "easymesh/easymesh-parser.y" { mc.m_mesh.SetCurColor(vec4((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2, (yysemantic_stack_[(2) - (2)].args).f3)); } break; case 15: -/* Line 677 of lalr1.cc */ +/* Line 690 of lalr1.cc */ #line 110 "easymesh/easymesh-parser.y" { uint32_t x = (yysemantic_stack_[(2) - (2)].u32val); vec4 v(x >> 24, (x >> 16) & 0xff, (x >> 8) & 0xff, x & 0xff); - mc.m_mesh.SetCurColor(vec4(v) * (1. / 255)); } + mc.m_mesh.SetCurColor(vec4(v) * (1.f / 255)); } break; case 16: -/* Line 677 of lalr1.cc */ +/* Line 690 of lalr1.cc */ #line 113 "easymesh/easymesh-parser.y" { mc.m_mesh.SetCurColor2(vec4((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2, (yysemantic_stack_[(2) - (2)].args).f3)); } break; case 17: -/* Line 677 of lalr1.cc */ +/* Line 690 of lalr1.cc */ #line 114 "easymesh/easymesh-parser.y" { uint32_t x = (yysemantic_stack_[(2) - (2)].u32val); vec4 v(x >> 24, (x >> 16) & 0xff, (x >> 8) & 0xff, x & 0xff); - mc.m_mesh.SetCurColor2(vec4(v) * (1. / 255)); } + mc.m_mesh.SetCurColor2(vec4(v) * (1.f / 255)); } break; case 18: -/* Line 677 of lalr1.cc */ +/* Line 690 of lalr1.cc */ #line 120 "easymesh/easymesh-parser.y" { mc.m_mesh.Chamfer((yysemantic_stack_[(2) - (2)].args).f0); } break; case 19: -/* Line 677 of lalr1.cc */ +/* Line 690 of lalr1.cc */ #line 121 "easymesh/easymesh-parser.y" { mc.m_mesh.Translate(vec3((yysemantic_stack_[(2) - (2)].args).f0, 0, 0)); } break; case 20: -/* Line 677 of lalr1.cc */ +/* Line 690 of lalr1.cc */ #line 122 "easymesh/easymesh-parser.y" { mc.m_mesh.Translate(vec3(0, (yysemantic_stack_[(2) - (2)].args).f0, 0)); } break; case 21: -/* Line 677 of lalr1.cc */ +/* Line 690 of lalr1.cc */ #line 123 "easymesh/easymesh-parser.y" { mc.m_mesh.Translate(vec3(0, 0, (yysemantic_stack_[(2) - (2)].args).f0)); } break; case 22: -/* Line 677 of lalr1.cc */ +/* Line 690 of lalr1.cc */ #line 124 "easymesh/easymesh-parser.y" { mc.m_mesh.Translate(vec3((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2)); } break; case 23: -/* Line 677 of lalr1.cc */ +/* Line 690 of lalr1.cc */ #line 125 "easymesh/easymesh-parser.y" { mc.m_mesh.RotateX((yysemantic_stack_[(2) - (2)].args).f0); } break; case 24: -/* Line 677 of lalr1.cc */ +/* Line 690 of lalr1.cc */ #line 126 "easymesh/easymesh-parser.y" { mc.m_mesh.RotateY((yysemantic_stack_[(2) - (2)].args).f0); } break; case 25: -/* Line 677 of lalr1.cc */ +/* Line 690 of lalr1.cc */ #line 127 "easymesh/easymesh-parser.y" { mc.m_mesh.RotateZ((yysemantic_stack_[(2) - (2)].args).f0); } break; case 26: -/* Line 677 of lalr1.cc */ +/* Line 690 of lalr1.cc */ #line 128 "easymesh/easymesh-parser.y" { mc.m_mesh.TaperX((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2); } break; case 27: -/* Line 677 of lalr1.cc */ +/* Line 690 of lalr1.cc */ #line 129 "easymesh/easymesh-parser.y" { mc.m_mesh.TaperY((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2); } break; case 28: -/* Line 677 of lalr1.cc */ +/* Line 690 of lalr1.cc */ #line 130 "easymesh/easymesh-parser.y" { mc.m_mesh.TaperZ((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2); } break; case 29: -/* Line 677 of lalr1.cc */ +/* Line 690 of lalr1.cc */ #line 131 "easymesh/easymesh-parser.y" { mc.m_mesh.Scale(vec3((yysemantic_stack_[(2) - (2)].args).f0, 1.0, 1.0)); } break; case 30: -/* Line 677 of lalr1.cc */ +/* Line 690 of lalr1.cc */ #line 132 "easymesh/easymesh-parser.y" { mc.m_mesh.Scale(vec3(1.0, (yysemantic_stack_[(2) - (2)].args).f0, 1.0)); } break; case 31: -/* Line 677 of lalr1.cc */ +/* Line 690 of lalr1.cc */ #line 133 "easymesh/easymesh-parser.y" { mc.m_mesh.Scale(vec3(1.0, 1.0, (yysemantic_stack_[(2) - (2)].args).f0)); } break; case 32: -/* Line 677 of lalr1.cc */ +/* Line 690 of lalr1.cc */ #line 134 "easymesh/easymesh-parser.y" { mc.m_mesh.Scale(vec3((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2)); } break; case 33: -/* Line 677 of lalr1.cc */ +/* Line 690 of lalr1.cc */ #line 135 "easymesh/easymesh-parser.y" { mc.m_mesh.MirrorX(); } break; case 34: -/* Line 677 of lalr1.cc */ +/* Line 690 of lalr1.cc */ #line 136 "easymesh/easymesh-parser.y" { mc.m_mesh.MirrorY(); } break; case 35: -/* Line 677 of lalr1.cc */ +/* Line 690 of lalr1.cc */ #line 137 "easymesh/easymesh-parser.y" { mc.m_mesh.MirrorZ(); } break; case 36: -/* Line 677 of lalr1.cc */ +/* Line 690 of lalr1.cc */ #line 138 "easymesh/easymesh-parser.y" - { mc.m_mesh.ToggleScaleWinding(); } + { mc.m_mesh.RadialJitter((yysemantic_stack_[(2) - (2)].args).f0); } break; case 37: -/* Line 677 of lalr1.cc */ +/* Line 690 of lalr1.cc */ #line 139 "easymesh/easymesh-parser.y" - { mc.m_mesh.CsgUnion(); } + { mc.m_mesh.ToggleScaleWinding(); } break; case 38: -/* Line 677 of lalr1.cc */ +/* Line 690 of lalr1.cc */ #line 140 "easymesh/easymesh-parser.y" - { mc.m_mesh.CsgSubstract(); } + { mc.m_mesh.CsgUnion(); } break; case 39: -/* Line 677 of lalr1.cc */ +/* Line 690 of lalr1.cc */ #line 141 "easymesh/easymesh-parser.y" - { mc.m_mesh.CsgAnd(); } + { mc.m_mesh.CsgSubstract(); } break; case 40: -/* Line 677 of lalr1.cc */ +/* Line 690 of lalr1.cc */ #line 142 "easymesh/easymesh-parser.y" - { mc.m_mesh.CsgXor(); } + { mc.m_mesh.CsgAnd(); } break; case 41: -/* Line 677 of lalr1.cc */ -#line 146 "easymesh/easymesh-parser.y" +/* Line 690 of lalr1.cc */ +#line 143 "easymesh/easymesh-parser.y" + { mc.m_mesh.CsgXor(); } + break; + + case 42: + +/* Line 690 of lalr1.cc */ +#line 147 "easymesh/easymesh-parser.y" { mc.m_mesh.AppendCylinder((int)(yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2, (yysemantic_stack_[(2) - (2)].args).f3, (int)(yysemantic_stack_[(2) - (2)].args).f4, (int)(yysemantic_stack_[(2) - (2)].args).f5); } break; - case 42: + case 43: -/* Line 677 of lalr1.cc */ -#line 149 "easymesh/easymesh-parser.y" +/* Line 690 of lalr1.cc */ +#line 150 "easymesh/easymesh-parser.y" { mc.m_mesh.AppendBox(vec3((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2)); } break; - case 43: + case 44: -/* Line 677 of lalr1.cc */ -#line 150 "easymesh/easymesh-parser.y" +/* Line 690 of lalr1.cc */ +#line 151 "easymesh/easymesh-parser.y" { mc.m_mesh.AppendSmoothChamfBox(vec3((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2), (yysemantic_stack_[(2) - (2)].args).f3); } break; - case 44: + case 45: -/* Line 677 of lalr1.cc */ -#line 152 "easymesh/easymesh-parser.y" +/* Line 690 of lalr1.cc */ +#line 153 "easymesh/easymesh-parser.y" { mc.m_mesh.AppendFlatChamfBox(vec3((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2), (yysemantic_stack_[(2) - (2)].args).f3); } break; - case 45: + case 46: -/* Line 677 of lalr1.cc */ -#line 154 "easymesh/easymesh-parser.y" +/* Line 690 of lalr1.cc */ +#line 155 "easymesh/easymesh-parser.y" { mc.m_mesh.AppendSphere((yysemantic_stack_[(2) - (2)].args).f0, vec3((yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2, (yysemantic_stack_[(2) - (2)].args).f3)); } break; - case 46: - -/* Line 677 of lalr1.cc */ -#line 156 "easymesh/easymesh-parser.y" - { mc.m_mesh.AppendCapsule((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2); } - break; - case 47: -/* Line 677 of lalr1.cc */ +/* Line 690 of lalr1.cc */ #line 157 "easymesh/easymesh-parser.y" - { mc.m_mesh.AppendTorus((int)(yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2); } + { mc.m_mesh.AppendCapsule((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2); } break; case 48: -/* Line 677 of lalr1.cc */ +/* Line 690 of lalr1.cc */ #line 158 "easymesh/easymesh-parser.y" - { mc.m_mesh.AppendStar((int)(yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2, - (int)(yysemantic_stack_[(2) - (2)].args).f3, (int)(yysemantic_stack_[(2) - (2)].args).f4); } + { mc.m_mesh.AppendTorus((int)(yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2); } break; case 49: -/* Line 677 of lalr1.cc */ -#line 160 "easymesh/easymesh-parser.y" - { mc.m_mesh.AppendExpandedStar((int)(yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, - (yysemantic_stack_[(2) - (2)].args).f2, (yysemantic_stack_[(2) - (2)].args).f3); } +/* Line 690 of lalr1.cc */ +#line 159 "easymesh/easymesh-parser.y" + { mc.m_mesh.AppendStar((int)(yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2, + (int)(yysemantic_stack_[(2) - (2)].args).f3, (int)(yysemantic_stack_[(2) - (2)].args).f4); } break; case 50: -/* Line 677 of lalr1.cc */ -#line 162 "easymesh/easymesh-parser.y" - { mc.m_mesh.AppendDisc((int)(yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (int)(yysemantic_stack_[(2) - (2)].args).f2); } +/* Line 690 of lalr1.cc */ +#line 161 "easymesh/easymesh-parser.y" + { mc.m_mesh.AppendExpandedStar((int)(yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, + (yysemantic_stack_[(2) - (2)].args).f2, (yysemantic_stack_[(2) - (2)].args).f3); } break; case 51: -/* Line 677 of lalr1.cc */ +/* Line 690 of lalr1.cc */ #line 163 "easymesh/easymesh-parser.y" - { mc.m_mesh.AppendSimpleTriangle((yysemantic_stack_[(2) - (2)].args).f0, (int)(yysemantic_stack_[(2) - (2)].args).f1); } + { mc.m_mesh.AppendDisc((int)(yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (int)(yysemantic_stack_[(2) - (2)].args).f2); } break; case 52: -/* Line 677 of lalr1.cc */ +/* Line 690 of lalr1.cc */ #line 164 "easymesh/easymesh-parser.y" - { mc.m_mesh.AppendSimpleQuad((yysemantic_stack_[(2) - (2)].args).f0, (int)(yysemantic_stack_[(2) - (2)].args).f1); } + { mc.m_mesh.AppendSimpleTriangle((yysemantic_stack_[(2) - (2)].args).f0, (int)(yysemantic_stack_[(2) - (2)].args).f1); } break; case 53: -/* Line 677 of lalr1.cc */ +/* Line 690 of lalr1.cc */ #line 165 "easymesh/easymesh-parser.y" - { mc.m_mesh.AppendCog((int)(yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, - (yysemantic_stack_[(2) - (2)].args).f2, (yysemantic_stack_[(2) - (2)].args).f3, (yysemantic_stack_[(2) - (2)].args).f4, (yysemantic_stack_[(2) - (2)].args).f5, (yysemantic_stack_[(2) - (2)].args).f6, - (yysemantic_stack_[(2) - (2)].args).f7, (yysemantic_stack_[(2) - (2)].args).f8, (int)(yysemantic_stack_[(2) - (2)].args).f9); } + { mc.m_mesh.AppendSimpleQuad((yysemantic_stack_[(2) - (2)].args).f0, (int)(yysemantic_stack_[(2) - (2)].args).f1); } break; case 54: -/* Line 677 of lalr1.cc */ -#line 170 "easymesh/easymesh-parser.y" - { (yyval.args).f0 = (yysemantic_stack_[(1) - (1)].fval); } +/* Line 690 of lalr1.cc */ +#line 166 "easymesh/easymesh-parser.y" + { mc.m_mesh.AppendCog((int)(yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, + (yysemantic_stack_[(2) - (2)].args).f2, (yysemantic_stack_[(2) - (2)].args).f3, (yysemantic_stack_[(2) - (2)].args).f4, (yysemantic_stack_[(2) - (2)].args).f5, (yysemantic_stack_[(2) - (2)].args).f6, + (yysemantic_stack_[(2) - (2)].args).f7, (yysemantic_stack_[(2) - (2)].args).f8, (int)(yysemantic_stack_[(2) - (2)].args).f9); } break; case 55: -/* Line 677 of lalr1.cc */ +/* Line 690 of lalr1.cc */ #line 171 "easymesh/easymesh-parser.y" - { (yyval.args) = (yysemantic_stack_[(2) - (1)].args); (yyval.args).f1 = (yysemantic_stack_[(2) - (2)].fval); } + { (yyval.args).f0 = (yysemantic_stack_[(1) - (1)].fval); } break; case 56: -/* Line 677 of lalr1.cc */ +/* Line 690 of lalr1.cc */ #line 172 "easymesh/easymesh-parser.y" - { (yyval.args) = (yysemantic_stack_[(2) - (1)].args); (yyval.args).f2 = (yysemantic_stack_[(2) - (2)].fval); } + { (yyval.args) = (yysemantic_stack_[(2) - (1)].args); (yyval.args).f1 = (yysemantic_stack_[(2) - (2)].fval); } break; case 57: -/* Line 677 of lalr1.cc */ +/* Line 690 of lalr1.cc */ #line 173 "easymesh/easymesh-parser.y" - { (yyval.args) = (yysemantic_stack_[(2) - (1)].args); (yyval.args).f3 = (yysemantic_stack_[(2) - (2)].fval); } + { (yyval.args) = (yysemantic_stack_[(2) - (1)].args); (yyval.args).f2 = (yysemantic_stack_[(2) - (2)].fval); } break; case 58: -/* Line 677 of lalr1.cc */ +/* Line 690 of lalr1.cc */ #line 174 "easymesh/easymesh-parser.y" - { (yyval.args) = (yysemantic_stack_[(2) - (1)].args); (yyval.args).f4 = (yysemantic_stack_[(2) - (2)].fval); } + { (yyval.args) = (yysemantic_stack_[(2) - (1)].args); (yyval.args).f3 = (yysemantic_stack_[(2) - (2)].fval); } break; case 59: -/* Line 677 of lalr1.cc */ +/* Line 690 of lalr1.cc */ #line 175 "easymesh/easymesh-parser.y" - { (yyval.args) = (yysemantic_stack_[(2) - (1)].args); (yyval.args).f5 = (yysemantic_stack_[(2) - (2)].fval); } + { (yyval.args) = (yysemantic_stack_[(2) - (1)].args); (yyval.args).f4 = (yysemantic_stack_[(2) - (2)].fval); } break; case 60: -/* Line 677 of lalr1.cc */ +/* Line 690 of lalr1.cc */ #line 176 "easymesh/easymesh-parser.y" - { (yyval.args) = (yysemantic_stack_[(2) - (1)].args); (yyval.args).f6 = (yysemantic_stack_[(2) - (2)].fval); } + { (yyval.args) = (yysemantic_stack_[(2) - (1)].args); (yyval.args).f5 = (yysemantic_stack_[(2) - (2)].fval); } break; case 61: -/* Line 677 of lalr1.cc */ +/* Line 690 of lalr1.cc */ #line 177 "easymesh/easymesh-parser.y" - { (yyval.args) = (yysemantic_stack_[(2) - (1)].args); (yyval.args).f7 = (yysemantic_stack_[(2) - (2)].fval); } + { (yyval.args) = (yysemantic_stack_[(2) - (1)].args); (yyval.args).f6 = (yysemantic_stack_[(2) - (2)].fval); } break; case 62: -/* Line 677 of lalr1.cc */ +/* Line 690 of lalr1.cc */ #line 178 "easymesh/easymesh-parser.y" - { (yyval.args) = (yysemantic_stack_[(2) - (1)].args); (yyval.args).f8 = (yysemantic_stack_[(2) - (2)].fval); } + { (yyval.args) = (yysemantic_stack_[(2) - (1)].args); (yyval.args).f7 = (yysemantic_stack_[(2) - (2)].fval); } break; case 63: -/* Line 677 of lalr1.cc */ +/* Line 690 of lalr1.cc */ #line 179 "easymesh/easymesh-parser.y" - { (yyval.args) = (yysemantic_stack_[(2) - (1)].args); (yyval.args).f9 = (yysemantic_stack_[(2) - (2)].fval); } + { (yyval.args) = (yysemantic_stack_[(2) - (1)].args); (yyval.args).f8 = (yysemantic_stack_[(2) - (2)].fval); } break; case 64: -/* Line 677 of lalr1.cc */ -#line 182 "easymesh/easymesh-parser.y" - { (yyval.fval) = (yysemantic_stack_[(1) - (1)].fval); } +/* Line 690 of lalr1.cc */ +#line 180 "easymesh/easymesh-parser.y" + { (yyval.args) = (yysemantic_stack_[(2) - (1)].args); (yyval.args).f9 = (yysemantic_stack_[(2) - (2)].fval); } break; case 65: -/* Line 677 of lalr1.cc */ +/* Line 690 of lalr1.cc */ #line 183 "easymesh/easymesh-parser.y" + { (yyval.fval) = (yysemantic_stack_[(1) - (1)].fval); } + break; + + case 66: + +/* Line 690 of lalr1.cc */ +#line 184 "easymesh/easymesh-parser.y" { (yyval.fval) = -(yysemantic_stack_[(2) - (2)].fval); } break; -/* Line 677 of lalr1.cc */ -#line 831 "generated/easymesh-parser.cpp" +/* Line 690 of lalr1.cc */ +#line 868 "generated/easymesh-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. */ YY_SYMBOL_PRINT ("-> $$ =", yyr1_[yyn], &yyval, &yyloc); yypop_ (yylen); @@ -854,14 +902,20 @@ 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[0] = yylloc; + yyerror_range[1] = yylloc; if (yyerrstatus_ == 3) { /* If just tried and failed to reuse lookahead token after an @@ -896,7 +950,7 @@ namespace lol { if (false) goto yyerrorlab; - yyerror_range[0] = yylocation_stack_[yylen - 1]; + yyerror_range[1] = yylocation_stack_[yylen - 1]; /* Do not reclaim the symbols of the rule which action triggered this YYERROR. */ yypop_ (yylen); @@ -913,7 +967,7 @@ namespace lol { for (;;) { yyn = yypact_[yystate]; - if (yyn != yypact_ninf_) + if (!yy_pact_value_is_default_ (yyn)) { yyn += yyterror_; if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == yyterror_) @@ -928,7 +982,7 @@ namespace lol { if (yystate_stack_.height () == 1) YYABORT; - yyerror_range[0] = yylocation_stack_[0]; + yyerror_range[1] = yylocation_stack_[0]; yydestruct_ ("Error: popping", yystos_[yystate], &yysemantic_stack_[0], &yylocation_stack_[0]); @@ -937,10 +991,10 @@ namespace lol { YY_STACK_PRINT (); } - yyerror_range[1] = yylloc; + yyerror_range[2] = yylloc; // Using YYLLOC is tempting, but would change the location of // the lookahead. YYLOC is available though. - YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2); + YYLLOC_DEFAULT (yyloc, yyerror_range, 2); yysemantic_stack_.push (yylval); yylocation_stack_.push (yyloc); @@ -963,7 +1017,13 @@ namespace lol { yyreturn: if (yychar != yyempty_) - yydestruct_ ("Cleanup: discarding lookahead", yytoken, &yylval, &yylloc); + { + /* 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); + } /* Do not reclaim the symbols of the rule which action triggered this YYABORT or YYACCEPT. */ @@ -982,51 +1042,97 @@ namespace lol { // Generate an error message. std::string - EasyMeshParser::yysyntax_error_ (int yystate, int tok) + EasyMeshParser::yysyntax_error_ (int yystate, int yytoken) { - std::string res; - YYUSE (yystate); -#if YYERROR_VERBOSE - int yyn = yypact_[yystate]; - if (yypact_ninf_ < yyn && yyn <= yylast_) + 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_) { - /* 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]); - } - } + 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]; + } + } } - else -#endif - res = YY_("syntax error"); - return res; + + char const* yyformat = 0; + switch (yycount) + { +#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_ + } + + // 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; } @@ -1036,36 +1142,38 @@ namespace lol { const signed char EasyMeshParser::yypact_[] = { - -3, 18, 27, 16, 16, 16, 16, -10, 16, 16, - 16, 16, -10, 16, 16, 16, 16, -10, 16, 16, - -10, -10, -10, -10, -10, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, -10, - 40, 48, -3, -3, 79, -10, -10, -10, -10, -10, - -10, 16, 16, 16, 16, -10, -10, -10, -10, -10, + -3, 19, 28, 26, 26, 26, 26, -10, 26, 26, + 26, 26, -10, 26, 26, 26, 26, -10, 26, 26, + -10, 26, -10, -10, -10, -10, 26, 26, 26, 26, + 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, + -10, 41, 49, -3, -3, 81, -10, -10, -10, -10, + -10, -10, 26, 26, 26, 26, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, - -10, -10, -10, -10, 16, 16, -10, -10, -10, -10, - -10, -10, -10, -10, -10, -10, -10, 16, 16, 16, - 16, -10, -10, -10, -10, -10, 5, -10, -10, -10, - -10, -10, -10, -10, -10, -10, -10, -10, -10, -10 + -10, -10, -10, -10, -10, -10, 26, 26, -10, -10, + -10, -10, -10, -10, -10, -10, -10, -10, -10, 26, + 26, 26, 26, -10, -10, -10, -10, -10, 5, -10, + -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, + -10, -10 }; - /* 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. */ + /* 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. */ const unsigned char EasyMeshParser::yydefact_[] = { 0, 0, 0, 0, 0, 0, 0, 33, 0, 0, 0, 0, 34, 0, 0, 0, 0, 35, 0, 0, - 36, 37, 38, 39, 40, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, - 0, 0, 3, 0, 5, 9, 11, 12, 13, 64, - 15, 0, 0, 0, 0, 14, 54, 17, 16, 19, - 23, 26, 29, 20, 24, 27, 30, 21, 25, 28, - 31, 22, 32, 18, 0, 0, 41, 42, 43, 44, - 45, 46, 48, 49, 50, 51, 52, 0, 0, 0, - 0, 53, 47, 1, 2, 4, 0, 10, 65, 55, - 56, 57, 58, 59, 60, 61, 62, 63, 8, 6 + 37, 0, 38, 39, 40, 41, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 7, 0, 0, 3, 0, 5, 9, 11, 12, 13, + 65, 15, 0, 0, 0, 0, 14, 55, 17, 16, + 19, 23, 26, 29, 20, 24, 27, 30, 21, 25, + 28, 31, 22, 32, 36, 18, 0, 0, 42, 43, + 44, 45, 46, 47, 49, 50, 51, 52, 53, 0, + 0, 0, 0, 54, 48, 1, 2, 4, 0, 10, + 66, 56, 57, 58, 59, 60, 61, 62, 63, 64, + 8, 6 }; /* YYPGOTO[NTERM-NUM]. */ @@ -1073,7 +1181,7 @@ namespace lol { EasyMeshParser::yypgoto_[] = { -10, -10, -4, -10, -10, -10, -10, 9, -10, -10, - -10, 43, 36, 115, 122, 23, 26, -10, -10, -10, + -10, 44, 40, 118, 125, 23, 21, -10, -10, -10, -10, -9 }; @@ -1081,14 +1189,14 @@ namespace lol { const signed char EasyMeshParser::yydefgoto_[] = { - -1, 40, 41, 42, 43, 109, 44, 45, 46, 47, - 48, 52, 53, 54, 74, 75, 76, 88, 89, 90, - 91, 56 + -1, 41, 42, 43, 44, 111, 45, 46, 47, 48, + 49, 53, 54, 55, 76, 77, 78, 90, 91, 92, + 93, 57 }; /* 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. */ + number is the opposite. If YYTABLE_NINF_, syntax error. */ const signed char EasyMeshParser::yytable_ninf_ = -1; const unsigned char EasyMeshParser::yytable_[] = @@ -1096,19 +1204,19 @@ namespace lol { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, - 31, 32, 33, 34, 35, 36, 37, 38, 95, 96, - 93, 39, 98, 99, 100, 101, 59, 60, 94, 62, - 108, 63, 64, 97, 66, 82, 67, 68, 49, 70, - 49, 50, 51, 87, 51, 102, 103, 0, 73, 49, - 57, 85, 86, 51, 0, 0, 0, 0, 104, 105, - 106, 107, 1, 2, 3, 4, 5, 6, 7, 8, - 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, - 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, - 61, 0, 0, 55, 58, 65, 0, 0, 0, 0, - 69, 0, 0, 71, 72, 0, 0, 0, 0, 0, - 0, 0, 77, 0, 0, 0, 81, 0, 0, 84, - 78, 79, 80, 92, 0, 83 + 31, 32, 33, 34, 35, 36, 37, 38, 39, 97, + 98, 95, 40, 100, 101, 102, 103, 60, 61, 96, + 63, 110, 64, 65, 99, 67, 84, 68, 69, 89, + 71, 0, 50, 51, 0, 74, 52, 104, 105, 50, + 75, 50, 58, 52, 0, 52, 87, 88, 0, 0, + 106, 107, 108, 109, 1, 2, 3, 4, 5, 6, + 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, + 37, 38, 39, 62, 0, 0, 56, 59, 66, 0, + 0, 0, 0, 70, 0, 0, 72, 73, 0, 0, + 0, 0, 0, 0, 0, 0, 79, 0, 0, 0, + 83, 0, 0, 86, 80, 81, 82, 94, 0, 85 }; /* YYCHECK. */ @@ -1118,19 +1226,19 @@ namespace lol { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, 35, 36, 37, 38, 39, 40, 42, 43, - 0, 44, 51, 52, 53, 54, 3, 4, 0, 6, - 45, 8, 9, 44, 11, 32, 13, 14, 42, 16, - 42, 43, 46, 37, 46, 74, 75, -1, 25, 42, - 43, 35, 36, 46, -1, -1, -1, -1, 87, 88, - 89, 90, 3, 4, 5, 6, 7, 8, 9, 10, - 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, - 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, - 5, -1, -1, 1, 2, 10, -1, -1, -1, -1, - 15, -1, -1, 18, 19, -1, -1, -1, -1, -1, - -1, -1, 27, -1, -1, -1, 31, -1, -1, 34, - 28, 29, 30, 38, -1, 33 + 33, 34, 35, 36, 37, 38, 39, 40, 41, 43, + 44, 0, 45, 52, 53, 54, 55, 3, 4, 0, + 6, 46, 8, 9, 45, 11, 33, 13, 14, 38, + 16, -1, 43, 44, -1, 21, 47, 76, 77, 43, + 26, 43, 44, 47, -1, 47, 36, 37, -1, -1, + 89, 90, 91, 92, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, + 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, + 39, 40, 41, 5, -1, -1, 1, 2, 10, -1, + -1, -1, -1, 15, -1, -1, 18, 19, -1, -1, + -1, -1, -1, -1, -1, -1, 28, -1, -1, -1, + 32, -1, -1, 35, 29, 30, 31, 39, -1, 34 }; /* STOS_[STATE-NUM] -- The (internal number of the) accessing @@ -1141,14 +1249,15 @@ namespace lol { 0, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, - 32, 33, 34, 35, 36, 37, 38, 39, 40, 44, - 48, 49, 50, 51, 53, 54, 55, 56, 57, 42, - 43, 46, 58, 59, 60, 61, 68, 43, 61, 58, - 58, 60, 58, 58, 58, 60, 58, 58, 58, 60, - 58, 60, 60, 58, 61, 62, 63, 60, 61, 61, - 61, 60, 62, 61, 60, 59, 59, 63, 64, 65, - 66, 67, 60, 0, 0, 49, 49, 54, 68, 68, - 68, 68, 68, 68, 68, 68, 68, 68, 45, 52 + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, + 45, 49, 50, 51, 52, 54, 55, 56, 57, 58, + 43, 44, 47, 59, 60, 61, 62, 69, 44, 62, + 59, 59, 61, 59, 59, 59, 61, 59, 59, 59, + 61, 59, 61, 61, 59, 59, 62, 63, 64, 61, + 62, 62, 62, 61, 63, 62, 61, 60, 60, 64, + 65, 66, 67, 68, 61, 0, 0, 50, 50, 55, + 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, + 46, 53 }; #if YYDEBUG @@ -1161,7 +1270,7 @@ namespace lol { 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, - 295, 296, 297, 298, 91, 93, 45 + 295, 296, 297, 298, 299, 91, 93, 45 }; #endif @@ -1169,13 +1278,13 @@ namespace lol { const unsigned char EasyMeshParser::yyr1_[] = { - 0, 47, 48, 49, 49, 50, 50, 51, 52, 53, - 53, 54, 54, 54, 55, 55, 55, 55, 56, 56, - 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, - 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, - 56, 57, 57, 57, 57, 57, 57, 57, 57, 57, - 57, 57, 57, 57, 58, 59, 60, 61, 62, 63, - 64, 65, 66, 67, 68, 68 + 0, 48, 49, 50, 50, 51, 51, 52, 53, 54, + 54, 55, 55, 55, 56, 56, 56, 56, 57, 57, + 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, + 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, + 57, 57, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 59, 60, 61, 62, 63, + 64, 65, 66, 67, 68, 69, 69 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ @@ -1185,10 +1294,10 @@ namespace lol { 0, 2, 2, 1, 2, 1, 3, 1, 1, 1, 2, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, - 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 1, 2 + 2, 2, 2, 1, 1, 1, 2, 1, 1, 1, + 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 1, 2 }; #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE @@ -1201,11 +1310,11 @@ namespace lol { "T_ROTATEX", "T_TAPERX", "T_SCALEX", "T_MIRRORX", "T_TRANSLATEY", "T_ROTATEY", "T_TAPERY", "T_SCALEY", "T_MIRRORY", "T_TRANSLATEZ", "T_ROTATEZ", "T_TAPERZ", "T_SCALEZ", "T_MIRRORZ", "T_TRANSLATE", - "T_SCALE", "T_TOGGLESCALEWINDING", "T_CSGUNION", "T_CSGSUBSTRACT", - "T_CSGAND", "T_CSGXOR", "T_CHAMFER", "T_CYLINDER", "T_BOX", - "T_SMOOTHCHAMFBOX", "T_FLATCHAMFBOX", "T_SPHERE", "T_CAPSULE", "T_STAR", - "T_EXPANDEDSTAR", "T_DISC", "T_TRIANGLE", "T_QUAD", "T_COG", "T_TORUS", - "T_ERROR", "NUMBER", "COLOR", "'['", "']'", "'-'", "$accept", + "T_SCALE", "T_TOGGLESCALEWINDING", "T_RADIALJITTER", "T_CSGUNION", + "T_CSGSUBSTRACT", "T_CSGAND", "T_CSGXOR", "T_CHAMFER", "T_CYLINDER", + "T_BOX", "T_SMOOTHCHAMFBOX", "T_FLATCHAMFBOX", "T_SPHERE", "T_CAPSULE", + "T_STAR", "T_EXPANDEDSTAR", "T_DISC", "T_TRIANGLE", "T_QUAD", "T_COG", + "T_TORUS", "T_ERROR", "NUMBER", "COLOR", "'['", "']'", "'-'", "$accept", "mesh_description", "mesh_expression_list", "mesh_expression", "mesh_open", "mesh_close", "mesh_command_list", "mesh_command", "color_command", "transform_command", "primitive_command", "args1", @@ -1219,24 +1328,25 @@ namespace lol { const EasyMeshParser::rhs_number_type EasyMeshParser::yyrhs_[] = { - 48, 0, -1, 49, 0, -1, 50, -1, 50, 49, - -1, 53, -1, 51, 49, 52, -1, 44, -1, 45, - -1, 54, -1, 53, 54, -1, 55, -1, 56, -1, - 57, -1, 3, 61, -1, 3, 43, -1, 4, 61, - -1, 4, 43, -1, 27, 58, -1, 5, 58, -1, - 10, 58, -1, 15, 58, -1, 20, 60, -1, 6, - 58, -1, 11, 58, -1, 16, 58, -1, 7, 60, - -1, 12, 60, -1, 17, 60, -1, 8, 58, -1, - 13, 58, -1, 18, 58, -1, 21, 60, -1, 9, - -1, 14, -1, 19, -1, 22, -1, 23, -1, 24, - -1, 25, -1, 26, -1, 28, 63, -1, 29, 60, - -1, 30, 61, -1, 31, 61, -1, 32, 61, -1, - 33, 60, -1, 40, 60, -1, 34, 62, -1, 35, - 61, -1, 36, 60, -1, 37, 59, -1, 38, 59, - -1, 39, 67, -1, 68, -1, 58, 68, -1, 59, - 68, -1, 60, 68, -1, 61, 68, -1, 62, 68, - -1, 63, 68, -1, 64, 68, -1, 65, 68, -1, - 66, 68, -1, 42, -1, 46, 68, -1 + 49, 0, -1, 50, 0, -1, 51, -1, 51, 50, + -1, 54, -1, 52, 50, 53, -1, 45, -1, 46, + -1, 55, -1, 54, 55, -1, 56, -1, 57, -1, + 58, -1, 3, 62, -1, 3, 44, -1, 4, 62, + -1, 4, 44, -1, 28, 59, -1, 5, 59, -1, + 10, 59, -1, 15, 59, -1, 20, 61, -1, 6, + 59, -1, 11, 59, -1, 16, 59, -1, 7, 61, + -1, 12, 61, -1, 17, 61, -1, 8, 59, -1, + 13, 59, -1, 18, 59, -1, 21, 61, -1, 9, + -1, 14, -1, 19, -1, 23, 59, -1, 22, -1, + 24, -1, 25, -1, 26, -1, 27, -1, 29, 64, + -1, 30, 61, -1, 31, 62, -1, 32, 62, -1, + 33, 62, -1, 34, 61, -1, 41, 61, -1, 35, + 63, -1, 36, 62, -1, 37, 61, -1, 38, 60, + -1, 39, 60, -1, 40, 68, -1, 69, -1, 59, + 69, -1, 60, 69, -1, 61, 69, -1, 62, 69, + -1, 63, 69, -1, 64, 69, -1, 65, 69, -1, + 66, 69, -1, 67, 69, -1, 43, -1, 47, 69, + -1 }; /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in @@ -1247,10 +1357,10 @@ namespace lol { 0, 0, 3, 6, 8, 11, 13, 17, 19, 21, 23, 26, 28, 30, 32, 35, 38, 41, 44, 47, 50, 53, 56, 59, 62, 65, 68, 71, 74, 77, - 80, 83, 86, 89, 91, 93, 95, 97, 99, 101, - 103, 105, 108, 111, 114, 117, 120, 123, 126, 129, - 132, 135, 138, 141, 144, 146, 149, 152, 155, 158, - 161, 164, 167, 170, 173, 175 + 80, 83, 86, 89, 91, 93, 95, 98, 100, 102, + 104, 106, 108, 111, 114, 117, 120, 123, 126, 129, + 132, 135, 138, 141, 144, 147, 149, 152, 155, 158, + 161, 164, 167, 170, 173, 176, 178 }; /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ @@ -1261,9 +1371,9 @@ namespace lol { 99, 103, 104, 105, 109, 110, 113, 114, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, - 142, 146, 149, 150, 152, 154, 156, 157, 158, 160, - 162, 163, 164, 165, 170, 171, 172, 173, 174, 175, - 176, 177, 178, 179, 182, 183 + 142, 143, 147, 150, 151, 153, 155, 157, 158, 159, + 161, 163, 164, 165, 166, 171, 172, 173, 174, 175, + 176, 177, 178, 179, 180, 183, 184 }; // Print the state stack on the debug stream. @@ -1307,12 +1417,12 @@ namespace lol { 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, 46, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 47, 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, 44, 2, 45, 2, 2, 2, 2, 2, 2, + 2, 45, 2, 46, 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, @@ -1332,7 +1442,7 @@ namespace lol { 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 42, 43 + 35, 36, 37, 38, 39, 40, 41, 42, 43, 44 }; if ((unsigned int) t <= yyuser_token_number_max_) return translate_table[t]; @@ -1341,26 +1451,26 @@ namespace lol { } const int EasyMeshParser::yyeof_ = 0; - const int EasyMeshParser::yylast_ = 155; + const int EasyMeshParser::yylast_ = 159; const int EasyMeshParser::yynnts_ = 22; const int EasyMeshParser::yyempty_ = -2; - const int EasyMeshParser::yyfinal_ = 93; + const int EasyMeshParser::yyfinal_ = 95; const int EasyMeshParser::yyterror_ = 1; const int EasyMeshParser::yyerrcode_ = 256; - const int EasyMeshParser::yyntokens_ = 47; + const int EasyMeshParser::yyntokens_ = 48; - const unsigned int EasyMeshParser::yyuser_token_number_max_ = 298; + const unsigned int EasyMeshParser::yyuser_token_number_max_ = 299; const EasyMeshParser::token_number_type EasyMeshParser::yyundef_token_ = 2; } // lol -/* Line 1053 of lalr1.cc */ -#line 1360 "generated/easymesh-parser.cpp" +/* Line 1136 of lalr1.cc */ +#line 1470 "generated/easymesh-parser.cpp" -/* Line 1055 of lalr1.cc */ -#line 186 "easymesh/easymesh-parser.y" +/* Line 1138 of lalr1.cc */ +#line 187 "easymesh/easymesh-parser.y" void lol::EasyMeshParser::error(const EasyMeshParser::location_type& l, diff --git a/src/generated/easymesh-parser.h b/src/generated/easymesh-parser.h index 5640961d..5d68b950 100644 --- a/src/generated/easymesh-parser.h +++ b/src/generated/easymesh-parser.h @@ -1,8 +1,8 @@ -/* A Bison parser, made by GNU Bison 2.4.2. */ +/* A Bison parser, made by GNU Bison 2.5. */ /* Skeleton interface for Bison LALR(1) parsers in C++ - Copyright (C) 2002-2010 Free Software Foundation, Inc. + Copyright (C) 2002-2011 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 @@ -40,20 +40,6 @@ #include #include #include "stack.hh" - - -namespace lol { - -/* Line 34 of lalr1.cc */ -#line 49 "generated/easymesh-parser.h" - class position; - class location; - -} // lol - -/* Line 34 of lalr1.cc */ -#line 56 "generated/easymesh-parser.h" - #include "location.hh" /* Enabling traces. */ @@ -74,30 +60,11 @@ namespace lol { # define YYTOKEN_TABLE 0 #endif -/* 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 = (Rhs)[1].begin; \ - (Current).end = (Rhs)[N].end; \ - } \ - else \ - { \ - (Current).begin = (Current).end = (Rhs)[0].end; \ - } \ -} while (false) -#endif - namespace lol { -/* Line 34 of lalr1.cc */ -#line 101 "generated/easymesh-parser.h" +/* Line 35 of lalr1.cc */ +#line 68 "generated/easymesh-parser.h" /// A Bison parser. class EasyMeshParser @@ -108,7 +75,7 @@ namespace lol { union semantic_type { -/* Line 34 of lalr1.cc */ +/* Line 35 of lalr1.cc */ #line 36 "easymesh/easymesh-parser.y" float fval; @@ -118,8 +85,8 @@ namespace lol { -/* Line 34 of lalr1.cc */ -#line 123 "generated/easymesh-parser.h" +/* Line 35 of lalr1.cc */ +#line 90 "generated/easymesh-parser.h" }; #else typedef YYSTYPE semantic_type; @@ -152,27 +119,28 @@ namespace lol { T_TRANSLATE = 275, T_SCALE = 276, T_TOGGLESCALEWINDING = 277, - T_CSGUNION = 278, - T_CSGSUBSTRACT = 279, - T_CSGAND = 280, - T_CSGXOR = 281, - T_CHAMFER = 282, - T_CYLINDER = 283, - T_BOX = 284, - T_SMOOTHCHAMFBOX = 285, - T_FLATCHAMFBOX = 286, - T_SPHERE = 287, - T_CAPSULE = 288, - T_STAR = 289, - T_EXPANDEDSTAR = 290, - T_DISC = 291, - T_TRIANGLE = 292, - T_QUAD = 293, - T_COG = 294, - T_TORUS = 295, - T_ERROR = 296, - NUMBER = 297, - COLOR = 298 + T_RADIALJITTER = 278, + T_CSGUNION = 279, + T_CSGSUBSTRACT = 280, + T_CSGAND = 281, + T_CSGXOR = 282, + T_CHAMFER = 283, + T_CYLINDER = 284, + T_BOX = 285, + T_SMOOTHCHAMFBOX = 286, + T_FLATCHAMFBOX = 287, + T_SPHERE = 288, + T_CAPSULE = 289, + T_STAR = 290, + T_EXPANDEDSTAR = 291, + T_DISC = 292, + T_TRIANGLE = 293, + T_QUAD = 294, + T_COG = 295, + T_TORUS = 296, + T_ERROR = 297, + NUMBER = 298, + COLOR = 299 }; }; @@ -246,6 +214,14 @@ namespace lol { /// The location stack. location_stack_type yylocation_stack_; + /// Whether the given \c yypact_ value indicates a defaulted state. + /// \param yyvalue the value to check + static bool yy_pact_value_is_default_ (int yyvalue); + + /// Whether the given \c yytable_ value indicates a syntax error. + /// \param yyvalue the value to check + static bool yy_table_value_is_error_ (int yyvalue); + /// Internal symbol numbers. typedef unsigned char token_number_type; /* Tables. */ @@ -253,7 +229,7 @@ namespace lol { static const signed char yypact_[]; static const signed char yypact_ninf_; - /// For a state, default rule to reduce. + /// For a state, default reduction number. /// Unless\a yytable_ specifies something else to do. /// Zero means the default is an error. static const unsigned char yydefact_[]; @@ -284,10 +260,8 @@ namespace lol { static const char* const yytname_[]; #endif -#if YYERROR_VERBOSE /// Convert the symbol name \a n to a form suitable for a diagnostic. - virtual std::string yytnamerr_ (const char *n); -#endif + static std::string yytnamerr_ (const char *n); #if YYDEBUG /// A type to store symbol numbers and -1. @@ -345,8 +319,8 @@ namespace lol { } // lol -/* Line 34 of lalr1.cc */ -#line 350 "generated/easymesh-parser.h" +/* Line 35 of lalr1.cc */ +#line 324 "generated/easymesh-parser.h" diff --git a/src/generated/easymesh-scanner.cpp b/src/generated/easymesh-scanner.cpp index 48acaf24..cf0f8cf0 100644 --- a/src/generated/easymesh-scanner.cpp +++ b/src/generated/easymesh-scanner.cpp @@ -330,8 +330,8 @@ typedef unsigned char YY_CHAR; *yy_cp = '\0'; \ (yy_c_buf_p) = yy_cp; -#define YY_NUM_RULES 50 -#define YY_END_OF_BUFFER 51 +#define YY_NUM_RULES 51 +#define YY_END_OF_BUFFER 52 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info @@ -339,16 +339,17 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static yyconst flex_int16_t yy_accept[81] = +static yyconst flex_int16_t yy_accept[82] = { 0, - 0, 0, 51, 49, 48, 47, 49, 49, 44, 49, - 43, 45, 46, 49, 49, 49, 49, 17, 7, 0, - 0, 43, 43, 0, 26, 27, 30, 0, 0, 33, - 34, 37, 3, 0, 19, 20, 21, 8, 9, 10, - 1, 14, 15, 16, 0, 0, 4, 5, 6, 0, - 0, 43, 0, 29, 31, 0, 0, 0, 38, 0, - 2, 11, 12, 13, 18, 39, 28, 32, 35, 36, - 24, 23, 22, 25, 40, 0, 41, 0, 42, 0 + 0, 0, 52, 50, 49, 48, 50, 50, 45, 50, + 44, 46, 47, 50, 50, 50, 50, 17, 7, 0, + 0, 44, 44, 0, 27, 28, 31, 0, 0, 34, + 35, 38, 3, 0, 19, 20, 21, 22, 8, 9, + 10, 1, 14, 15, 16, 0, 0, 4, 5, 6, + 0, 0, 44, 0, 30, 32, 0, 0, 0, 39, + 0, 2, 11, 12, 13, 18, 40, 29, 33, 36, + 37, 25, 24, 23, 26, 41, 0, 42, 0, 43, + 0 } ; static yyconst flex_int32_t yy_ec[256] = @@ -364,9 +365,9 @@ static yyconst flex_int32_t yy_ec[256] = 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 11, 1, 12, 1, 1, 1, 13, 14, 15, 16, - 17, 18, 19, 20, 1, 1, 1, 1, 21, 1, - 22, 23, 24, 25, 26, 27, 28, 1, 29, 30, - 31, 32, 1, 1, 1, 1, 1, 1, 1, 1, + 17, 18, 19, 20, 1, 21, 1, 1, 22, 1, + 23, 24, 25, 26, 27, 28, 29, 1, 30, 31, + 32, 33, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -383,78 +384,78 @@ static yyconst flex_int32_t yy_ec[256] = 1, 1, 1, 1, 1 } ; -static yyconst flex_int32_t yy_meta[33] = +static yyconst flex_int32_t yy_meta[34] = { 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 1, 1, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1 + 1, 1, 1 } ; -static yyconst flex_int16_t yy_base[89] = +static yyconst flex_int16_t yy_base[90] = { 0, - 0, 0, 109, 110, 110, 110, 0, 26, 28, 100, - 30, 110, 110, 34, 19, 11, 23, 41, 61, 0, - 99, 58, 59, 72, 110, 44, 110, 80, 90, 110, - 47, 82, 110, 84, 110, 110, 110, 110, 110, 110, - 88, 110, 110, 110, 51, 71, 110, 110, 110, 0, - 90, 88, 72, 110, 110, 80, 76, 69, 110, 71, - 110, 110, 110, 110, 110, 0, 110, 110, 110, 110, - 110, 110, 110, 110, 0, 0, 0, 0, 110, 110, - 86, 84, 83, 77, 62, 57, 44, 42 + 0, 0, 111, 112, 112, 112, 0, 27, 29, 102, + 31, 112, 112, 35, 20, 11, 24, 39, 60, 0, + 101, 51, 57, 70, 112, 64, 112, 81, 92, 112, + 64, 83, 112, 86, 112, 112, 112, 112, 112, 112, + 112, 90, 112, 112, 112, 49, 73, 112, 112, 112, + 0, 93, 91, 73, 112, 112, 82, 81, 74, 112, + 71, 112, 112, 112, 112, 112, 0, 112, 112, 112, + 112, 112, 112, 112, 112, 0, 0, 0, 0, 112, + 112, 88, 87, 84, 83, 67, 64, 62, 44 } ; -static yyconst flex_int16_t yy_def[89] = +static yyconst flex_int16_t yy_def[90] = { 0, - 80, 1, 80, 80, 80, 80, 81, 80, 80, 80, - 80, 80, 80, 80, 80, 80, 80, 80, 80, 82, - 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, - 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, - 80, 80, 80, 80, 80, 80, 80, 80, 80, 83, - 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, - 80, 80, 80, 80, 80, 84, 80, 80, 80, 80, - 80, 80, 80, 80, 85, 86, 87, 88, 80, 0, - 80, 80, 80, 80, 80, 80, 80, 80 + 81, 1, 81, 81, 81, 81, 82, 81, 81, 81, + 81, 81, 81, 81, 81, 81, 81, 81, 81, 83, + 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, + 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, + 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, + 84, 81, 81, 81, 81, 81, 81, 81, 81, 81, + 81, 81, 81, 81, 81, 81, 85, 81, 81, 81, + 81, 81, 81, 81, 81, 86, 87, 88, 89, 81, + 0, 81, 81, 81, 81, 81, 81, 81, 81 } ; -static yyconst flex_int16_t yy_nxt[143] = +static yyconst flex_int16_t yy_nxt[146] = { 0, 4, 5, 6, 7, 8, 9, 10, 11, 4, 4, 12, 13, 14, 4, 15, 4, 4, 4, 4, 4, - 16, 4, 4, 4, 17, 18, 19, 4, 4, 4, - 4, 4, 21, 22, 21, 22, 21, 22, 33, 24, - 35, 36, 37, 79, 34, 78, 24, 25, 26, 27, - 28, 29, 38, 39, 40, 41, 53, 30, 77, 31, - 32, 57, 54, 76, 21, 22, 23, 24, 24, 58, - 42, 43, 44, 45, 24, 24, 51, 51, 75, 52, - 62, 63, 64, 71, 66, 50, 46, 20, 70, 69, - 47, 48, 49, 68, 67, 52, 72, 52, 73, 65, - - 74, 61, 60, 59, 56, 55, 23, 23, 80, 3, - 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, - 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, - 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, - 80, 80 + 4, 16, 4, 4, 4, 17, 18, 19, 4, 4, + 4, 4, 4, 21, 22, 21, 22, 21, 22, 33, + 24, 35, 36, 37, 38, 80, 34, 24, 25, 26, + 27, 28, 29, 42, 39, 40, 41, 21, 22, 30, + 24, 31, 32, 79, 23, 78, 24, 24, 77, 43, + 44, 45, 46, 24, 52, 52, 54, 53, 58, 63, + 64, 65, 55, 72, 76, 67, 47, 59, 51, 20, + 48, 49, 50, 71, 70, 69, 68, 73, 53, 74, + + 53, 75, 66, 62, 61, 60, 57, 56, 23, 23, + 81, 3, 81, 81, 81, 81, 81, 81, 81, 81, + 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, + 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, + 81, 81, 81, 81, 81 } ; -static yyconst flex_int16_t yy_chk[143] = +static yyconst flex_int16_t yy_chk[146] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 8, 8, 9, 9, 11, 11, 15, 11, - 16, 16, 16, 88, 15, 87, 11, 14, 14, 14, - 14, 14, 17, 17, 17, 18, 26, 14, 86, 14, - 14, 31, 26, 85, 22, 22, 23, 22, 23, 31, - 18, 18, 18, 19, 22, 23, 24, 24, 84, 24, - 45, 45, 45, 60, 83, 82, 19, 81, 58, 57, - 19, 19, 19, 56, 53, 52, 60, 51, 60, 46, - - 60, 41, 34, 32, 29, 28, 21, 10, 3, 80, - 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, - 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, - 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, - 80, 80 + 1, 1, 1, 8, 8, 9, 9, 11, 11, 15, + 11, 16, 16, 16, 17, 89, 15, 11, 14, 14, + 14, 14, 14, 18, 17, 17, 17, 22, 22, 14, + 22, 14, 14, 88, 23, 87, 23, 22, 86, 18, + 18, 18, 19, 23, 24, 24, 26, 24, 31, 46, + 46, 46, 26, 61, 85, 84, 19, 31, 83, 82, + 19, 19, 19, 59, 58, 57, 54, 61, 53, 61, + + 52, 61, 47, 42, 34, 32, 29, 28, 21, 10, + 3, 81, 81, 81, 81, 81, 81, 81, 81, 81, + 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, + 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, + 81, 81, 81, 81, 81 } ; /* The intent behind this definition is that it'll catch @@ -503,7 +504,7 @@ typedef lol::EasyMeshParser::token_type token_type; #define yyterminate() return token::T_END #define YY_NO_UNISTD_H #define YY_USER_ACTION yylloc->columns(yyleng); -#line 507 "generated/easymesh-scanner.cpp" +#line 508 "generated/easymesh-scanner.cpp" #define INITIAL 0 @@ -616,7 +617,7 @@ YY_DECL yylloc->step(); -#line 620 "generated/easymesh-scanner.cpp" +#line 621 "generated/easymesh-scanner.cpp" if ( !(yy_init) ) { @@ -669,13 +670,13 @@ yy_match: while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 81 ) + if ( yy_current_state >= 82 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; ++yy_cp; } - while ( yy_current_state != 80 ); + while ( yy_current_state != 81 ); yy_cp = (yy_last_accepting_cpos); yy_current_state = (yy_last_accepting_state); @@ -802,92 +803,97 @@ YY_RULE_SETUP YY_BREAK case 22: YY_RULE_SETUP -#line 74 "easymesh/easymesh-scanner.l" -{ return token::T_CSGUNION; } +#line 73 "easymesh/easymesh-scanner.l" +{ return token::T_RADIALJITTER; } YY_BREAK case 23: YY_RULE_SETUP #line 75 "easymesh/easymesh-scanner.l" -{ return token::T_CSGSUBSTRACT; } +{ return token::T_CSGUNION; } YY_BREAK case 24: YY_RULE_SETUP #line 76 "easymesh/easymesh-scanner.l" -{ return token::T_CSGAND; } +{ return token::T_CSGSUBSTRACT; } YY_BREAK case 25: YY_RULE_SETUP #line 77 "easymesh/easymesh-scanner.l" -{ return token::T_CSGXOR; } +{ return token::T_CSGAND; } YY_BREAK case 26: YY_RULE_SETUP -#line 79 "easymesh/easymesh-scanner.l" -{ return token::T_BOX; } +#line 78 "easymesh/easymesh-scanner.l" +{ return token::T_CSGXOR; } YY_BREAK case 27: YY_RULE_SETUP #line 80 "easymesh/easymesh-scanner.l" -{ return token::T_CYLINDER; } +{ return token::T_BOX; } YY_BREAK case 28: YY_RULE_SETUP #line 81 "easymesh/easymesh-scanner.l" -{ return token::T_CAPSULE; } +{ return token::T_CYLINDER; } YY_BREAK case 29: YY_RULE_SETUP #line 82 "easymesh/easymesh-scanner.l" -{ return token::T_COG; } +{ return token::T_CAPSULE; } YY_BREAK case 30: YY_RULE_SETUP #line 83 "easymesh/easymesh-scanner.l" -{ return token::T_DISC; } +{ return token::T_COG; } YY_BREAK case 31: YY_RULE_SETUP #line 84 "easymesh/easymesh-scanner.l" -{ return token::T_EXPANDEDSTAR; } +{ return token::T_DISC; } YY_BREAK case 32: YY_RULE_SETUP #line 85 "easymesh/easymesh-scanner.l" -{ return token::T_FLATCHAMFBOX; } +{ return token::T_EXPANDEDSTAR; } YY_BREAK case 33: YY_RULE_SETUP #line 86 "easymesh/easymesh-scanner.l" -{ return token::T_QUAD; } +{ return token::T_FLATCHAMFBOX; } YY_BREAK case 34: YY_RULE_SETUP #line 87 "easymesh/easymesh-scanner.l" -{ return token::T_STAR; } +{ return token::T_QUAD; } YY_BREAK case 35: YY_RULE_SETUP #line 88 "easymesh/easymesh-scanner.l" -{ return token::T_SMOOTHCHAMFBOX; } +{ return token::T_STAR; } YY_BREAK case 36: YY_RULE_SETUP #line 89 "easymesh/easymesh-scanner.l" -{ return token::T_SPHERE; } +{ return token::T_SMOOTHCHAMFBOX; } YY_BREAK case 37: YY_RULE_SETUP #line 90 "easymesh/easymesh-scanner.l" -{ return token::T_TRIANGLE; } +{ return token::T_SPHERE; } YY_BREAK case 38: YY_RULE_SETUP #line 91 "easymesh/easymesh-scanner.l" -{ return token::T_TORUS; } +{ return token::T_TRIANGLE; } YY_BREAK case 39: YY_RULE_SETUP -#line 93 "easymesh/easymesh-scanner.l" +#line 92 "easymesh/easymesh-scanner.l" +{ return token::T_TORUS; } + YY_BREAK +case 40: +YY_RULE_SETUP +#line 94 "easymesh/easymesh-scanner.l" { uint32_t tmp = std::strtol(yytext + 1, NULL, 16); yylval->u32val = 0x11000000u * (tmp >> 8) @@ -896,9 +902,9 @@ YY_RULE_SETUP | 0x000000ffu; return token::COLOR; } YY_BREAK -case 40: +case 41: YY_RULE_SETUP -#line 100 "easymesh/easymesh-scanner.l" +#line 101 "easymesh/easymesh-scanner.l" { uint32_t tmp = std::strtol(yytext + 1, NULL, 16); yylval->u32val = 0x11000000u * (tmp >> 12) @@ -907,64 +913,64 @@ YY_RULE_SETUP | 0x00000011u * (tmp & 0xf); return token::COLOR; } YY_BREAK -case 41: +case 42: YY_RULE_SETUP -#line 107 "easymesh/easymesh-scanner.l" +#line 108 "easymesh/easymesh-scanner.l" { yylval->u32val = 0xffu | 0x100u * (uint32_t)std::strtol(yytext + 1, NULL, 16); return token::COLOR; } YY_BREAK -case 42: +case 43: YY_RULE_SETUP -#line 111 "easymesh/easymesh-scanner.l" +#line 112 "easymesh/easymesh-scanner.l" { yylval->u32val = (uint32_t)std::strtol(yytext + 1, NULL, 16); return token::COLOR; } YY_BREAK -case 43: +case 44: YY_RULE_SETUP -#line 114 "easymesh/easymesh-scanner.l" +#line 115 "easymesh/easymesh-scanner.l" { yylval->fval = std::atof(yytext); return token::NUMBER; } YY_BREAK -case 44: -YY_RULE_SETUP -#line 116 "easymesh/easymesh-scanner.l" -{ return token_type('-'); } - YY_BREAK case 45: YY_RULE_SETUP #line 117 "easymesh/easymesh-scanner.l" -{ return token_type('['); } +{ return token_type('-'); } YY_BREAK case 46: YY_RULE_SETUP #line 118 "easymesh/easymesh-scanner.l" -{ return token_type(']'); } +{ return token_type('['); } YY_BREAK case 47: YY_RULE_SETUP #line 119 "easymesh/easymesh-scanner.l" -{ /* ignore this */ } +{ return token_type(']'); } YY_BREAK case 48: -/* rule 48 can match eol */ YY_RULE_SETUP #line 120 "easymesh/easymesh-scanner.l" { /* ignore this */ } YY_BREAK case 49: +/* rule 49 can match eol */ YY_RULE_SETUP #line 121 "easymesh/easymesh-scanner.l" -{ return token::T_ERROR; } +{ /* ignore this */ } YY_BREAK case 50: YY_RULE_SETUP -#line 123 "easymesh/easymesh-scanner.l" +#line 122 "easymesh/easymesh-scanner.l" +{ return token::T_ERROR; } + YY_BREAK +case 51: +YY_RULE_SETUP +#line 124 "easymesh/easymesh-scanner.l" ECHO; YY_BREAK -#line 968 "generated/easymesh-scanner.cpp" +#line 974 "generated/easymesh-scanner.cpp" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -1346,7 +1352,7 @@ int yyFlexLexer::yy_get_next_buffer() while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 81 ) + if ( yy_current_state >= 82 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; @@ -1374,11 +1380,11 @@ int yyFlexLexer::yy_get_next_buffer() while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 81 ) + if ( yy_current_state >= 82 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 80); + yy_is_jam = (yy_current_state == 81); return yy_is_jam ? 0 : yy_current_state; } @@ -1865,7 +1871,7 @@ void EasyMeshfree (void * ptr ) #define YYTABLES_NAME "yytables" -#line 123 "easymesh/easymesh-scanner.l" +#line 124 "easymesh/easymesh-scanner.l" diff --git a/src/generated/location.hh b/src/generated/location.hh index 0b3d1b94..76061106 100644 --- a/src/generated/location.hh +++ b/src/generated/location.hh @@ -1,8 +1,8 @@ -/* A Bison parser, made by GNU Bison 2.4.2. */ +/* A Bison parser, made by GNU Bison 2.5. */ /* Locations for Bison parsers in C++ - Copyright (C) 2002-2007, 2009-2010 Free Software Foundation, Inc. + Copyright (C) 2002-2007, 2009-2011 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 diff --git a/src/generated/lolfx-parser.cpp b/src/generated/lolfx-parser.cpp index a59a4578..9c73389d 100644 --- a/src/generated/lolfx-parser.cpp +++ b/src/generated/lolfx-parser.cpp @@ -1,8 +1,8 @@ -/* A Bison parser, made by GNU Bison 2.4.2. */ +/* A Bison parser, made by GNU Bison 2.5. */ /* Skeleton implementation for Bison LALR(1) parsers in C++ - Copyright (C) 2002-2010 Free Software Foundation, Inc. + Copyright (C) 2002-2011 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 @@ -35,7 +35,7 @@ /* First part of user declarations. */ -/* Line 310 of lalr1.cc */ +/* Line 293 of lalr1.cc */ #line 1 "gpu/lolfx-parser.y" // @@ -58,7 +58,7 @@ -/* Line 310 of lalr1.cc */ +/* Line 293 of lalr1.cc */ #line 63 "generated/lolfx-parser.cpp" @@ -66,7 +66,7 @@ /* User implementation prologue. */ -/* Line 316 of lalr1.cc */ +/* Line 299 of lalr1.cc */ #line 241 "gpu/lolfx-parser.y" #include "gpu/lolfx-compiler.h" @@ -75,7 +75,7 @@ #define yylex mc.m_lexer->lex -/* Line 316 of lalr1.cc */ +/* Line 299 of lalr1.cc */ #line 80 "generated/lolfx-parser.cpp" #ifndef YY_ @@ -90,6 +90,26 @@ # endif #endif +/* 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). */ + +#define YYRHSLOC(Rhs, K) ((Rhs)[K]) +#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 (false) +#endif + /* Suppress unused-variable warnings by "using" E. */ #define YYUSE(e) ((void) (e)) @@ -141,9 +161,8 @@ do { \ namespace lol { -/* Line 379 of lalr1.cc */ -#line 146 "generated/lolfx-parser.cpp" -#if YYERROR_VERBOSE +/* Line 382 of lalr1.cc */ +#line 166 "generated/lolfx-parser.cpp" /* Return YYSTR after stripping away unnecessary quotes and backslashes, so that it's suitable for yyerror. The heuristic is @@ -182,7 +201,6 @@ namespace lol { return yystr; } -#endif /// Build a parser object. LolFxParser::LolFxParser (class LolFxCompiler& mc_yyarg) @@ -283,6 +301,18 @@ 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 () { @@ -304,7 +334,7 @@ namespace lol { /// Location of the lookahead. location_type yylloc; /// The locations where the error started and ended. - location_type yyerror_range[2]; + location_type yyerror_range[3]; /// $$. semantic_type yyval; @@ -342,7 +372,7 @@ namespace lol { /* Try to take a decision without lookahead. */ yyn = yypact_[yystate]; - if (yyn == yypact_ninf_) + if (yy_pact_value_is_default_ (yyn)) goto yydefault; /* Read a lookahead token. */ @@ -375,8 +405,8 @@ namespace lol { yyn = yytable_[yyn]; if (yyn <= 0) { - if (yyn == 0 || yyn == yytable_ninf_) - goto yyerrlab; + if (yy_table_value_is_error_ (yyn)) + goto yyerrlab; yyn = -yyn; goto yyreduce; } @@ -432,46 +462,57 @@ namespace lol { { case 202: -/* Line 677 of lalr1.cc */ +/* Line 690 of lalr1.cc */ #line 728 "gpu/lolfx-parser.y" { std::cout << "New tech " << std::endl; } break; case 203: -/* Line 677 of lalr1.cc */ +/* Line 690 of lalr1.cc */ #line 736 "gpu/lolfx-parser.y" { std::cout << "New name " << (yysemantic_stack_[(1) - (1)].sval) << std::endl; } break; case 204: -/* Line 677 of lalr1.cc */ +/* Line 690 of lalr1.cc */ #line 737 "gpu/lolfx-parser.y" { std::cout << "New name " << (yysemantic_stack_[(1) - (1)].sval) << std::endl; } break; case 207: -/* Line 677 of lalr1.cc */ +/* Line 690 of lalr1.cc */ #line 750 "gpu/lolfx-parser.y" { std::cout << "New pass " << std::endl; } break; case 226: -/* Line 677 of lalr1.cc */ +/* Line 690 of lalr1.cc */ #line 786 "gpu/lolfx-parser.y" { std::cout << "new shader" << std::endl; } break; -/* Line 677 of lalr1.cc */ -#line 472 "generated/lolfx-parser.cpp" +/* Line 690 of lalr1.cc */ +#line 502 "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. */ YY_SYMBOL_PRINT ("-> $$ =", yyr1_[yyn], &yyval, &yyloc); yypop_ (yylen); @@ -495,14 +536,20 @@ 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[0] = yylloc; + yyerror_range[1] = yylloc; if (yyerrstatus_ == 3) { /* If just tried and failed to reuse lookahead token after an @@ -537,7 +584,7 @@ namespace lol { if (false) goto yyerrorlab; - yyerror_range[0] = yylocation_stack_[yylen - 1]; + yyerror_range[1] = yylocation_stack_[yylen - 1]; /* Do not reclaim the symbols of the rule which action triggered this YYERROR. */ yypop_ (yylen); @@ -554,7 +601,7 @@ namespace lol { for (;;) { yyn = yypact_[yystate]; - if (yyn != yypact_ninf_) + if (!yy_pact_value_is_default_ (yyn)) { yyn += yyterror_; if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == yyterror_) @@ -569,7 +616,7 @@ namespace lol { if (yystate_stack_.height () == 1) YYABORT; - yyerror_range[0] = yylocation_stack_[0]; + yyerror_range[1] = yylocation_stack_[0]; yydestruct_ ("Error: popping", yystos_[yystate], &yysemantic_stack_[0], &yylocation_stack_[0]); @@ -578,10 +625,10 @@ namespace lol { YY_STACK_PRINT (); } - yyerror_range[1] = yylloc; + yyerror_range[2] = yylloc; // Using YYLLOC is tempting, but would change the location of // the lookahead. YYLOC is available though. - YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2); + YYLLOC_DEFAULT (yyloc, yyerror_range, 2); yysemantic_stack_.push (yylval); yylocation_stack_.push (yyloc); @@ -604,7 +651,13 @@ namespace lol { yyreturn: if (yychar != yyempty_) - yydestruct_ ("Cleanup: discarding lookahead", yytoken, &yylval, &yylloc); + { + /* 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); + } /* Do not reclaim the symbols of the rule which action triggered this YYABORT or YYACCEPT. */ @@ -623,51 +676,97 @@ namespace lol { // Generate an error message. std::string - LolFxParser::yysyntax_error_ (int yystate, int tok) + LolFxParser::yysyntax_error_ (int yystate, int yytoken) { - std::string res; - YYUSE (yystate); -#if YYERROR_VERBOSE - int yyn = yypact_[yystate]; - if (yypact_ninf_ < yyn && yyn <= yylast_) + 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_) { - /* 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]); - } - } + 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]; + } + } } - else -#endif - res = YY_("syntax error"); - return res; + + char const* yyformat = 0; + switch (yycount) + { +#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_ + } + + // 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; } @@ -746,9 +845,9 @@ namespace lol { -68, -559, -559, -559, -559 }; - /* 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. */ + /* 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. */ const unsigned short int LolFxParser::yydefact_[] = { @@ -855,7 +954,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 zero, do what YYDEFACT says. */ + number is the opposite. If YYTABLE_NINF_, syntax error. */ const short int LolFxParser::yytable_ninf_ = -323; const short int LolFxParser::yytable_[] = @@ -3791,11 +3890,11 @@ namespace lol { } // lol -/* Line 1053 of lalr1.cc */ -#line 3796 "generated/lolfx-parser.cpp" +/* Line 1136 of lalr1.cc */ +#line 3895 "generated/lolfx-parser.cpp" -/* Line 1055 of lalr1.cc */ +/* Line 1138 of lalr1.cc */ #line 1298 "gpu/lolfx-parser.y" diff --git a/src/generated/lolfx-parser.h b/src/generated/lolfx-parser.h index f4119960..c41899dc 100644 --- a/src/generated/lolfx-parser.h +++ b/src/generated/lolfx-parser.h @@ -1,8 +1,8 @@ -/* A Bison parser, made by GNU Bison 2.4.2. */ +/* A Bison parser, made by GNU Bison 2.5. */ /* Skeleton interface for Bison LALR(1) parsers in C++ - Copyright (C) 2002-2010 Free Software Foundation, Inc. + Copyright (C) 2002-2011 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 @@ -40,20 +40,6 @@ #include #include #include "stack.hh" - - -namespace lol { - -/* Line 34 of lalr1.cc */ -#line 49 "generated/lolfx-parser.h" - class position; - class location; - -} // lol - -/* Line 34 of lalr1.cc */ -#line 56 "generated/lolfx-parser.h" - #include "location.hh" /* Enabling traces. */ @@ -74,30 +60,11 @@ namespace lol { # define YYTOKEN_TABLE 0 #endif -/* 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 = (Rhs)[1].begin; \ - (Current).end = (Rhs)[N].end; \ - } \ - else \ - { \ - (Current).begin = (Current).end = (Rhs)[0].end; \ - } \ -} while (false) -#endif - namespace lol { -/* Line 34 of lalr1.cc */ -#line 101 "generated/lolfx-parser.h" +/* Line 35 of lalr1.cc */ +#line 68 "generated/lolfx-parser.h" /// A Bison parser. class LolFxParser @@ -108,7 +75,7 @@ namespace lol { union semantic_type { -/* Line 34 of lalr1.cc */ +/* Line 35 of lalr1.cc */ #line 34 "gpu/lolfx-parser.y" int ival; @@ -118,8 +85,8 @@ namespace lol { -/* Line 34 of lalr1.cc */ -#line 123 "generated/lolfx-parser.h" +/* Line 35 of lalr1.cc */ +#line 90 "generated/lolfx-parser.h" }; #else typedef YYSTYPE semantic_type; @@ -640,6 +607,14 @@ namespace lol { /// The location stack. location_stack_type yylocation_stack_; + /// Whether the given \c yypact_ value indicates a defaulted state. + /// \param yyvalue the value to check + static bool yy_pact_value_is_default_ (int yyvalue); + + /// Whether the given \c yytable_ value indicates a syntax error. + /// \param yyvalue the value to check + static bool yy_table_value_is_error_ (int yyvalue); + /// Internal symbol numbers. typedef unsigned short int token_number_type; /* Tables. */ @@ -647,7 +622,7 @@ namespace lol { static const short int yypact_[]; static const short int yypact_ninf_; - /// For a state, default rule to reduce. + /// For a state, default reduction number. /// Unless\a yytable_ specifies something else to do. /// Zero means the default is an error. static const unsigned short int yydefact_[]; @@ -678,10 +653,8 @@ namespace lol { static const char* const yytname_[]; #endif -#if YYERROR_VERBOSE /// Convert the symbol name \a n to a form suitable for a diagnostic. - virtual std::string yytnamerr_ (const char *n); -#endif + static std::string yytnamerr_ (const char *n); #if YYDEBUG /// A type to store symbol numbers and -1. @@ -739,8 +712,8 @@ namespace lol { } // lol -/* Line 34 of lalr1.cc */ -#line 744 "generated/lolfx-parser.h" +/* Line 35 of lalr1.cc */ +#line 717 "generated/lolfx-parser.h" diff --git a/src/generated/position.hh b/src/generated/position.hh index 984c21a6..5a706fc4 100644 --- a/src/generated/position.hh +++ b/src/generated/position.hh @@ -1,8 +1,8 @@ -/* A Bison parser, made by GNU Bison 2.4.2. */ +/* A Bison parser, made by GNU Bison 2.5. */ /* Positions for Bison parsers in C++ - Copyright (C) 2002-2007, 2009-2010 Free Software Foundation, Inc. + Copyright (C) 2002-2007, 2009-2011 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 diff --git a/src/generated/stack.hh b/src/generated/stack.hh index cf73da80..e5d1f9cf 100644 --- a/src/generated/stack.hh +++ b/src/generated/stack.hh @@ -1,8 +1,8 @@ -/* A Bison parser, made by GNU Bison 2.4.2. */ +/* A Bison parser, made by GNU Bison 2.5. */ /* Stack handling for Bison parsers in C++ - Copyright (C) 2002-2010 Free Software Foundation, Inc. + Copyright (C) 2002-2011 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 @@ -38,7 +38,7 @@ namespace lol { -/* Line 1066 of lalr1.cc */ +/* Line 1149 of lalr1.cc */ #line 43 "generated/stack.hh" template > class stack @@ -128,7 +128,7 @@ namespace lol { } // lol -/* Line 1152 of lalr1.cc */ +/* Line 1235 of lalr1.cc */ #line 133 "generated/stack.hh" #endif // not BISON_STACK_HH[]dnl diff --git a/src/lol/math/vector.h b/src/lol/math/vector.h index 2c53f2f8..9d28e113 100644 --- a/src/lol/math/vector.h +++ b/src/lol/math/vector.h @@ -19,9 +19,9 @@ #include #include -#include "lol/math/math.h" -#include "lol/math/half.h" -#include "lol/math/real.h" +#include +#include +#include namespace lol { @@ -1370,6 +1370,8 @@ LOL_ALL_VECTOR_OPS_AND_FUNS(half) LOL_ALL_VECTOR_OPS_AND_FUNS(float) LOL_ALL_VECTOR_OPS_AND_FUNS(double) LOL_ALL_VECTOR_OPS_AND_FUNS(ldouble) +LOL_ALL_VECTOR_OPS_AND_FUNS(real) + LOL_ALL_VECTOR_OPS_AND_FUNS(int8_t) LOL_ALL_VECTOR_OPS_AND_FUNS(uint8_t) LOL_ALL_VECTOR_OPS_AND_FUNS(int16_t) @@ -1379,10 +1381,6 @@ LOL_ALL_VECTOR_OPS_AND_FUNS(uint32_t) LOL_ALL_VECTOR_OPS_AND_FUNS(int64_t) LOL_ALL_VECTOR_OPS_AND_FUNS(uint64_t) -/* FIXME: vectors of "real" are deactivated for now, because we do - * not implement all combinations of operators for these types yet. */ -LOL_ALL_VECTOR_OPS_AND_FUNS(real) - #if defined _MSC_VER # pragma warning(pop) #endif