Apply const to generated parser code
- Dominant language
- C++
- Stars
- 80
- Forks
- 33
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
I'm using references to the generated parser contexts in my AST implementation. I find that I have a tendency to want to return const pointers from getter functions.
```
class AstExpression
{
public:
const MyParser::ExpressionContext* getContext() const;
};
```
However calling any function on that return value to further navigate the parse-tree complains about the `const` because these functions are not declared as **const** (not changing the instance).
Would it be possible to generate `const` aware code?
This would make it more correct (and strict).
Another one to consider is `noexcept`.
Also seen `virtual` and `override` being used together. MSVC 'complains' that only one is needed. Not sure if other compilers feel the same.
Contributor guide
Assessment
This issue has not been assessed yet.