SQLite Forum

lemon - optional namespace support
Login
True, that isn't obvious from the patches, but fits with the lemon structure.
The `lempar.c` code is written quite intelligently, so it has a number of file-static code and data bits. For example,
```
static void yy_pop_parser_stack(yyParser *pParser){ ... }
```
Followed by externally visible functions bits where it is used. For example,
```
%namespace_begin
void ParseFinalize(void *p){ ... }
%namespace_end
```
I personally think this is a very reasonable way to do things. Declare file-statics just before they required.

To nicely enclose in a single namespace would entail juggling most of the file-static bits together near the top, and the namespace-scoped near the bottom. This would be a fairly heavy patch, with the usual potentials for introducing bugs. Simply wrapping everything as is currently is means that some of the names can potentially leak out into the enclosing namespace, which isn't really desirable.  I also ran into issues with addressing pieces not in my own scope etc (ie, headaches).

Hope that clarifies.
/mark