removed namespace

This commit is contained in:
bronku 2025-11-20 14:22:16 +01:00
parent 36396e97e9
commit 7e7d2a45b5
4 changed files with 24 additions and 33 deletions

View file

@ -1,22 +1,18 @@
#include "ParserCtx.hpp"
#include "../build/lexer.hpp"
#include "../build/parser.hpp"
namespace Elite
ParserCtx::ParserCtx()
{
yylex_init(&lexer);
// yyset_in()
loc = new yy::location();
parser = new yy::Parser(lexer, *loc, *this);
}
ParserCtx::ParserCtx()
{
yylex_init(&lexer);
// yyset_in()
loc = new yy::location();
parser = new yy::Parser(lexer, *loc, *this);
}
ParserCtx::~ParserCtx()
{
yylex_destroy(lexer);
delete loc;
delete parser;
}
} // namespace Elite
ParserCtx::~ParserCtx()
{
yylex_destroy(lexer);
delete loc;
delete parser;
}

View file

@ -6,18 +6,13 @@ namespace yy
class location;
}
namespace Elite
class ParserCtx
{
public:
ParserCtx();
~ParserCtx();
class ParserCtx
{
public:
ParserCtx();
~ParserCtx();
void *lexer;
yy::location *loc;
yy::Parser *parser;
};
} // namespace Elite
void *lexer;
yy::location *loc;
yy::Parser *parser;
};

View file

@ -7,7 +7,7 @@
yy::Parser::symbol_type yylex(yyscan_t yyscanner, yy::location &loc);
void dump_tokens(Elite::ParserCtx &ctx)
void dump_tokens(ParserCtx &ctx)
{
while (true)
{
@ -28,7 +28,7 @@ void dump_tokens(Elite::ParserCtx &ctx)
int main(int argc, char *argv[])
{
Elite::ParserCtx ctx;
ParserCtx ctx;
Configuration config(argc, argv);
if (!config.valid)
{

View file

@ -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
* variables. */
%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 }