Browse Source

build: remove the LolFx and the EasyMesh compilers for now.

undefined
Sam Hocevar 10 years ago
parent
commit
31477c906e
24 changed files with 9 additions and 15666 deletions
  1. +1
    -25
      build/autotools/common.am
  2. +1
    -0
      doc/grammar/README
  3. +0
    -0
      doc/grammar/easymesh-parser.y
  4. +0
    -0
      doc/grammar/easymesh-scanner.l
  5. +0
    -0
      doc/grammar/lolfx-parser.y
  6. +0
    -0
      doc/grammar/lolfx-scanner.l
  7. +1
    -10
      src/Makefile.am
  8. +0
    -52
      src/easymesh/easymesh-compiler.cpp
  9. +0
    -58
      src/easymesh/easymesh-compiler.h
  10. +3
    -2
      src/easymesh/easymesh.cpp
  11. +0
    -2250
      src/generated/easymesh-parser.cpp
  12. +0
    -388
      src/generated/easymesh-parser.h
  13. +0
    -2276
      src/generated/easymesh-scanner.cpp
  14. +0
    -164
      src/generated/location.hh
  15. +0
    -3906
      src/generated/lolfx-parser.cpp
  16. +0
    -747
      src/generated/lolfx-parser.h
  17. +0
    -5301
      src/generated/lolfx-scanner.cpp
  18. +0
    -161
      src/generated/position.hh
  19. +0
    -135
      src/generated/stack.hh
  20. +0
    -48
      src/gpu/lolfx-compiler.cpp
  21. +0
    -68
      src/gpu/lolfx-compiler.h
  22. +3
    -4
      src/gpu/lolfx.cpp
  23. +0
    -17
      src/lolcore.vcxproj
  24. +0
    -54
      src/lolcore.vcxproj.filters

+ 1
- 25
build/autotools/common.am View File

@@ -27,30 +27,6 @@ lolcheck-recursive:
$(lol_recursive_rule) $(lol_recursive_rule)




#
# Flex and Bison files build rule
#

generated: generated-recursive
generated-recursive:
$(lol_recursive_rule)
@if test -n "$(filter %-scanner.l, $(EXTRA_DIST))"; then \
echo $(MKDIR_P) generated; \
$(MKDIR_P) generated; \
rm -f generated/[a-zA-Z]*; \
for scanner in $(patsubst %-scanner.l, %, $(filter %-scanner.l, $(EXTRA_DIST))); do \
b="`basename $$scanner`"; \
echo flex -v -o "generated/$$b-scanner.cpp" "$$scanner-scanner.l"; \
flex -v -o "generated/$$b-scanner.cpp" "$$scanner-scanner.l" || exit 1; \
done; \
for parser in $(patsubst %-parser.y, %, $(filter %-parser.y, $(EXTRA_DIST))); do \
b="`basename $$parser`"; \
echo bison -o "generated/$$b-parser.cpp" --defines="generated/$$b-parser.h" -d -b "generated/$$b" "$$parser-parser.y"; \
bison -o "generated/$$b-parser.cpp" --defines="generated/$$b-parser.h" -d -b "generated/$$b" "$$parser-parser.y" || exit 1; \
done; \
fi


# #
# .lolfx build rule # .lolfx build rule
# #
@@ -134,5 +110,5 @@ clean-local-android:
EXTRA_DIST += $(foreach p, $(PROGRAMS), $($(p)_DATA)) EXTRA_DIST += $(foreach p, $(PROGRAMS), $($(p)_DATA))




.PHONY: bench lolcheck generated
.PHONY: bench lolcheck



+ 1
- 0
doc/grammar/README View File

@@ -0,0 +1 @@
This directory contains old grammars for languages we used to parse.

src/easymesh/easymesh-parser.y → doc/grammar/easymesh-parser.y View File


src/easymesh/easymesh-scanner.l → doc/grammar/easymesh-scanner.l View File


src/gpu/lolfx-parser.y → doc/grammar/lolfx-parser.y View File


src/gpu/lolfx-scanner.l → doc/grammar/lolfx-scanner.l View File


+ 1
- 10
src/Makefile.am View File

@@ -28,8 +28,7 @@ liblolcore_a_SOURCES = \
#liblolcore_a_CPPFLAGS = -include-pch $(srcdir)/lol/engine-internal.h.pch $(AM_CPPFLAGS) -I$(srcdir)/bullet -I$(srcdir)/lua #liblolcore_a_CPPFLAGS = -include-pch $(srcdir)/lol/engine-internal.h.pch $(AM_CPPFLAGS) -I$(srcdir)/bullet -I$(srcdir)/lua
liblolcore_a_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/bullet -I$(srcdir)/lua liblolcore_a_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/bullet -I$(srcdir)/lua


EXTRA_DIST += easymesh/easymesh-scanner.l easymesh/easymesh-parser.y \
gpu/lolfx-scanner.l gpu/lolfx-parser.y
EXTRA_DIST += easymesh/easymesh-scanner.l easymesh/easymesh-parser.y


liblolcore_headers = \ liblolcore_headers = \
lol/engine-internal.h lol/engine.h lol/public.h lol/extras.h \ lol/engine-internal.h lol/engine.h lol/public.h lol/extras.h \
@@ -65,8 +64,6 @@ liblolcore_headers = \
lol/debug/lines.h lol/debug/lines.h


liblolcore_sources = \ liblolcore_sources = \
generated/location.hh generated/position.hh generated/stack.hh \
\
application/application.cpp application/application.h \ application/application.cpp application/application.h \
eglapp.cpp eglapp.h \ eglapp.cpp eglapp.h \
\ \
@@ -79,9 +76,6 @@ liblolcore_sources = \
easymesh/shinydebugwireframe.lolfx \ easymesh/shinydebugwireframe.lolfx \
easymesh/shinydebuglighting.lolfx easymesh/shinydebugnormal.lolfx \ easymesh/shinydebuglighting.lolfx easymesh/shinydebugnormal.lolfx \
easymesh/shinydebugUV.lolfx easymesh/shiny_SK.lolfx \ easymesh/shinydebugUV.lolfx easymesh/shiny_SK.lolfx \
easymesh/easymesh-compiler.cpp easymesh/easymesh-compiler.h \
generated/easymesh-parser.cpp generated/easymesh-parser.h \
generated/easymesh-scanner.cpp \
\ \
base/assert.cpp base/hash.cpp base/log.cpp base/string.cpp \ base/assert.cpp base/hash.cpp base/log.cpp base/string.cpp \
base/enum.cpp \ base/enum.cpp \
@@ -102,9 +96,6 @@ liblolcore_sources = \
gpu/testmaterial.lolfx \ gpu/testmaterial.lolfx \
\ \
gpu/lolfx.cpp \ gpu/lolfx.cpp \
gpu/lolfx-compiler.cpp gpu/lolfx-compiler.h \
generated/lolfx-parser.cpp generated/lolfx-parser.h \
generated/lolfx-scanner.cpp \
\ \
mesh/mesh.cpp mesh/mesh.h \ mesh/mesh.cpp mesh/mesh.h \
mesh/primitive.cpp mesh/primitive.h \ mesh/primitive.cpp mesh/primitive.h \


+ 0
- 52
src/easymesh/easymesh-compiler.cpp View File

@@ -1,52 +0,0 @@
//
// Lol Engine
//
// Copyright: (c) 2010-2013 Sam Hocevar <sam@hocevar.net>
// (c) 2009-2013 Cédric Lecacheur <jordx@free.fr>
// (c) 2009-2013 Benjamin "Touky" Huet <huet.benjamin@gmail.com>
// This program is free software; you can redistribute it and/or
// modify it under the terms of the Do What The Fuck You Want To
// Public License, Version 2, as published by Sam Hocevar. See
// http://www.wtfpl.net/ for more details.
//

#include <lol/engine-internal.h>

#include <string>

#include "easymesh/easymesh-compiler.h"

