removed namespace
This commit is contained in:
parent
36396e97e9
commit
7e7d2a45b5
4 changed files with 24 additions and 33 deletions
|
|
@ -1,22 +1,18 @@
|
||||||
#include "ParserCtx.hpp"
|
#include "ParserCtx.hpp"
|
||||||
#include "../build/lexer.hpp"
|
#include "../build/lexer.hpp"
|
||||||
#include "../build/parser.hpp"
|
#include "../build/parser.hpp"
|
||||||
namespace Elite
|
|
||||||
{
|
|
||||||
|
|
||||||
ParserCtx::ParserCtx()
|
ParserCtx::ParserCtx()
|
||||||
{
|
{
|
||||||
yylex_init(&lexer);
|
yylex_init(&lexer);
|
||||||
// yyset_in()
|
// yyset_in()
|
||||||
loc = new yy::location();
|
loc = new yy::location();
|
||||||
parser = new yy::Parser(lexer, *loc, *this);
|
parser = new yy::Parser(lexer, *loc, *this);
|
||||||
}
|
}
|
||||||
|
|
||||||
ParserCtx::~ParserCtx()
|
ParserCtx::~ParserCtx()
|
||||||
{
|
{
|
||||||
yylex_destroy(lexer);
|
yylex_destroy(lexer);
|
||||||
delete loc;
|
delete loc;
|
||||||
delete parser;
|
delete parser;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Elite
|
|
||||||
|
|
|
||||||
|
|
@ -6,18 +6,13 @@ namespace yy
|
||||||
class location;
|
class location;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Elite
|
class ParserCtx
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
class ParserCtx
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
ParserCtx();
|
ParserCtx();
|
||||||
~ParserCtx();
|
~ParserCtx();
|
||||||
|
|
||||||
void *lexer;
|
void *lexer;
|
||||||
yy::location *loc;
|
yy::location *loc;
|
||||||
yy::Parser *parser;
|
yy::Parser *parser;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Elite
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
yy::Parser::symbol_type yylex(yyscan_t yyscanner, yy::location &loc);
|
yy::Parser::symbol_type yylex(yyscan_t yyscanner, yy::location &loc);
|
||||||
|
|
||||||
void dump_tokens(Elite::ParserCtx &ctx)
|
void dump_tokens(ParserCtx &ctx)
|
||||||
{
|
{
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
|
|
@ -28,7 +28,7 @@ void dump_tokens(Elite::ParserCtx &ctx)
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
Elite::ParserCtx ctx;
|
ParserCtx ctx;
|
||||||
Configuration config(argc, argv);
|
Configuration config(argc, argv);
|
||||||
if (!config.valid)
|
if (!config.valid)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ yy::Parser::symbol_type yylex(void* yyscanner, yy::location& loc);
|
||||||
* provides a simple but effective pure interface, not relying on global
|
* provides a simple but effective pure interface, not relying on global
|
||||||
* variables. */
|
* variables. */
|
||||||
%lex-param {void *scanner} {yy::location& loc}
|
%lex-param {void *scanner} {yy::location& loc}
|
||||||
%parse-param {void *scanner} {yy::location& loc} { class Elite::ParserCtx& ctx }
|
%parse-param {void *scanner} {yy::location& loc} { class ParserCtx& ctx }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue