Browse Source

build: fix all vector/scalar type mismatches such as "vec2 * double"

instead of "vec2 * float".
legacy
Sam Hocevar sam 11 years ago
parent
commit
d4766d410f
11 changed files with 762 additions and 602 deletions
  1. +2
    -2
      src/easymesh/easymesh-parser.y
  2. +1
    -1
      src/easymesh/easymesh.cpp
  3. +391
    -281
      src/generated/easymesh-parser.cpp
  4. +41
    -67
      src/generated/easymesh-parser.h
  5. +119
    -113
      src/generated/easymesh-scanner.cpp
  6. +2
    -2
      src/generated/location.hh
  7. +176
    -77
      src/generated/lolfx-parser.cpp
  8. +19
    -46
      src/generated/lolfx-parser.h
  9. +2
    -2
      src/generated/position.hh
  10. +4
    -4
      src/generated/stack.hh
  11. +5
    -7
      src/lol/math/vector.h

+ 2
- 2
src/easymesh/easymesh-parser.y View File

@@ -109,11 +109,11 @@ color_command:
T_COLOR args4 { mc.m_mesh.SetCurColor(vec4($2.f0, $2.f1, $2.f2, $2.f3)); } T_COLOR args4 { mc.m_mesh.SetCurColor(vec4($2.f0, $2.f1, $2.f2, $2.f3)); }
| T_COLOR COLOR { uint32_t x = $2; | T_COLOR COLOR { uint32_t x = $2;
vec4 v(x >> 24, (x >> 16) & 0xff, (x >> 8) & 0xff, x & 0xff); 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 args4 { mc.m_mesh.SetCurColor2(vec4($2.f0, $2.f1, $2.f2, $2.f3)); }
| T_BGCOLOR COLOR { uint32_t x = $2; | T_BGCOLOR COLOR { uint32_t x = $2;
vec4 v(x >> 24, (x >> 16) & 0xff, (x >> 8) & 0xff, x & 0xff); 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: transform_command:


+ 1
- 1
src/easymesh/easymesh.cpp View File

@@ -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++) 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] + vb,
p[0] + vc, p[0] + vc,
p[0] + vb + vc }; p[0] + vb + vc };


+ 391
- 281
src/generated/easymesh-parser.cpp
File diff suppressed because it is too large
View File


+ 41
- 67
src/generated/easymesh-parser.h View File

