summaryrefslogtreecommitdiff
path: root/Makefile
AgeCommit message (Collapse)Author
2010-05-19Add a wrapper function around the lexer.Carl Worth
We rename the generated lexer from yylex to glcpp_lex. Then we implement our own yylex function in glcpp-parse.y that calls glcpp_lex. This doesn't change the behavior at all yet, but gives us a place where we can do implement alternate lexing in the future. (We want this because instead of re-lexing from strings for macro expansion, we want to lex from pre-parsed token lists. We need this so that when we terminate recursion due to an already active macro expansion, we can ensure that that symbol never gets expanded again later.)
2010-05-14Provide implementation for macro arguments containing parentheses.Carl Worth
We were correctly parsing this already, but simply not returning any value (for no good reason). Fortunately the fix is quite simple. This makes the test added in the previous commit now pass.
2010-05-14Makefile: Make "make test" depend on the main program.Carl Worth
Otherwise, running "make test" can run an old version of the code, (even when new changes are sitting in the source waiting to be compiled).
2010-05-13Add support for the structure of function-like macros.Carl Worth
We accept the structure of arguments in both macro definition and macro invocation, but we don't yet expand those arguments. This is just enough code to pass the recently-added tests, but does not yet provide any sort of useful function-like macro.
2010-05-12Convert lexer to talloc and add xtalloc wrappers.Carl Worth
The lexer was previously using strdup (expecting the parser to free), but is now more consistent, easier to use, and slightly more efficent by using talloc along with the parser. Also, we add xtalloc and xtalloc_strdup wrappers around talloc and talloc_strdup to put all of the out-of-memory-checking code in one place.
2010-05-12Fix defines involving both literals and other defined macros.Carl Worth
We now store a list of tokens in our hash-table rather than a single string. This lets us replace each macro in the value as necessary. This code adds a link dependency on talloc which does exactly what we want in terms of memory management for a parser. The 3 tests added in the previous commit now pass.
2010-05-10Add a very simple test for the pre-processor.Carl Worth
Validate desired test cases by ensuring the output of glcpp matches the output of the gcc preprocessor, (ignoring any lines of the gcc output beginning with '#'). Only one test case so far with a trivial #define.
2010-05-10Makefile: Enable debugging of parser.Carl Worth
This compiles the debugging code for teh parser. It's not active unless the yydebug variable is set to a non-zero value.
2010-05-10Add hash table implementation from glsl2 project.Carl Worth
The preprocessor here is intended to become part of the glsl2 codebase eventually anyway.
2010-05-10Add some compiler warnings and corresponding fixes.Carl Worth
Most of the current problems were (mostly) harmless things like missing declarations, but there was at least one real error, (reversed argument order for yyerrror).
2010-05-10Add the tiniest shell of a flex/bison-based parser.Carl Worth
It doesn't really *do* anything yet---merlely parsing a stream of whitespace-separated tokens, (and not interpreting them at all).