From 7e7d2a45b5ee658e9994563b6332aa1f2f32d589 Mon Sep 17 00:00:00 2001 From: bronku Date: Thu, 20 Nov 2025 14:22:16 +0100 Subject: [PATCH] removed namespace --- src/ParserCtx.cpp | 30 +++++++++++++----------------- src/ParserCtx.hpp | 21 ++++++++------------- src/main.cpp | 4 ++-- src/parser.y | 2 +- 4 files changed, 24 insertions(+), 33 deletions(-) diff --git a/src/ParserCtx.cpp b/src/ParserCtx.cpp index b7d7764..35ae95f 100644 --- a/src/ParserCtx.cpp +++ b/src/ParserCtx.cpp @@ -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; +} diff --git a/src/ParserCtx.hpp b/src/ParserCtx.hpp index 0c96cf5..f4112bb 100644 --- a/src/ParserCtx.hpp +++ b/src/ParserCtx.hpp @@ -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; +}; diff --git a/src/main.cpp b/src/main.cpp index f4df0c9..87b16c4 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -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) { diff --git a/src/parser.y b/src/parser.y index b12ec70..c73c445 100644 --- a/src/parser.y +++ b/src/parser.y @@ -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 }