Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce a ScopedContext Class for Automatic Context Management #8

Open
pmqtt opened this issue Jan 3, 2025 · 0 comments
Open

Introduce a ScopedContext Class for Automatic Context Management #8

pmqtt opened this issue Jan 3, 2025 · 0 comments
Labels
good first issue Good for newcomers

Comments

@pmqtt
Copy link
Owner

pmqtt commented Jan 3, 2025

Description

Currently, context management in the parser relies on manual push and pop operations for the _context stack. This leads to repetitive code and increases the risk of inconsistencies.

Solution

Create a ScopedContext class that automatically pushes a context on creation and pops it on destruction.

Steps

Implement the ScopedContext class.
Replace existing push/pop calls with ScopedContext.
Example Usage

ScopedContext scoped_context(_context, {.context = "expression", .rule = RuleType::EXPRESSION});
@pmqtt pmqtt added the good first issue Good for newcomers label Jan 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant