summaryrefslogtreecommitdiff
path: root/Makefile
AgeCommit message (Collapse)AuthorFilesLines
2010-06-02test suite: Add expected output for every test.Carl Worth1-1/+1
Rather than using the (munged) output of "gcc -E" we now capture precisely the output we expect from every test case. This allows us to stay immune from strange output from gcc (unpredictable whitespace output---aprticularly with different gcc versions). This will also allow us to write tests that capture expected error messages from the preprocessor as well.
2010-05-27Implement token pasting of integers.Carl Worth1-1/+1
To do this correctly, we change the lexer to lex integers as string values, (new token type of INTEGER_STRING), and only convert to integer values when evaluating an expression value. Add a new test case for this, (which does pass now).
2010-05-19Add a wrapper function around the lexer.Carl Worth1-1/+1
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 Worth1-1/+1
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 Worth1-1/+1
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 Worth1-1/+1
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 Worth1-1/+1
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 Worth1-0/+7
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 Worth1-0/+4
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 Worth1-1/+1
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 Worth1-1/+1
The preprocessor here is intended to become part of the glsl2 codebase eventually anyway.
2010-05-10Add some compiler warnings and corresponding fixes.Carl Worth1-0/+2
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 Worth1-0/+12
It doesn't really *do* anything yet---merlely parsing a stream of whitespace-separated tokens, (and not interpreting them at all).