namespace lol
{

EasyMeshCompiler::EasyMeshCompiler(EasyMesh &mesh)
: m_mesh(mesh)
{
}

bool EasyMeshCompiler::ParseString(char const *command)
{
EasyMeshScanner scanner(command);
m_lexer = &scanner;
EasyMeshParser parser(*this);
if (parser.parse() != 0)
{
Log::Debug("Mesh source: %s\n", command);
return false;
}
return true;
}

void EasyMeshCompiler::Error(const class location& l, const std::string& m)
{
Log::Error("EasyMesh syntax error line %d column %d: %s\n",
l.begin.line, l.begin.column, m.c_str());
}

void EasyMeshCompiler::Error(const std::string& m)
{
Log::Error("EasyMesh syntax error: %s\n", m.c_str());
}

} /* namespace lol */


+ 0
- 58
src/easymesh/easymesh-compiler.h View File

@@ -1,58 +0,0 @@
//
// Lol Engine
//
// Copyright: (c) 2010-2013 Sam Hocevar <sam@hocevar.net>
// (c) 2009-2013 Cédric Lecacheur <jordx@free.fr>
// (c) 2009-2013 Benjamin "Touky" Huet <huet.benjamin@gmail.com>
// This program is free software; you can redistribute it and/or
// modify it under the terms of the Do What The Fuck You Want To
// Public License, Version 2, as published by Sam Hocevar. See
// http://www.wtfpl.net/ for more details.
//

#pragma once

#include <string>

#ifndef __FLEX_LEXER_H
# define yyFlexLexer EasyMeshFlexLexer
# include "FlexLexer.h"
# undef yyFlexLexer
#endif

#include "generated/easymesh-parser.h"

class EasyMesh;

namespace lol
{

class EasyMeshScanner : public EasyMeshFlexLexer
{
public:
EasyMeshScanner(char const *command);
virtual ~EasyMeshScanner();
virtual int LexerInput(char* buf, int max_size);
virtual EasyMeshParser::token_type lex(EasyMeshParser::semantic_type* yylval,
EasyMeshParser::location_type* yylloc);

private:
char const *m_input;
};

class EasyMeshCompiler
{
public:
EasyMeshCompiler(class EasyMesh &mesh);

bool ParseString(char const *command);

void Error(const class location& l, const std::string& m);
void Error(const std::string& m);

class EasyMeshScanner* m_lexer;
class EasyMesh &m_mesh;
};

} /* namespace lol */


+ 3
- 2
src/easymesh/easymesh.cpp View File

@@ -17,8 +17,6 @@


#include <lol/engine-internal.h> #include <lol/engine-internal.h>


#include "easymesh/easymesh-compiler.h"

LOLFX_RESOURCE_DECLARE(shiny); LOLFX_RESOURCE_DECLARE(shiny);


namespace lol namespace lol
@@ -51,6 +49,8 @@ EasyMesh::EasyMesh(const EasyMesh& em)
bool EasyMesh::Compile(char const *command, bool Execute) bool EasyMesh::Compile(char const *command, bool Execute)
{ {
bool res = false; bool res = false;
// FIXME: make this work again
#if 0
EasyMeshCompiler mc(*this); EasyMeshCompiler mc(*this);
BD()->Enable(MeshBuildOperation::CommandRecording); BD()->Enable(MeshBuildOperation::CommandRecording);
if ((res = mc.ParseString(command))) if ((res = mc.ParseString(command)))
@@ -59,6 +59,7 @@ bool EasyMesh::Compile(char const *command, bool Execute)
if (Execute) if (Execute)
ExecuteCmdStack(); ExecuteCmdStack();
} }
#endif
return res; return res;
} }




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


+ 0
- 388
src/generated/easymesh-parser.h View File

@@ -1,388 +0,0 @@
/* A Bison parser, made by GNU Bison 2.4.2. */

/* Skeleton interface for Bison LALR(1) parsers in C++
Copyright (C) 2002-2010 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */

/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
under terms of your choice, so long as that work isn't itself a
parser generator using the skeleton or a modified version thereof
as a parser skeleton. Alternatively, if you modify or redistribute
the parser skeleton itself, you may (at your option) remove this
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */

/* C++ LALR(1) parser skeleton written by Akim Demaille. */

#ifndef PARSER_HEADER_H
# define PARSER_HEADER_H



#include <string>
#include <iostream>
#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. */
#ifndef YYDEBUG
# define YYDEBUG 1
#endif

/* Enabling verbose error messages. */
#ifdef YYERROR_VERBOSE
# undef YYERROR_VERBOSE
# define YYERROR_VERBOSE 1
#else
# define YYERROR_VERBOSE 1
#endif

/* Enabling the token table. */
#ifndef YYTOKEN_TABLE
# 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"