@@ -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++ /* 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 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 it under the terms of the GNU General Public License as published by
@@ -40,20 +40,6 @@
#include <string> #include <string>
#include <iostream> #include <iostream>
#include "stack.hh" #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" #include "location.hh"


/* Enabling traces. */ /* Enabling traces. */
@@ -74,30 +60,11 @@ namespace lol {
# define YYTOKEN_TABLE 0 # define YYTOKEN_TABLE 0
#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). */

#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 { 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. /// A Bison parser.
class EasyMeshParser class EasyMeshParser
@@ -108,7 +75,7 @@ namespace lol {
union semantic_type union semantic_type
{ {


/* Line 34 of lalr1.cc */
/* Line 35 of lalr1.cc */
#line 36 "easymesh/easymesh-parser.y" #line 36 "easymesh/easymesh-parser.y"


float fval; 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 #else
typedef YYSTYPE semantic_type; typedef YYSTYPE semantic_type;
@@ -152,27 +119,28 @@ namespace lol {
T_TRANSLATE = 275, T_TRANSLATE = 275,
T_SCALE = 276, T_SCALE = 276,
T_TOGGLESCALEWINDING = 277, 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. /// The location stack.
location_stack_type yylocation_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. /// Internal symbol numbers.
typedef unsigned char token_number_type; typedef unsigned char token_number_type;
/* Tables. */ /* Tables. */
@@ -253,7 +229,7 @@ namespace lol {
static const signed char yypact_[]; static const signed char yypact_[];
static const signed char yypact_ninf_; 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. /// Unless\a yytable_ specifies something else to do.
/// Zero means the default is an error. /// Zero means the default is an error.
static const unsigned char yydefact_[]; static const unsigned char yydefact_[];
@@ -284,10 +260,8 @@ namespace lol {
static const char* const yytname_[]; static const char* const yytname_[];
#endif #endif


#if YYERROR_VERBOSE
/// Convert the symbol name \a n to a form suitable for a diagnostic. /// 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 #if YYDEBUG
/// A type to store symbol numbers and -1. /// A type to store symbol numbers and -1.
@@ -345,8 +319,8 @@ namespace lol {


} // lol } // lol


/* Line 34 of lalr1.cc */
#line 350 "generated/easymesh-parser.h"
/* Line 35 of lalr1.cc */
#line 324 "generated/easymesh-parser.h"








+ 119
- 113
src/generated/easymesh-scanner.cpp View File

@@ -330,8 +330,8 @@ typedef unsigned char YY_CHAR;
*yy_cp = '\0'; \ *yy_cp = '\0'; \
(yy_c_buf_p) = yy_cp; (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, /* This struct is not used in this scanner,
but its presence is necessary. */ but its presence is necessary. */
struct yy_trans_info struct yy_trans_info
@@ -339,16 +339,17 @@ struct yy_trans_info
flex_int32_t yy_verify; flex_int32_t yy_verify;
flex_int32_t yy_nxt; flex_int32_t yy_nxt;
}; };
static yyconst flex_int16_t yy_accept[81] =
static yyconst flex_int16_t yy_accept[82] =
{ 0, { 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] = 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
11, 1, 12, 1, 1, 1, 13, 14, 15, 16, 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, 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 1, 1, 1, 1, 1
} ; } ;


static yyconst flex_int32_t yy_meta[33] =
static yyconst flex_int32_t yy_meta[34] =
{ 0, { 0,
1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2,
1, 1, 2, 2, 2, 2, 2, 2, 1, 1, 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, 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, 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, { 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, { 0,
4, 5, 6, 7, 8, 9, 10, 11, 4, 4, 4, 5, 6, 7, 8, 9, 10, 11, 4, 4,
12, 13, 14, 4, 15, 4, 4, 4, 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, { 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, 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 /* 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 yyterminate() return token::T_END
#define YY_NO_UNISTD_H #define YY_NO_UNISTD_H
#define YY_USER_ACTION yylloc->columns(yyleng); #define YY_USER_ACTION yylloc->columns(yyleng);
#line 507 "generated/easymesh-scanner.cpp"
#line 508 "generated/easymesh-scanner.cpp"


#define INITIAL 0 #define INITIAL 0


@@ -616,7 +617,7 @@ YY_DECL
yylloc->step(); yylloc->step();




#line 620 "generated/easymesh-scanner.cpp"
#line 621 "generated/easymesh-scanner.cpp"


if ( !(yy_init) ) if ( !(yy_init) )
{ {
@@ -669,13 +670,13 @@ yy_match:
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{ {
yy_current_state = (int) yy_def[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_c = yy_meta[(unsigned int) yy_c];
} }
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
++yy_cp; ++yy_cp;
} }
while ( yy_current_state != 80 );
while ( yy_current_state != 81 );
yy_cp = (yy_last_accepting_cpos); yy_cp = (yy_last_accepting_cpos);
yy_current_state = (yy_last_accepting_state); yy_current_state = (yy_last_accepting_state);


@@ -802,92 +803,97 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 22: case 22:
YY_RULE_SETUP 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 YY_BREAK
case 23: case 23:
YY_RULE_SETUP YY_RULE_SETUP
#line 75 "easymesh/easymesh-scanner.l" #line 75 "easymesh/easymesh-scanner.l"
{ return token::T_CSGSUBSTRACT; }
{ return token::T_CSGUNION; }
YY_BREAK YY_BREAK
case 24: case 24:
YY_RULE_SETUP YY_RULE_SETUP
#line 76 "easymesh/easymesh-scanner.l" #line 76 "easymesh/easymesh-scanner.l"
{ return token::T_CSGAND; }
{ return token::T_CSGSUBSTRACT; }
YY_BREAK YY_BREAK
case 25: case 25:
YY_RULE_SETUP YY_RULE_SETUP
#line 77 "easymesh/easymesh-scanner.l" #line 77 "easymesh/easymesh-scanner.l"
{ return token::T_CSGXOR; }
{ return token::T_CSGAND; }
YY_BREAK YY_BREAK
case 26: case 26:
YY_RULE_SETUP 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 YY_BREAK
case 27: case 27:
YY_RULE_SETUP YY_RULE_SETUP
#line 80 "easymesh/easymesh-scanner.l" #line 80 "easymesh/easymesh-scanner.l"
{ return token::T_CYLINDER; }
{ return token::T_BOX; }
YY_BREAK YY_BREAK
case 28: case 28:
YY_RULE_SETUP YY_RULE_SETUP
#line 81 "easymesh/easymesh-scanner.l" #line 81 "easymesh/easymesh-scanner.l"
{ return token::T_CAPSULE; }
{ return token::T_CYLINDER; }
YY_BREAK YY_BREAK
case 29: case 29:
YY_RULE_SETUP YY_RULE_SETUP
#line 82 "easymesh/easymesh-scanner.l" #line 82 "easymesh/easymesh-scanner.l"
{ return token::T_COG; }
{ return token::T_CAPSULE; }
YY_BREAK YY_BREAK
case 30: case 30:
YY_RULE_SETUP YY_RULE_SETUP
#line 83 "easymesh/easymesh-scanner.l" #line 83 "easymesh/easymesh-scanner.l"
{ return token::T_DISC; }
{ return token::T_COG; }
YY_BREAK YY_BREAK
case 31: case 31:
YY_RULE_SETUP YY_RULE_SETUP
#line 84 "easymesh/easymesh-scanner.l" #line 84 "easymesh/easymesh-scanner.l"
{ return token::T_EXPANDEDSTAR; }
{ return token::T_DISC; }
YY_BREAK YY_BREAK
case 32: case 32:
YY_RULE_SETUP YY_RULE_SETUP
#line 85 "easymesh/easymesh-scanner.l" #line 85 "easymesh/easymesh-scanner.l"
{ return token::T_FLATCHAMFBOX; }
{ return token::T_EXPANDEDSTAR; }
YY_BREAK YY_BREAK
case 33: case 33:
YY_RULE_SETUP YY_RULE_SETUP
#line 86 "easymesh/easymesh-scanner.l" #line 86 "easymesh/easymesh-scanner.l"
{ return token::T_QUAD; }
{ return token::T_FLATCHAMFBOX; }
YY_BREAK YY_BREAK
case 34: case 34:
YY_RULE_SETUP YY_RULE_SETUP
#line 87 "easymesh/easymesh-scanner.l" #line 87 "easymesh/easymesh-scanner.l"
{ return token::T_STAR; }
{ return token::T_QUAD; }
YY_BREAK YY_BREAK
case 35: case 35:
YY_RULE_SETUP YY_RULE_SETUP
#line 88 "easymesh/easymesh-scanner.l" #line 88 "easymesh/easymesh-scanner.l"
{ return token::T_SMOOTHCHAMFBOX; }
{ return token::T_STAR; }
YY_BREAK YY_BREAK
case 36: case 36:
YY_RULE_SETUP YY_RULE_SETUP
#line 89 "easymesh/easymesh-scanner.l" #line 89 "easymesh/easymesh-scanner.l"
{ return token::T_SPHERE; }
{ return token::T_SMOOTHCHAMFBOX; }
YY_BREAK YY_BREAK
case 37: case 37:
YY_RULE_SETUP YY_RULE_SETUP
#line 90 "easymesh/easymesh-scanner.l" #line 90 "easymesh/easymesh-scanner.l"
{ return token::T_TRIANGLE; }
{ return token::T_SPHERE; }
YY_BREAK YY_BREAK
case 38: case 38:
YY_RULE_SETUP YY_RULE_SETUP
#line 91 "easymesh/easymesh-scanner.l" #line 91 "easymesh/easymesh-scanner.l"
{ return token::T_TORUS; }
{ return token::T_TRIANGLE; }
YY_BREAK YY_BREAK
case 39: case 39:
YY_RULE_SETUP 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); uint32_t tmp = std::strtol(yytext + 1, NULL, 16);
yylval->u32val = 0x11000000u * (tmp >> 8) yylval->u32val = 0x11000000u * (tmp >> 8)
@@ -896,9 +902,9 @@ YY_RULE_SETUP
| 0x000000ffu; | 0x000000ffu;
return token::COLOR; } return token::COLOR; }
YY_BREAK YY_BREAK
case 40:
case 41:
YY_RULE_SETUP YY_RULE_SETUP
#line 100 "easymesh/easymesh-scanner.l"
#line 101 "easymesh/easymesh-scanner.l"
{ {
uint32_t tmp = std::strtol(yytext + 1, NULL, 16); uint32_t tmp = std::strtol(yytext + 1, NULL, 16);
yylval->u32val = 0x11000000u * (tmp >> 12) yylval->u32val = 0x11000000u * (tmp >> 12)
@@ -907,64 +913,64 @@ YY_RULE_SETUP
| 0x00000011u * (tmp & 0xf); | 0x00000011u * (tmp & 0xf);
return token::COLOR; } return token::COLOR; }
YY_BREAK YY_BREAK
case 41:
case 42:
YY_RULE_SETUP YY_RULE_SETUP
#line 107 "easymesh/easymesh-scanner.l"
#line 108 "easymesh/easymesh-scanner.l"
{ {
yylval->u32val = 0xffu yylval->u32val = 0xffu
| 0x100u * (uint32_t)std::strtol(yytext + 1, NULL, 16); | 0x100u * (uint32_t)std::strtol(yytext + 1, NULL, 16);
return token::COLOR; } return token::COLOR; }
YY_BREAK YY_BREAK
case 42:
case 43:
YY_RULE_SETUP 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); yylval->u32val = (uint32_t)std::strtol(yytext + 1, NULL, 16);
return token::COLOR; } return token::COLOR; }
YY_BREAK YY_BREAK
case 43:
case 44:
YY_RULE_SETUP YY_RULE_SETUP
#line 114 "easymesh/easymesh-scanner.l"
#line 115 "easymesh/easymesh-scanner.l"
{ {
yylval->fval = std::atof(yytext); return token::NUMBER; } yylval->fval = std::atof(yytext); return token::NUMBER; }
YY_BREAK YY_BREAK
case 44:
YY_RULE_SETUP
#line 116 "easymesh/easymesh-scanner.l"
{ return token_type('-'); }
YY_BREAK
case 45: case 45:
YY_RULE_SETUP YY_RULE_SETUP
#line 117 "easymesh/easymesh-scanner.l" #line 117 "easymesh/easymesh-scanner.l"
{ return token_type('['); }
{ return token_type('-'); }
YY_BREAK YY_BREAK
case 46: case 46:
YY_RULE_SETUP YY_RULE_SETUP
#line 118 "easymesh/easymesh-scanner.l" #line 118 "easymesh/easymesh-scanner.l"
{ return token_type(']'); }
{ return token_type('['); }
YY_BREAK YY_BREAK
case 47: case 47:
YY_RULE_SETUP YY_RULE_SETUP
#line 119 "easymesh/easymesh-scanner.l" #line 119 "easymesh/easymesh-scanner.l"
{ /* ignore this */ }
{ return token_type(']'); }
YY_BREAK YY_BREAK
case 48: case 48:
/* rule 48 can match eol */
YY_RULE_SETUP YY_RULE_SETUP
#line 120 "easymesh/easymesh-scanner.l" #line 120 "easymesh/easymesh-scanner.l"
{ /* ignore this */ } { /* ignore this */ }
YY_BREAK YY_BREAK
case 49: case 49:
/* rule 49 can match eol */
YY_RULE_SETUP YY_RULE_SETUP
#line 121 "easymesh/easymesh-scanner.l" #line 121 "easymesh/easymesh-scanner.l"
{ return token::T_ERROR; }
{ /* ignore this */ }
YY_BREAK YY_BREAK
case 50: case 50:
YY_RULE_SETUP 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; ECHO;
YY_BREAK YY_BREAK
#line 968 "generated/easymesh-scanner.cpp"
#line 974 "generated/easymesh-scanner.cpp"
case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(INITIAL):
yyterminate(); yyterminate();


@@ -1346,7 +1352,7 @@ int yyFlexLexer::yy_get_next_buffer()
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{ {
yy_current_state = (int) yy_def[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_c = yy_meta[(unsigned int) yy_c];
} }
yy_current_state = yy_nxt[yy_base[yy_current_state] + (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 ) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{ {
yy_current_state = (int) yy_def[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_c = yy_meta[(unsigned int) yy_c];
} }
yy_current_state = yy_nxt[yy_base[yy_current_state] + (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; return yy_is_jam ? 0 : yy_current_state;
} }
@@ -1865,7 +1871,7 @@ void EasyMeshfree (void * ptr )


#define YYTABLES_NAME "yytables" #define YYTABLES_NAME "yytables"


#line 123 "easymesh/easymesh-scanner.l"
#line 124 "easymesh/easymesh-scanner.l"








+ 2
- 2
src/generated/location.hh View File

@@ -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++ /* 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 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 it under the terms of the GNU General Public License as published by


+ 176
- 77
src/generated/lolfx-parser.cpp View File

@@ -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++ /* 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 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 it under the terms of the GNU General Public License as published by
@@ -35,7 +35,7 @@


/* First part of user declarations. */ /* First part of user declarations. */


/* Line 310 of lalr1.cc */
/* Line 293 of lalr1.cc */
#line 1 "gpu/lolfx-parser.y" #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" #line 63 "generated/lolfx-parser.cpp"




@@ -66,7 +66,7 @@


/* User implementation prologue. */ /* User implementation prologue. */


/* Line 316 of lalr1.cc */
/* Line 299 of lalr1.cc */
#line 241 "gpu/lolfx-parser.y" #line 241 "gpu/lolfx-parser.y"


#include "gpu/lolfx-compiler.h" #include "gpu/lolfx-compiler.h"
@@ -75,7 +75,7 @@
#define yylex mc.m_lexer->lex #define yylex mc.m_lexer->lex




/* Line 316 of lalr1.cc */
/* Line 299 of lalr1.cc */
#line 80 "generated/lolfx-parser.cpp" #line 80 "generated/lolfx-parser.cpp"


#ifndef YY_ #ifndef YY_
@@ -90,6 +90,26 @@
# endif # endif
#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. */ /* Suppress unused-variable warnings by "using" E. */
#define YYUSE(e) ((void) (e)) #define YYUSE(e) ((void) (e))


@@ -141,9 +161,8 @@ do { \


namespace lol { 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 /* Return YYSTR after stripping away unnecessary quotes and
backslashes, so that it's suitable for yyerror. The heuristic is backslashes, so that it's suitable for yyerror. The heuristic is
@@ -182,7 +201,6 @@ namespace lol {
return yystr; return yystr;
} }


#endif


/// Build a parser object. /// Build a parser object.
LolFxParser::LolFxParser (class LolFxCompiler& mc_yyarg) LolFxParser::LolFxParser (class LolFxCompiler& mc_yyarg)
@@ -283,6 +301,18 @@ namespace lol {
} }
#endif #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 int
LolFxParser::parse () LolFxParser::parse ()
{ {
@@ -304,7 +334,7 @@ namespace lol {
/// Location of the lookahead. /// Location of the lookahead.
location_type yylloc; location_type yylloc;
/// The locations where the error started and ended. /// The locations where the error started and ended.
location_type yyerror_range[2];
location_type yyerror_range[3];


/// $$. /// $$.
semantic_type yyval; semantic_type yyval;
@@ -342,7 +372,7 @@ namespace lol {


/* Try to take a decision without lookahead. */ /* Try to take a decision without lookahead. */
yyn = yypact_[yystate]; yyn = yypact_[yystate];
if (yyn == yypact_ninf_)
if (yy_pact_value_is_default_ (yyn))
goto yydefault; goto yydefault;


/* Read a lookahead token. */ /* Read a lookahead token. */
@@ -375,8 +405,8 @@ namespace lol {
yyn = yytable_[yyn]; yyn = yytable_[yyn];
if (yyn <= 0) if (yyn <= 0)
{ {
if (yyn == 0 || yyn == yytable_ninf_)
goto yyerrlab;
if (yy_table_value_is_error_ (yyn))
goto yyerrlab;
yyn = -yyn; yyn = -yyn;
goto yyreduce; goto yyreduce;
} }
@@ -432,46 +462,57 @@ namespace lol {
{ {
case 202: case 202:


/* Line 677 of lalr1.cc */
/* Line 690 of lalr1.cc */
#line 728 "gpu/lolfx-parser.y" #line 728 "gpu/lolfx-parser.y"
{ std::cout << "New tech " << std::endl; } { std::cout << "New tech " << std::endl; }
break; break;


case 203: case 203:


/* Line 677 of lalr1.cc */
/* Line 690 of lalr1.cc */
#line 736 "gpu/lolfx-parser.y" #line 736 "gpu/lolfx-parser.y"
{ std::cout << "New name " << (yysemantic_stack_[(1) - (1)].sval) << std::endl; } { std::cout << "New name " << (yysemantic_stack_[(1) - (1)].sval) << std::endl; }
break; break;


case 204: case 204:


/* Line 677 of lalr1.cc */
/* Line 690 of lalr1.cc */
#line 737 "gpu/lolfx-parser.y" #line 737 "gpu/lolfx-parser.y"
{ std::cout << "New name " << (yysemantic_stack_[(1) - (1)].sval) << std::endl; } { std::cout << "New name " << (yysemantic_stack_[(1) - (1)].sval) << std::endl; }
break; break;


case 207: case 207:


/* Line 677 of lalr1.cc */
/* Line 690 of lalr1.cc */
#line 750 "gpu/lolfx-parser.y" #line 750 "gpu/lolfx-parser.y"
{ std::cout << "New pass " << std::endl; } { std::cout << "New pass " << std::endl; }
break; break;


case 226: case 226:


/* Line 677 of lalr1.cc */
/* Line 690 of lalr1.cc */
#line 786 "gpu/lolfx-parser.y" #line 786 "gpu/lolfx-parser.y"
{ std::cout << "new shader" << std::endl; } { std::cout << "new shader" << std::endl; }
break; break;






/* Line 677 of lalr1.cc */
#line 472 "generated/lolfx-parser.cpp"
/* Line 690 of lalr1.cc */
#line 502 "generated/lolfx-parser.cpp"
default: default:
break; 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); YY_SYMBOL_PRINT ("-> $$ =", yyr1_[yyn], &yyval, &yyloc);


yypop_ (yylen); yypop_ (yylen);
@@ -495,14 +536,20 @@ namespace lol {
| yyerrlab -- here on detecting error | | yyerrlab -- here on detecting error |
`------------------------------------*/ `------------------------------------*/
yyerrlab: 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 not already recovering from an error, report this error. */
if (!yyerrstatus_) if (!yyerrstatus_)
{ {
++yynerrs_; ++yynerrs_;
if (yychar == yyempty_)
yytoken = yyempty_;
error (yylloc, yysyntax_error_ (yystate, yytoken)); error (yylloc, yysyntax_error_ (yystate, yytoken));
} }


yyerror_range[0] = yylloc;
yyerror_range[1] = yylloc;
if (yyerrstatus_ == 3) if (yyerrstatus_ == 3)
{ {
/* If just tried and failed to reuse lookahead token after an /* If just tried and failed to reuse lookahead token after an
@@ -537,7 +584,7 @@ namespace lol {
if (false) if (false)
goto yyerrorlab; 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 /* Do not reclaim the symbols of the rule which action triggered
this YYERROR. */ this YYERROR. */
yypop_ (yylen); yypop_ (yylen);
@@ -554,7 +601,7 @@ namespace lol {
for (;;) for (;;)
{ {
yyn = yypact_[yystate]; yyn = yypact_[yystate];
if (yyn != yypact_ninf_)
if (!yy_pact_value_is_default_ (yyn))
{ {
yyn += yyterror_; yyn += yyterror_;
if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == yyterror_) if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == yyterror_)
@@ -569,7 +616,7 @@ namespace lol {
if (yystate_stack_.height () == 1) if (yystate_stack_.height () == 1)
YYABORT; YYABORT;


yyerror_range[0] = yylocation_stack_[0];
yyerror_range[1] = yylocation_stack_[0];
yydestruct_ ("Error: popping", yydestruct_ ("Error: popping",
yystos_[yystate], yystos_[yystate],
&yysemantic_stack_[0], &yylocation_stack_[0]); &yysemantic_stack_[0], &yylocation_stack_[0]);
@@ -578,10 +625,10 @@ namespace lol {
YY_STACK_PRINT (); YY_STACK_PRINT ();
} }


yyerror_range[1] = yylloc;
yyerror_range[2] = yylloc;
// Using YYLLOC is tempting, but would change the location of // Using YYLLOC is tempting, but would change the location of
// the lookahead. YYLOC is available though. // the lookahead. YYLOC is available though.
YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2);
YYLLOC_DEFAULT (yyloc, yyerror_range, 2);
yysemantic_stack_.push (yylval); yysemantic_stack_.push (yylval);
yylocation_stack_.push (yyloc); yylocation_stack_.push (yyloc);


@@ -604,7 +651,13 @@ namespace lol {


yyreturn: yyreturn:
if (yychar != yyempty_) 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 /* Do not reclaim the symbols of the rule which action triggered
this YYABORT or YYACCEPT. */ this YYABORT or YYACCEPT. */
@@ -623,51 +676,97 @@ namespace lol {


// Generate an error message. // Generate an error message.
std::string 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 -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 const unsigned short int
LolFxParser::yydefact_[] = LolFxParser::yydefact_[] =
{ {
@@ -855,7 +954,7 @@ namespace lol {


/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
positive, shift that token. If negative, reduce the rule which 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_ninf_ = -323;
const short int const short int
LolFxParser::yytable_[] = LolFxParser::yytable_[] =
@@ -3791,11 +3890,11 @@ namespace lol {


} // 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" #line 1298 "gpu/lolfx-parser.y"






+ 19
- 46
src/generated/lolfx-parser.h View File

@@ -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++ /* 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 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 it under the terms of the GNU General Public License as published by
@@ -40,20 +40,6 @@
#include <string> #include <string>
#include <iostream> #include <iostream>
#include "stack.hh" #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" #include "location.hh"


/* Enabling traces. */ /* Enabling traces. */
@@ -74,30 +60,11 @@ namespace lol {
# define YYTOKEN_TABLE 0 # define YYTOKEN_TABLE 0
#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). */

#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 { 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. /// A Bison parser.
class LolFxParser class LolFxParser
@@ -108,7 +75,7 @@ namespace lol {
union semantic_type union semantic_type
{ {


/* Line 34 of lalr1.cc */
/* Line 35 of lalr1.cc */
#line 34 "gpu/lolfx-parser.y" #line 34 "gpu/lolfx-parser.y"


int ival; 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 #else
typedef YYSTYPE semantic_type; typedef YYSTYPE semantic_type;
@@ -640,6 +607,14 @@ namespace lol {
/// The location stack. /// The location stack.
location_stack_type yylocation_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. /// Internal symbol numbers.
typedef unsigned short int token_number_type; typedef unsigned short int token_number_type;
/* Tables. */ /* Tables. */
@@ -647,7 +622,7 @@ namespace lol {
static const short int yypact_[]; static const short int yypact_[];
static const short int yypact_ninf_; 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. /// Unless\a yytable_ specifies something else to do.
/// Zero means the default is an error. /// Zero means the default is an error.
static const unsigned short int yydefact_[]; static const unsigned short int yydefact_[];
@@ -678,10 +653,8 @@ namespace lol {
static const char* const yytname_[]; static const char* const yytname_[];
#endif #endif


#if YYERROR_VERBOSE
/// Convert the symbol name \a n to a form suitable for a diagnostic. /// 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 #if YYDEBUG
/// A type to store symbol numbers and -1. /// A type to store symbol numbers and -1.
@@ -739,8 +712,8 @@ namespace lol {


} // lol } // lol


/* Line 34 of lalr1.cc */
#line 744 "generated/lolfx-parser.h"
/* Line 35 of lalr1.cc */
#line 717 "generated/lolfx-parser.h"








+ 2
- 2
src/generated/position.hh View File

@@ -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++ /* 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 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 it under the terms of the GNU General Public License as published by


+ 4
- 4
src/generated/stack.hh View File

@@ -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++ /* 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 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 it under the terms of the GNU General Public License as published by
@@ -38,7 +38,7 @@


namespace lol { namespace lol {


/* Line 1066 of lalr1.cc */
/* Line 1149 of lalr1.cc */
#line 43 "generated/stack.hh" #line 43 "generated/stack.hh"
template <class T, class S = std::deque<T> > template <class T, class S = std::deque<T> >
class stack class stack
@@ -128,7 +128,7 @@ namespace lol {


} // lol } // lol


/* Line 1152 of lalr1.cc */
/* Line 1235 of lalr1.cc */
#line 133 "generated/stack.hh" #line 133 "generated/stack.hh"


#endif // not BISON_STACK_HH[]dnl #endif // not BISON_STACK_HH[]dnl


+ 5
- 7
src/lol/math/vector.h View File

@@ -19,9 +19,9 @@
#include <stdint.h> #include <stdint.h>
#include <ostream> #include <ostream>


#include "lol/math/math.h"
#include "lol/math/half.h"
#include "lol/math/real.h"
#include <lol/math/math.h>
#include <lol/math/half.h>
#include <lol/math/real.h>


namespace lol 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(float)
LOL_ALL_VECTOR_OPS_AND_FUNS(double) LOL_ALL_VECTOR_OPS_AND_FUNS(double)
LOL_ALL_VECTOR_OPS_AND_FUNS(ldouble) 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(int8_t)
LOL_ALL_VECTOR_OPS_AND_FUNS(uint8_t) LOL_ALL_VECTOR_OPS_AND_FUNS(uint8_t)
LOL_ALL_VECTOR_OPS_AND_FUNS(int16_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(int64_t)
LOL_ALL_VECTOR_OPS_AND_FUNS(uint64_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 #if defined _MSC_VER
# pragma warning(pop) # pragma warning(pop)
#endif #endif


Loading…
Cancel
Save