/// A Bison parser.
class EasyMeshParser
{
public:
/// Symbol semantic values.
#ifndef YYSTYPE
union semantic_type
{

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

float fval;
int ival;
bool bval;
float vval[4];
int ivval[4];
char* lval;
/* Can't use uin32_t here for some reason */
unsigned u32val;



/* Line 34 of lalr1.cc */
#line 127 "generated/easymesh-parser.h"
};
#else
typedef YYSTYPE semantic_type;
#endif
/// Symbol locations.
typedef location location_type;
/// Tokens.
struct token
{
/* Tokens. */
enum yytokentype {
T_END = 0,
T_LOOP = 258,
T_COLOR = 259,
T_ACOLOR = 260,
T_BCOLOR = 261,
T_VCOLOR = 262,
T_TOGGLESCALEWINDING = 263,
T_TOGGLEQUADWEIGHTING = 264,
T_TOGGLEPOSTBUILDNORMAL = 265,
T_TOGGLEVERTNOCLEANUP = 266,
T_VERTMERGE = 267,
T_VERTSEPARATE = 268,
T_TRANSLATEX = 269,
T_ROTATEX = 270,
T_TAPERX = 271,
T_TWISTX = 272,
T_SHEARX = 273,
T_STRETCHX = 274,
T_BENDXY = 275,
T_BENDXZ = 276,
T_SCALEX = 277,
T_MIRRORX = 278,
T_TRANSLATEY = 279,
T_ROTATEY = 280,
T_TAPERY = 281,
T_TWISTY = 282,
T_SHEARY = 283,
T_STRETCHY = 284,
T_BENDYX = 285,
T_BENDYZ = 286,
T_SCALEY = 287,
T_MIRRORY = 288,
T_TRANSLATEZ = 289,
T_ROTATEZ = 290,
T_TAPERZ = 291,
T_TWISTZ = 292,
T_SHEARZ = 293,
T_STRETCHZ = 294,
T_BENDZX = 295,
T_BENDZY = 296,
T_SCALEZ = 297,
T_MIRRORZ = 298,
T_TRANSLATE = 299,
T_ROTATE = 300,
T_SCALE = 301,
T_RADIALJITTER = 302,
T_SPLITTRIANGLE = 303,
T_SMOOTHMESH = 304,
T_DUPLICATE = 305,
T_CSGUNION = 306,
T_CSGSUBSTRACT = 307,
T_CSGSUBSTRACTLOSS = 308,
T_CSGAND = 309,
T_CSGXOR = 310,
T_CHAMFER = 311,
T_CYLINDER = 312,
T_BOX = 313,
T_SMOOTHCHAMFBOX = 314,
T_FLATCHAMFBOX = 315,
T_SPHERE = 316,
T_CAPSULE = 317,
T_STAR = 318,
T_EXPANDEDSTAR = 319,
T_DISC = 320,
T_TRIANGLE = 321,
T_QUAD = 322,
T_COG = 323,
T_TORUS = 324,
T_ERROR = 325,
F_NUMBER = 326,
I_NUMBER = 327,
BOOLEAN = 328,
COLOR = 329
};

};
/// Token type.
typedef token::yytokentype token_type;

/// Build a parser object.
EasyMeshParser (class EasyMeshCompiler& mc_yyarg);
virtual ~EasyMeshParser ();

/// Parse.
/// \returns 0 iff parsing succeeded.
virtual int parse ();

#if YYDEBUG
/// The current debugging stream.
std::ostream& debug_stream () const;
/// Set the current debugging stream.
void set_debug_stream (std::ostream &);

/// Type for debugging levels.
typedef int debug_level_type;
/// The current debugging level.
debug_level_type debug_level () const;
/// Set the current debugging level.
void set_debug_level (debug_level_type l);
#endif

private:
/// Report a syntax error.
/// \param loc where the syntax error is found.
/// \param msg a description of the syntax error.
virtual void error (const location_type& loc, const std::string& msg);

/// Generate an error message.
/// \param state the state where the error occurred.
/// \param tok the lookahead token.
virtual std::string yysyntax_error_ (int yystate, int tok);

#if YYDEBUG
/// \brief Report a symbol value on the debug stream.
/// \param yytype The token type.
/// \param yyvaluep Its semantic value.
/// \param yylocationp Its location.
virtual void yy_symbol_value_print_ (int yytype,
const semantic_type* yyvaluep,
const location_type* yylocationp);
/// \brief Report a symbol on the debug stream.
/// \param yytype The token type.
/// \param yyvaluep Its semantic value.
/// \param yylocationp Its location.
virtual void yy_symbol_print_ (int yytype,
const semantic_type* yyvaluep,
const location_type* yylocationp);
#endif


/// State numbers.
typedef int state_type;
/// State stack type.
typedef stack<state_type> state_stack_type;
/// Semantic value stack type.
typedef stack<semantic_type> semantic_stack_type;
/// location stack type.
typedef stack<location_type> location_stack_type;

/// The state stack.
state_stack_type yystate_stack_;
/// The semantic value stack.
semantic_stack_type yysemantic_stack_;
/// The location stack.
location_stack_type yylocation_stack_;

/// Internal symbol numbers.
typedef unsigned char token_number_type;
/* Tables. */
/// For a state, the index in \a yytable_ of its portion.
static const short int yypact_[];
static const short int yypact_ninf_;

/// For a state, default rule to reduce.
/// Unless\a yytable_ specifies something else to do.
/// Zero means the default is an error.
static const unsigned char yydefact_[];

static const short int yypgoto_[];
static const short int yydefgoto_[];

/// What to do in a state.
/// \a yytable_[yypact_[s]]: what to do in state \a s.
/// - if positive, shift that token.
/// - if negative, reduce the rule which number is the opposite.
/// - if zero, do what YYDEFACT says.
static const unsigned short int yytable_[];
static const signed char yytable_ninf_;

static const short int yycheck_[];

/// For a state, its accessing symbol.
static const unsigned char yystos_[];

/// For a rule, its LHS.
static const unsigned char yyr1_[];
/// For a rule, its RHS length.
static const unsigned char yyr2_[];

#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
/// For a symbol, its name in clear.
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

#if YYDEBUG
/// A type to store symbol numbers and -1.
typedef signed char rhs_number_type;
/// A `-1'-separated list of the rules' RHS.
static const rhs_number_type yyrhs_[];
/// For each rule, the index of the first RHS symbol in \a yyrhs_.
static const unsigned short int yyprhs_[];
/// For each rule, its source line number.
static const unsigned short int yyrline_[];
/// For each scanner token number, its symbol number.
static const unsigned short int yytoken_number_[];
/// Report on the debug stream that the rule \a r is going to be reduced.
virtual void yy_reduce_print_ (int r);
/// Print the state stack on the debug stream.
virtual void yystack_print_ ();

/* Debugging. */
int yydebug_;
std::ostream* yycdebug_;
#endif

/// Convert a scanner token number \a t to a symbol number.
token_number_type yytranslate_ (int t);

/// \brief Reclaim the memory associated to a symbol.
/// \param yymsg Why this token is reclaimed.
/// \param yytype The symbol type.
/// \param yyvaluep Its semantic value.
/// \param yylocationp Its location.
inline void yydestruct_ (const char* yymsg,
int yytype,
semantic_type* yyvaluep,
location_type* yylocationp);

/// Pop \a n symbols the three stacks.
inline void yypop_ (unsigned int n = 1);

/* Constants. */
static const int yyeof_;
/* LAST_ -- Last index in TABLE_. */
static const int yylast_;
static const int yynnts_;
static const int yyempty_;
static const int yyfinal_;
static const int yyterror_;
static const int yyerrcode_;
static const int yyntokens_;
static const unsigned int yyuser_token_number_max_;
static const token_number_type yyundef_token_;

/* User arguments. */
class EasyMeshCompiler& mc;
};

} // lol

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



#endif /* ! defined PARSER_HEADER_H */

+ 0
- 2276
src/generated/easymesh-scanner.cpp
File diff suppressed because it is too large
View File


+ 0
- 164
src/generated/location.hh View File

@@ -1,164 +0,0 @@
/* A Bison parser, made by GNU Bison 2.4.2. */

/* Locations for Bison parsers in C++
Copyright (C) 2002-2007, 2009-2010 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */

/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
under terms of your choice, so long as that work isn't itself a
parser generator using the skeleton or a modified version thereof
as a parser skeleton. Alternatively, if you modify or redistribute
the parser skeleton itself, you may (at your option) remove this
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */

/**
** \file location.hh
** Define the lol::location class.
*/

#ifndef BISON_LOCATION_HH
# define BISON_LOCATION_HH

# include <iostream>
# include <string>
# include "position.hh"


namespace lol {

/* Line 162 of location.cc */
#line 50 "generated/location.hh"

/// Abstract a location.
class location
{
public:

/// Construct a location.
location ()
: begin (), end ()
{
}


/// Initialization.
inline void initialize (std::string* fn)
{
begin.initialize (fn);
end = begin;
}

/** \name Line and Column related manipulators
** \{ */
public:
/// Reset initial location to final location.
inline void step ()
{
begin = end;
}

/// Extend the current location to the COUNT next columns.
inline void columns (unsigned int count = 1)
{
end += count;
}

/// Extend the current location to the COUNT next lines.
inline void lines (unsigned int count = 1)
{
end.lines (count);
}
/** \} */


public:
/// Beginning of the located region.
position begin;
/// End of the located region.
position end;
};

/// Join two location objects to create a location.
inline const location operator+ (const location& begin, const location& end)
{
location res = begin;
res.end = end.end;
return res;
}

/// Add two location objects.
inline const location operator+ (const location& begin, unsigned int width)
{
location res = begin;
res.columns (width);
return res;
}

/// Add and assign a location.
inline location& operator+= (location& res, unsigned int width)
{
res.columns (width);
return res;
}

/// Compare two location objects.
inline bool
operator== (const location& loc1, const location& loc2)
{
return loc1.begin == loc2.begin && loc1.end == loc2.end;
}

/// Compare two location objects.
inline bool
operator!= (const location& loc1, const location& loc2)
{
return !(loc1 == loc2);
}

/** \brief Intercept output stream redirection.
** \param ostr the destination output stream
** \param loc a reference to the location to redirect
**
** Avoid duplicate information.
*/
inline std::ostream& operator<< (std::ostream& ostr, const location& loc)
{
position last = loc.end - 1;
ostr << loc.begin;
if (last.filename
&& (!loc.begin.filename
|| *loc.begin.filename != *last.filename))
ostr << '-' << last;
else if (loc.begin.line != last.line)
ostr << '-' << last.line << '.' << last.column;
else if (loc.begin.column != last.column)
ostr << '-' << last.column;
return ostr;
}


} // lol

/* Line 271 of location.cc */
#line 163 "generated/location.hh"

#endif // not BISON_LOCATION_HH

+ 0
- 3906
src/generated/lolfx-parser.cpp
File diff suppressed because it is too large
View File


+ 0
- 747
src/generated/lolfx-parser.h View File

@@ -1,747 +0,0 @@
/* A Bison parser, made by GNU Bison 2.4.2. */

/* Skeleton interface for Bison LALR(1) parsers in C++
Copyright (C) 2002-2010 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */

/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
under terms of your choice, so long as that work isn't itself a
parser generator using the skeleton or a modified version thereof
as a parser skeleton. Alternatively, if you modify or redistribute
the parser skeleton itself, you may (at your option) remove this
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */

/* C++ LALR(1) parser skeleton written by Akim Demaille. */

#ifndef PARSER_HEADER_H
# define PARSER_HEADER_H



#include <string>
#include <iostream>
#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. */
#ifndef YYDEBUG
# define YYDEBUG 1
#endif

/* Enabling verbose error messages. */
#ifdef YYERROR_VERBOSE
# undef YYERROR_VERBOSE
# define YYERROR_VERBOSE 1
#else
# define YYERROR_VERBOSE 1
#endif

/* Enabling the token table. */
#ifndef YYTOKEN_TABLE
# 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"

/// A Bison parser.
class LolFxParser
{
public:
/// Symbol semantic values.
#ifndef YYSTYPE
union semantic_type
{

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

int ival;
unsigned uval;
float fval;
char *sval;



/* Line 34 of lalr1.cc */
#line 123 "generated/lolfx-parser.h"
};
#else
typedef YYSTYPE semantic_type;
#endif
/// Symbol locations.
typedef location location_type;
/// Tokens.
struct token
{
/* Tokens. */
enum yytokentype {
T_END = 0,
BOOLCONSTANT = 258,
INTCONSTANT = 259,
UINTCONSTANT = 260,
FLOATCONSTANT = 261,
FIELDSELECTION = 262,
IDENTIFIER = 263,
TYPENAME = 264,
GT_SUBROUTINE = 265,
GT_PATCH = 266,
GT_SAMPLE = 267,
GT_FLAT = 268,
GT_SMOOTH = 269,
GT_LAYOUT = 270,
GT_INVARIANT = 271,
GT_HIGHP = 272,
GT_MEDIUMP = 273,
GT_LOWP = 274,
GT_PRECISION = 275,
GT_ATTRIBUTE = 276,
GT_VARYING = 277,
GT_VEC2 = 278,
GT_VEC3 = 279,
GT_VEC4 = 280,
GT_BVEC2 = 281,
GT_BVEC3 = 282,
GT_BVEC4 = 283,
GT_DVEC2 = 284,
GT_DVEC3 = 285,
GT_DVEC4 = 286,
GT_IVEC2 = 287,
GT_IVEC3 = 288,
GT_IVEC4 = 289,
GT_UVEC2 = 290,
GT_UVEC3 = 291,
GT_UVEC4 = 292,
GT_MAT2 = 293,
GT_MAT2X2 = 294,
GT_MAT2X3 = 295,
GT_MAT2X4 = 296,
GT_MAT3 = 297,
GT_MAT3X2 = 298,
GT_MAT3X3 = 299,
GT_MAT3X4 = 300,
GT_MAT4 = 301,
GT_MAT4X2 = 302,
GT_MAT4X3 = 303,
GT_MAT4X4 = 304,
GT_DMAT2 = 305,
GT_DMAT2X2 = 306,
GT_DMAT2X3 = 307,
GT_DMAT2X4 = 308,
GT_DMAT3 = 309,
GT_DMAT3X2 = 310,
GT_DMAT3X3 = 311,
GT_DMAT3X4 = 312,
GT_DMAT4 = 313,
GT_DMAT4X2 = 314,
GT_DMAT4X3 = 315,
GT_DMAT4X4 = 316,
GT_SAMPLER1DSHADOW = 317,
GT_SAMPLER1DARRAY = 318,
GT_SAMPLER1DARRAYSHADOW = 319,
GT_SAMPLER2DSHADOW = 320,
GT_SAMPLER2DARRAY = 321,
GT_SAMPLER2DARRAYSHADOW = 322,
GT_SAMPLER2DRECT = 323,
GT_SAMPLER2DRECTSHADOW = 324,
GT_SAMPLER2DMS = 325,
GT_SAMPLER2DMSARRAY = 326,
GT_SAMPLERCUBESHADOW = 327,
GT_SAMPLERCUBEARRAY = 328,
GT_SAMPLERCUBEARRAYSHADOW = 329,
GT_SAMPLERBUFFER = 330,
GT_ISAMPLER1D = 331,
GT_ISAMPLER1DARRAY = 332,
GT_ISAMPLER2D = 333,
GT_ISAMPLER2DARRAY = 334,
GT_ISAMPLER2DRECT = 335,
GT_ISAMPLER2DMS = 336,
GT_ISAMPLER2DMSARRAY = 337,
GT_ISAMPLER3D = 338,
GT_ISAMPLERCUBE = 339,
GT_ISAMPLERCUBEARRAY = 340,
GT_ISAMPLERBUFFER = 341,
GT_USAMPLER1D = 342,
GT_USAMPLER1DARRAY = 343,
GT_USAMPLER2D = 344,
GT_USAMPLER2DARRAY = 345,
GT_USAMPLER2DRECT = 346,
GT_USAMPLER2DMS = 347,
GT_USAMPLER2DMSARRAY = 348,
GT_USAMPLER3D = 349,
GT_USAMPLERCUBE = 350,
GT_USAMPLERCUBEARRAY = 351,
GT_USAMPLERBUFFER = 352,
GHT_BOOL = 353,
GHT_BREAK = 354,
GHT_CASE = 355,
GHT_CENTROID = 356,
GHT_CONST = 357,
GHT_CONTINUE = 358,
GHT_DEFAULT = 359,
GHT_DISCARD = 360,
GHT_DO = 361,
GHT_DOUBLE = 362,
GHT_ELSE = 363,
GHT_FLOAT = 364,
GHT_FOR = 365,
GHT_IF = 366,
GHT_IN = 367,
GHT_INOUT = 368,
GHT_INT = 369,
GHT_NOPERSPECTIVE = 370,
GHT_OUT = 371,
GHT_RETURN = 372,
GHT_SAMPLER1D = 373,
GHT_SAMPLER2D = 374,
GHT_SAMPLER3D = 375,
GHT_SAMPLERCUBE = 376,
GHT_STRUCT = 377,
GHT_SWITCH = 378,
GHT_UINT = 379,
GHT_UNIFORM = 380,
GHT_VOID = 381,
GHT_WHILE = 382,
HGT_BOOL = 383,
HGT_BREAK = 384,
HGT_CASE = 385,
HGT_CENTROID = 386,
HGT_CONST = 387,
HGT_CONTINUE = 388,
HGT_DEFAULT = 389,
HGT_DISCARD = 390,
HGT_DO = 391,
HGT_DOUBLE = 392,
HGT_ELSE = 393,
HGT_FLOAT = 394,
HGT_FOR = 395,
HGT_IF = 396,
HGT_IN = 397,
HGT_INOUT = 398,
HGT_INT = 399,
HGT_NOPERSPECTIVE = 400,
HGT_OUT = 401,
HGT_RETURN = 402,
HGT_SAMPLER1D = 403,
HGT_SAMPLER2D = 404,
HGT_SAMPLER3D = 405,
HGT_SAMPLERCUBE = 406,
HGT_STRUCT = 407,
HGT_SWITCH = 408,
HGT_UINT = 409,
HGT_UNIFORM = 410,
HGT_VOID = 411,
HGT_WHILE = 412,
HT_APPENDSTRUCTUREDBUFFER = 413,
HT_ASM = 414,
HT_ASM_FRAGMENT = 415,
HT_BLENDSTATE = 416,
HT_BUFFER = 417,
HT_BYTEADDRESSBUFFER = 418,
HT_CBUFFER = 419,
HT_COLUMN_MAJOR = 420,
HT_COMPILE = 421,
HT_COMPILE_FRAGMENT = 422,
HT_COMPILESHADER = 423,
HT_COMPUTESHADER = 424,
HT_CONSUMESTRUCTUREDBUFFER = 425,
HT_DEPTHSTENCILSTATE = 426,
HT_DEPTHSTENCILVIEW = 427,
HT_DOMAINSHADER = 428,
HT_DWORD = 429,
HT_EXTERN = 430,
HT_FALSE = 431,
HT_FXGROUP = 432,
HT_GEOMETRYSHADER = 433,
HT_GROUPSHARED = 434,
HT_HALF = 435,
HT_HULLSHADER = 436,
HT_INLINE = 437,
HT_INPUTPATCH = 438,
HT_INTERFACE = 439,
HT_LINE = 440,
HT_LINEADJ = 441,
HT_LINEAR = 442,
HT_LINESTREAM = 443,
HT_MATRIX = 444,
HT_NAMESPACE = 445,
HT_NOINTERPOLATION = 446,
HT_NULL = 447,
HT_OUTPUTPATCH = 448,
HT_PACKOFFSET = 449,
HT_PASS = 450,
HT_PIXELFRAGMENT = 451,
HT_PIXELSHADER = 452,
HT_POINT = 453,
HT_POINTSTREAM = 454,
HT_PRECISE = 455,
HT_RASTERIZERSTATE = 456,
HT_RENDERTARGETVIEW = 457,
HT_REGISTER = 458,
HT_ROW_MAJOR = 459,
HT_RWBUFFER = 460,
HT_RWBYTEADDRESSBUFFER = 461,
HT_RWSTRUCTUREDBUFFER = 462,
HT_RWTEXTURE1D = 463,
HT_RWTEXTURE1DARRAY = 464,
HT_RWTEXTURE2D = 465,
HT_RWTEXTURE2DARRAY = 466,
HT_RWTEXTURE3D = 467,
HT_SAMPLER = 468,
HT_SAMPLER_STATE = 469,
HT_SAMPLERSTATE = 470,
HT_SAMPLERCOMPARISONSTATE = 471,
HT_SHARED = 472,
HT_SNORM = 473,
HT_STATEBLOCK = 474,
HT_STATEBLOCK_STATE = 475,
HT_STATIC = 476,
HT_STRING = 477,
HT_STRUCTUREDBUFFER = 478,
HT_TBUFFER = 479,
HT_TECHNIQUE = 480,
HT_TECHNIQUE10 = 481,
HT_TECHNIQUE11XZ = 482,
HT_TEXTURE = 483,
HT_TEXTURE1D = 484,
HT_TEXTURE1DARRAY = 485,
HT_TEXTURE2D = 486,
HT_TEXTURE2DARRAY = 487,
HT_TEXTURE2DMS = 488,
HT_TEXTURE2DMSARRAY = 489,
HT_TEXTURE3D = 490,
HT_TEXTURECUBE = 491,
HT_TEXTURECUBEARRAY = 492,
HT_TRUE = 493,
HT_TYPEDEF = 494,
HT_TRIANGLE = 495,
HT_TRIANGLEADJ = 496,
HT_TRIANGLESTREAM = 497,
HT_UNORM = 498,
HT_VECTOR = 499,
HT_VERTEXFRAGMENT = 500,
HT_VERTEXSHADER = 501,
HT_VOLATILE = 502,
HT_BOOL1 = 503,
HT_BOOL1x1 = 504,
HT_BOOL2x1 = 505,
HT_BOOL3x1 = 506,
HT_BOOL4x1 = 507,
HT_BOOL2 = 508,
HT_BOOL1x2 = 509,
HT_BOOL2x2 = 510,
HT_BOOL3x2 = 511,
HT_BOOL4x2 = 512,
HT_BOOL3 = 513,
HT_BOOL1x3 = 514,
HT_BOOL2x3 = 515,
HT_BOOL3x3 = 516,
HT_BOOL4x3 = 517,
HT_BOOL4 = 518,
HT_BOOL1x4 = 519,
HT_BOOL2x4 = 520,
HT_BOOL3x4 = 521,
HT_BOOL4x4 = 522,
HT_FLOAT1 = 523,
HT_FLOAT1x1 = 524,
HT_FLOAT2x1 = 525,
HT_FLOAT3x1 = 526,
HT_FLOAT4x1 = 527,
HT_FLOAT2 = 528,
HT_FLOAT1x2 = 529,
HT_FLOAT2x2 = 530,
HT_FLOAT3x2 = 531,
HT_FLOAT4x2 = 532,
HT_FLOAT3 = 533,
HT_FLOAT1x3 = 534,
HT_FLOAT2x3 = 535,
HT_FLOAT3x3 = 536,
HT_FLOAT4x3 = 537,
HT_FLOAT4 = 538,
HT_FLOAT1x4 = 539,
HT_FLOAT2x4 = 540,
HT_FLOAT3x4 = 541,
HT_FLOAT4x4 = 542,
HT_DOUBLE1 = 543,
HT_DOUBLE1x1 = 544,
HT_DOUBLE2x1 = 545,
HT_DOUBLE3x1 = 546,
HT_DOUBLE4x1 = 547,
HT_DOUBLE2 = 548,
HT_DOUBLE1x2 = 549,
HT_DOUBLE2x2 = 550,
HT_DOUBLE3x2 = 551,
HT_DOUBLE4x2 = 552,
HT_DOUBLE3 = 553,
HT_DOUBLE1x3 = 554,
HT_DOUBLE2x3 = 555,
HT_DOUBLE3x3 = 556,
HT_DOUBLE4x3 = 557,
HT_DOUBLE4 = 558,
HT_DOUBLE1x4 = 559,
HT_DOUBLE2x4 = 560,
HT_DOUBLE3x4 = 561,
HT_DOUBLE4x4 = 562,
HT_DWORD1 = 563,
HT_DWORD1x1 = 564,
HT_DWORD2x1 = 565,
HT_DWORD3x1 = 566,
HT_DWORD4x1 = 567,
HT_DWORD2 = 568,
HT_DWORD1x2 = 569,
HT_DWORD2x2 = 570,
HT_DWORD3x2 = 571,
HT_DWORD4x2 = 572,
HT_DWORD3 = 573,
HT_DWORD1x3 = 574,
HT_DWORD2x3 = 575,
HT_DWORD3x3 = 576,
HT_DWORD4x3 = 577,
HT_DWORD4 = 578,
HT_DWORD1x4 = 579,
HT_DWORD2x4 = 580,
HT_DWORD3x4 = 581,
HT_DWORD4x4 = 582,
HT_INT1 = 583,
HT_INT1x1 = 584,
HT_INT2x1 = 585,
HT_INT3x1 = 586,
HT_INT4x1 = 587,
HT_INT2 = 588,
HT_INT1x2 = 589,
HT_INT2x2 = 590,
HT_INT3x2 = 591,
HT_INT4x2 = 592,
HT_INT3 = 593,
HT_INT1x3 = 594,
HT_INT2x3 = 595,
HT_INT3x3 = 596,
HT_INT4x3 = 597,
HT_INT4 = 598,
HT_INT1x4 = 599,
HT_INT2x4 = 600,
HT_INT3x4 = 601,
HT_INT4x4 = 602,
HT_UINT1 = 603,
HT_UINT1x1 = 604,
HT_UINT2x1 = 605,
HT_UINT3x1 = 606,
HT_UINT4x1 = 607,
HT_UINT2 = 608,
HT_UINT1x2 = 609,
HT_UINT2x2 = 610,
HT_UINT3x2 = 611,
HT_UINT4x2 = 612,
HT_UINT3 = 613,
HT_UINT1x3 = 614,
HT_UINT2x3 = 615,
HT_UINT3x3 = 616,
HT_UINT4x3 = 617,
HT_UINT4 = 618,
HT_UINT1x4 = 619,
HT_UINT2x4 = 620,
HT_UINT3x4 = 621,
HT_UINT4x4 = 622,
PREPROCESSOR_DEFINE = 623,
PREPROCESSOR_ELIF = 624,
PREPROCESSOR_ELSE = 625,
PREPROCESSOR_ENDIF = 626,
PREPROCESSOR_ERROR = 627,
PREPROCESSOR_IF = 628,
PREPROCESSOR_IFDEF = 629,
PREPROCESSOR_IFNDEF = 630,
PREPROCESSOR_INCLUDE = 631,
PREPROCESSOR_LINE = 632,
PREPROCESSOR_PRAGMA = 633,
PREPROCESSOR_UNDEF = 634,
PREPROCESSOR_REGION = 635,
HT_AUTO = 636,
HT_CATCH = 637,
HT_CHAR = 638,
HT_CLASS = 639,
HT_CONST_CAST = 640,
HT_DELETE = 641,
HT_DYNAMIC_CAST = 642,
HT_ENUM = 643,
HT_EXPLICIT = 644,
HT_FRIEND = 645,
HT_GOTO = 646,
HT_LONG = 647,
HT_MUTABLE = 648,
HT_NEW = 649,
HT_OPERATOR = 650,
HT_PRIVATE = 651,
HT_PROTECTED = 652,
HT_PUBLIC = 653,
HT_REINTERPRET_CAST = 654,
HT_SHORT = 655,
HT_SIGNED = 656,
HT_SIZEOF = 657,
HT_STATIC_CAST = 658,
HT_TEMPLATE = 659,
HT_THIS = 660,
HT_THROW = 661,
HT_TRY = 662,
HT_TYPENAME = 663,
HT_UNION = 664,
HT_UNSIGNED = 665,
HT_USING = 666,
HT_VIRTUAL = 667,
T_INC = 668,
T_DEC = 669,
T_LE = 670,
T_GE = 671,
T_EQ = 672,
T_NE = 673,
T_LEFT = 674,
T_RIGHT = 675,
T_AND = 676,
T_OR = 677,
T_XOR = 678,
T_MULEQ = 679,
T_DIVEQ = 680,
T_MODEQ = 681,
T_ADDEQ = 682,
T_SUBEQ = 683,
T_LEFTEQ = 684,
T_RIGHTEQ = 685,
T_ANDEQ = 686,
T_XOREQ = 687,
T_OREQ = 688,
FLOAT = 689,
STRING = 690,
NAME = 691,
T_ERROR = 692
};

};
/// Token type.
typedef token::yytokentype token_type;

/// Build a parser object.
LolFxParser (class LolFxCompiler& mc_yyarg);
virtual ~LolFxParser ();

/// Parse.
/// \returns 0 iff parsing succeeded.
virtual int parse ();

#if YYDEBUG
/// The current debugging stream.
std::ostream& debug_stream () const;
/// Set the current debugging stream.
void set_debug_stream (std::ostream &);

/// Type for debugging levels.
typedef int debug_level_type;
/// The current debugging level.
debug_level_type debug_level () const;
/// Set the current debugging level.
void set_debug_level (debug_level_type l);
#endif

private:
/// Report a syntax error.
/// \param loc where the syntax error is found.
/// \param msg a description of the syntax error.
virtual void error (const location_type& loc, const std::string& msg);

/// Generate an error message.
/// \param state the state where the error occurred.
/// \param tok the lookahead token.
virtual std::string yysyntax_error_ (int yystate, int tok);

#if YYDEBUG
/// \brief Report a symbol value on the debug stream.
/// \param yytype The token type.
/// \param yyvaluep Its semantic value.
/// \param yylocationp Its location.
virtual void yy_symbol_value_print_ (int yytype,
const semantic_type* yyvaluep,
const location_type* yylocationp);
/// \brief Report a symbol on the debug stream.
/// \param yytype The token type.
/// \param yyvaluep Its semantic value.
/// \param yylocationp Its location.
virtual void yy_symbol_print_ (int yytype,
const semantic_type* yyvaluep,
const location_type* yylocationp);
#endif


/// State numbers.
typedef int state_type;
/// State stack type.
typedef stack<state_type> state_stack_type;
/// Semantic value stack type.
typedef stack<semantic_type> semantic_stack_type;
/// location stack type.
typedef stack<location_type> location_stack_type;

/// The state stack.
state_stack_type yystate_stack_;
/// The semantic value stack.
semantic_stack_type yysemantic_stack_;
/// The location stack.
location_stack_type yylocation_stack_;

/// Internal symbol numbers.
typedef unsigned short int token_number_type;
/* Tables. */
/// For a state, the index in \a yytable_ of its portion.
static const short int yypact_[];
static const short int yypact_ninf_;

/// For a state, default rule to reduce.
/// Unless\a yytable_ specifies something else to do.
/// Zero means the default is an error.
static const unsigned short int yydefact_[];

static const short int yypgoto_[];
static const short int yydefgoto_[];

/// What to do in a state.
/// \a yytable_[yypact_[s]]: what to do in state \a s.
/// - if positive, shift that token.
/// - if negative, reduce the rule which number is the opposite.
/// - if zero, do what YYDEFACT says.
static const short int yytable_[];
static const short int yytable_ninf_;

static const short int yycheck_[];

/// For a state, its accessing symbol.
static const unsigned short int yystos_[];

/// For a rule, its LHS.
static const unsigned short int yyr1_[];
/// For a rule, its RHS length.
static const unsigned char yyr2_[];

#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
/// For a symbol, its name in clear.
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

#if YYDEBUG
/// A type to store symbol numbers and -1.
typedef short int rhs_number_type;
/// A `-1'-separated list of the rules' RHS.
static const rhs_number_type yyrhs_[];
/// For each rule, the index of the first RHS symbol in \a yyrhs_.
static const unsigned short int yyprhs_[];
/// For each rule, its source line number.
static const unsigned short int yyrline_[];
/// For each scanner token number, its symbol number.
static const unsigned short int yytoken_number_[];
/// Report on the debug stream that the rule \a r is going to be reduced.
virtual void yy_reduce_print_ (int r);
/// Print the state stack on the debug stream.
virtual void yystack_print_ ();

/* Debugging. */
int yydebug_;
std::ostream* yycdebug_;
#endif

/// Convert a scanner token number \a t to a symbol number.
token_number_type yytranslate_ (int t);

/// \brief Reclaim the memory associated to a symbol.
/// \param yymsg Why this token is reclaimed.
/// \param yytype The symbol type.
/// \param yyvaluep Its semantic value.
/// \param yylocationp Its location.
inline void yydestruct_ (const char* yymsg,
int yytype,
semantic_type* yyvaluep,
location_type* yylocationp);

/// Pop \a n symbols the three stacks.
inline void yypop_ (unsigned int n = 1);

/* Constants. */
static const int yyeof_;
/* LAST_ -- Last index in TABLE_. */
static const int yylast_;
static const int yynnts_;
static const int yyempty_;
static const int yyfinal_;
static const int yyterror_;
static const int yyerrcode_;
static const int yyntokens_;
static const unsigned int yyuser_token_number_max_;
static const token_number_type yyundef_token_;

/* User arguments. */
class LolFxCompiler& mc;
};

} // lol

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



#endif /* ! defined PARSER_HEADER_H */

+ 0
- 5301
src/generated/lolfx-scanner.cpp
File diff suppressed because it is too large
View File


+ 0
- 161
src/generated/position.hh View File

@@ -1,161 +0,0 @@
/* A Bison parser, made by GNU Bison 2.4.2. */

/* Positions for Bison parsers in C++
Copyright (C) 2002-2007, 2009-2010 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */

/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
under terms of your choice, so long as that work isn't itself a
parser generator using the skeleton or a modified version thereof
as a parser skeleton. Alternatively, if you modify or redistribute
the parser skeleton itself, you may (at your option) remove this
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */

/**
** \file position.hh
** Define the lol::position class.
*/

#ifndef BISON_POSITION_HH
# define BISON_POSITION_HH

# include <iostream>
# include <string>
# include <algorithm>


namespace lol {

/* Line 37 of location.cc */
#line 50 "generated/position.hh"
/// Abstract a position.
class position
{
public:

/// Construct a position.
position ()
: filename (0), line (1), column (1)
{
}


/// Initialization.
inline void initialize (std::string* fn)
{
filename = fn;
line = 1;
column = 1;
}

/** \name Line and Column related manipulators
** \{ */
public:
/// (line related) Advance to the COUNT next lines.
inline void lines (int count = 1)
{
column = 1;
line += count;
}

/// (column related) Advance to the COUNT next columns.
inline void columns (int count = 1)
{
column = std::max (1u, column + count);
}
/** \} */

public:
/// File name to which this position refers.
std::string* filename;
/// Current line number.
unsigned int line;
/// Current column number.
unsigned int column;
};

/// Add and assign a position.
inline const position&
operator+= (position& res, const int width)
{
res.columns (width);
return res;
}

/// Add two position objects.
inline const position
operator+ (const position& begin, const int width)
{
position res = begin;
return res += width;
}

/// Add and assign a position.
inline const position&
operator-= (position& res, const int width)
{
return res += -width;
}

/// Add two position objects.
inline const position
operator- (const position& begin, const int width)
{
return begin + -width;
}

/// Compare two position objects.
inline bool
operator== (const position& pos1, const position& pos2)
{
return (pos1.line == pos2.line
&& pos1.column == pos2.column
&& (pos1.filename == pos2.filename
|| (pos1.filename && pos2.filename
&& *pos1.filename == *pos2.filename)));
}

/// Compare two position objects.
inline bool
operator!= (const position& pos1, const position& pos2)
{
return !(pos1 == pos2);
}

/** \brief Intercept output stream redirection.
** \param ostr the destination output stream
** \param pos a reference to the position to redirect
*/
inline std::ostream&
operator<< (std::ostream& ostr, const position& pos)
{
if (pos.filename)
ostr << *pos.filename << ':';
return ostr << pos.line << '.' << pos.column;
}


} // lol

/* Line 144 of location.cc */
#line 161 "generated/position.hh"
#endif // not BISON_POSITION_HH

+ 0
- 135
src/generated/stack.hh View File

@@ -1,135 +0,0 @@
/* A Bison parser, made by GNU Bison 2.4.2. */

/* Stack handling for Bison parsers in C++
Copyright (C) 2002-2010 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */

/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
under terms of your choice, so long as that work isn't itself a
parser generator using the skeleton or a modified version thereof
as a parser skeleton. Alternatively, if you modify or redistribute
the parser skeleton itself, you may (at your option) remove this
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */

#ifndef BISON_STACK_HH
# define BISON_STACK_HH

#include <deque>


namespace lol {

/* Line 1066 of lalr1.cc */
#line 43 "generated/stack.hh"
template <class T, class S = std::deque<T> >
class stack
{
public:

// Hide our reversed order.
typedef typename S::reverse_iterator iterator;
typedef typename S::const_reverse_iterator const_iterator;

stack () : seq_ ()
{
}

stack (unsigned int n) : seq_ (n)
{
}

inline
T&
operator [] (unsigned int i)
{
return seq_[i];
}

inline
const T&
operator [] (unsigned int i) const
{
return seq_[i];
}

inline
void
push (const T& t)
{
seq_.push_front (t);
}

inline
void
pop (unsigned int n = 1)
{
for (; n; --n)
seq_.pop_front ();
}

inline
unsigned int
height () const
{
return seq_.size ();
}

inline const_iterator begin () const { return seq_.rbegin (); }
inline const_iterator end () const { return seq_.rend (); }

private:

S seq_;
};

/// Present a slice of the top of a stack.
template <class T, class S = stack<T> >
class slice
{
public:

slice (const S& stack,
unsigned int range) : stack_ (stack),
range_ (range)
{
}

inline
const T&
operator [] (unsigned int i) const
{
return stack_[range_ - i];
}

private:

const S& stack_;
unsigned int range_;
};

} // lol

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

#endif // not BISON_STACK_HH[]dnl


+ 0
- 48
src/gpu/lolfx-compiler.cpp View File

@@ -1,48 +0,0 @@
//
// Lol Engine
//
// Copyright: (c) 2010-2013 Sam Hocevar <sam@hocevar.net>
// This program is free software; you can redistribute it and/or
// modify it under the terms of the Do What The Fuck You Want To
// Public License, Version 2, as published by Sam Hocevar. See
// http://www.wtfpl.net/ for more details.
//

#include <lol/engine-internal.h>

#include <string>

#include "gpu/lolfx-compiler.h"

namespace lol
{

LolFxCompiler::LolFxCompiler(LolFx &lolfx)
: m_lolfx(lolfx)
{
}

bool LolFxCompiler::ParseString(char const *command)
{
LolFxScanner scanner(command);
m_lexer = &scanner;
LolFxParser parser(*this);
//parser.set_debug_level(1);
if (parser.parse() != 0)
return false;
return true;
}

void LolFxCompiler::Error(const class location& l, const std::string& m)
{
Log::Error("LolFx syntax error line %d column %d: %s\n",
l.begin.line, l.begin.column, m.c_str());
}

void LolFxCompiler::Error(const std::string& m)
{
Log::Error("LolFx syntax error: %s\n", m.c_str());
}

} /* namespace lol */


+ 0
- 68
src/gpu/lolfx-compiler.h View File

@@ -1,68 +0,0 @@
//
// Lol Engine
//
// Copyright: (c) 2010-2013 Sam Hocevar <sam@hocevar.net>
// This program is free software; you can redistribute it and/or
// modify it under the terms of the Do What The Fuck You Want To
// Public License, Version 2, as published by Sam Hocevar. See
// http://www.wtfpl.net/ for more details.
//

#pragma once

#include <string>

#ifndef __FLEX_LEXER_H
# define yyFlexLexer LolFxFlexLexer
# include "FlexLexer.h"
# undef yyFlexLexer
#endif

#include "generated/lolfx-parser.h"

class LolFx;

namespace lol
{

class LolFxScanner : public LolFxFlexLexer
{
public:
LolFxScanner(char const *command);
virtual ~LolFxScanner();
virtual int LexerInput(char* buf, int max_size);
virtual LolFxParser::token_type lex(LolFxParser::semantic_type* yylval,
LolFxParser::location_type* yylloc);

private:
bool IsExpressionTrue(char const *buf);

map<String, String> m_pp_defines;

enum
{
BlockIsFalse,
BlockIsForeverFalse,
BlockIsTrue,
};
array<int> m_pp_stack;

char const *m_input;
};

class LolFxCompiler
{
public:
LolFxCompiler(class LolFx &lolfx);

bool ParseString(char const *command);

void Error(const class location& l, const std::string& m);
void Error(const std::string& m);

class LolFxScanner *m_lexer;
class LolFx &m_lolfx;
};

} /* namespace lol */


+ 3
- 4
src/gpu/lolfx.cpp View File

@@ -15,8 +15,6 @@


#include <lol/engine-internal.h> #include <lol/engine-internal.h>


#include "gpu/lolfx-compiler.h"

namespace lol namespace lol
{ {


@@ -33,8 +31,9 @@ LolFx::LolFx()


bool LolFx::Compile(char const *command) bool LolFx::Compile(char const *command)
{ {
LolFxCompiler lc(*this);
return lc.ParseString(command);
UNUSED(command);

return false;
} }


} /* namespace lol */ } /* namespace lol */


+ 0
- 17
src/lolcore.vcxproj View File

@@ -101,7 +101,6 @@
<ClCompile Include="debug\stats.cpp" /> <ClCompile Include="debug\stats.cpp" />
<ClCompile Include="dict.cpp" /> <ClCompile Include="dict.cpp" />
<ClCompile Include="easymesh\csgbsp.cpp" /> <ClCompile Include="easymesh\csgbsp.cpp" />
<ClCompile Include="easymesh\easymesh-compiler.cpp" />
<ClCompile Include="easymesh\easymesh.cpp" /> <ClCompile Include="easymesh\easymesh.cpp" />
<ClCompile Include="easymesh\easymeshbuild.cpp" /> <ClCompile Include="easymesh\easymeshbuild.cpp" />
<ClCompile Include="easymesh\easymeshrender.cpp" /> <ClCompile Include="easymesh\easymeshrender.cpp" />
@@ -110,13 +109,8 @@
<ClCompile Include="entity.cpp" /> <ClCompile Include="entity.cpp" />
<ClCompile Include="font.cpp" /> <ClCompile Include="font.cpp" />
<ClCompile Include="forge.cpp" /> <ClCompile Include="forge.cpp" />
<ClCompile Include="generated\easymesh-parser.cpp" />
<ClCompile Include="generated\easymesh-scanner.cpp" />
<ClCompile Include="generated\lolfx-parser.cpp" />
<ClCompile Include="generated\lolfx-scanner.cpp" />
<ClCompile Include="gpu\framebuffer.cpp" /> <ClCompile Include="gpu\framebuffer.cpp" />
<ClCompile Include="gpu\indexbuffer.cpp" /> <ClCompile Include="gpu\indexbuffer.cpp" />
<ClCompile Include="gpu\lolfx-compiler.cpp" />
<ClCompile Include="gpu\lolfx.cpp" /> <ClCompile Include="gpu\lolfx.cpp" />
<ClCompile Include="gpu\rendercontext.cpp" /> <ClCompile Include="gpu\rendercontext.cpp" />
<ClCompile Include="gpu\renderer.cpp" /> <ClCompile Include="gpu\renderer.cpp" />
@@ -239,7 +233,6 @@
<ClInclude Include="debug\stats.h" /> <ClInclude Include="debug\stats.h" />
<ClInclude Include="dict.h" /> <ClInclude Include="dict.h" />
<ClInclude Include="easymesh\csgbsp.h" /> <ClInclude Include="easymesh\csgbsp.h" />
<ClInclude Include="easymesh\easymesh-compiler.h" />
<ClInclude Include="easymesh\easymesh.h" /> <ClInclude Include="easymesh\easymesh.h" />
<ClInclude Include="easymesh\easymeshbuild.h" /> <ClInclude Include="easymesh\easymeshbuild.h" />
<ClInclude Include="easymesh\easymeshrender.h" /> <ClInclude Include="easymesh\easymeshrender.h" />
@@ -248,12 +241,6 @@
<ClInclude Include="entity.h" /> <ClInclude Include="entity.h" />
<ClInclude Include="font.h" /> <ClInclude Include="font.h" />
<ClInclude Include="forge.h" /> <ClInclude Include="forge.h" />
<ClInclude Include="generated\easymesh-parser.h" />
<ClInclude Include="generated\location.hh" />
<ClInclude Include="generated\lolfx-parser.h" />
<ClInclude Include="generated\position.hh" />
<ClInclude Include="generated\stack.hh" />
<ClInclude Include="gpu\lolfx-compiler.h" />
<ClInclude Include="gradient.h" /> <ClInclude Include="gradient.h" />
<ClInclude Include="image\image-private.h" /> <ClInclude Include="image\image-private.h" />
<ClInclude Include="input\controller.h" /> <ClInclude Include="input\controller.h" />
@@ -406,10 +393,6 @@
<LolFxCompile Include="gradient.lolfx" /> <LolFxCompile Include="gradient.lolfx" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="easymesh\easymesh-parser.y" />
<None Include="easymesh\easymesh-scanner.l" />
<None Include="gpu\lolfx-parser.y" />
<None Include="gpu\lolfx-scanner.l" />
<None Include="Makefile.am" /> <None Include="Makefile.am" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>


+ 0
- 54
src/lolcore.vcxproj.filters View File

@@ -13,9 +13,6 @@
<Filter Include="easymesh"> <Filter Include="easymesh">
<UniqueIdentifier>{07117029-d79d-4d59-beec-691b00a97c8f}</UniqueIdentifier> <UniqueIdentifier>{07117029-d79d-4d59-beec-691b00a97c8f}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="generated">
<UniqueIdentifier>{8d536fa6-9ef8-4bdb-b945-48fe4549e8ec}</UniqueIdentifier>
</Filter>
<Filter Include="gpu"> <Filter Include="gpu">
<UniqueIdentifier>{ec9b94fc-c716-4ef2-9c3b-c7f3447574b0}</UniqueIdentifier> <UniqueIdentifier>{ec9b94fc-c716-4ef2-9c3b-c7f3447574b0}</UniqueIdentifier>
</Filter> </Filter>
@@ -270,24 +267,6 @@
<ClCompile Include="easymesh\easymesh.cpp"> <ClCompile Include="easymesh\easymesh.cpp">
<Filter>easymesh</Filter> <Filter>easymesh</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="easymesh\easymesh-compiler.cpp">
<Filter>easymesh</Filter>
</ClCompile>
<ClCompile Include="generated\easymesh-parser.cpp">
<Filter>generated</Filter>
</ClCompile>
<ClCompile Include="generated\easymesh-scanner.cpp">
<Filter>generated</Filter>
</ClCompile>
<ClCompile Include="generated\lolfx-parser.cpp">
<Filter>generated</Filter>
</ClCompile>
<ClCompile Include="generated\lolfx-scanner.cpp">
<Filter>generated</Filter>
</ClCompile>
<ClCompile Include="gpu\lolfx-compiler.cpp">
<Filter>gpu</Filter>
</ClCompile>
<ClCompile Include="gpu\lolfx.cpp"> <ClCompile Include="gpu\lolfx.cpp">
<Filter>gpu</Filter> <Filter>gpu</Filter>
</ClCompile> </ClCompile>
@@ -591,30 +570,9 @@
<ClInclude Include="world.h"> <ClInclude Include="world.h">
<Filter>...</Filter> <Filter>...</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="generated\position.hh">
<Filter>generated</Filter>
</ClInclude>
<ClInclude Include="generated\location.hh">
<Filter>generated</Filter>
</ClInclude>
<ClInclude Include="generated\stack.hh">
<Filter>generated</Filter>
</ClInclude>
<ClInclude Include="easymesh\easymesh.h"> <ClInclude Include="easymesh\easymesh.h">
<Filter>easymesh</Filter> <Filter>easymesh</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="easymesh\easymesh-compiler.h">
<Filter>easymesh</Filter>
</ClInclude>
<ClInclude Include="generated\easymesh-parser.h">
<Filter>generated</Filter>
</ClInclude>
<ClInclude Include="gpu\lolfx-compiler.h">
<Filter>gpu</Filter>
</ClInclude>
<ClInclude Include="generated\lolfx-parser.h">
<Filter>gpu</Filter>
</ClInclude>
<ClInclude Include="lol\base\array.h"> <ClInclude Include="lol\base\array.h">
<Filter>lol\base</Filter> <Filter>lol\base</Filter>
</ClInclude> </ClInclude>
@@ -821,18 +779,6 @@
</LolFxCompile> </LolFxCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="easymesh\easymesh-parser.y">
<Filter>easymesh</Filter>
</None>
<None Include="easymesh\easymesh-scanner.l">
<Filter>easymesh</Filter>
</None>
<None Include="gpu\lolfx-scanner.l">
<Filter>gpu</Filter>
</None>
<None Include="gpu\lolfx-parser.y">
<Filter>gpu</Filter>
</None>
<None Include="Makefile.am" /> <None Include="Makefile.am" />
</ItemGroup> </ItemGroup>
</Project> </Project>

Loading…
Cancel
Save