Find a file
Carl Worth d476db38fe Add several tests where the defined value of a macro is (or looks like) a macro
Many of these look quite similar to existing tests that are handled
correctly, yet none of these work. For example, in test 30 we have a
simple non-function macro "foo" that is defined as "bar(baz(success))"
and obviously non-function macro expansion has been working for a long
time.  Similarly, if we had text of "bar(baz(success))" it would be
expanded correctly as well.

But when this otherwise functioning text appears as the body of a
macro, things don't work at all.

This is pointing out a fundamental problem with the current
approach. The current code does a recursive expansion of a macro
definition, but this doesn't involve the parsing machinery, so it
can't actually handle things like an arbitrary nesting of parentheses.

The fix will require the parser to stuff macro values back into the
lexer to get at all of the existing machinery when expanding macros.
2010-05-18 22:09:57 -07:00
main Add hash table implementation from glsl2 project. 2010-05-10 13:36:26 -07:00
tests Add several tests where the defined value of a macro is (or looks like) a macro 2010-05-18 22:09:57 -07:00
.gitignore Add a very simple test for the pre-processor. 2010-05-10 16:21:10 -07:00
glcpp-lex.l Fix (and add test for) function-like macro invocation with newlines. 2010-05-17 13:21:13 -07:00
glcpp-parse.y Fix (and add test for) function-like macro invocation with newlines. 2010-05-17 13:21:13 -07:00
glcpp.c Fix defines involving both literals and other defined macros. 2010-05-12 12:25:34 -07:00
glcpp.h Support macro invocations with multiple tokens for a single argument. 2010-05-14 11:50:27 -07:00
hash_table.c Add hash table implementation from glsl2 project. 2010-05-10 13:36:26 -07:00
hash_table.h Add hash table implementation from glsl2 project. 2010-05-10 13:36:26 -07:00
Makefile Provide implementation for macro arguments containing parentheses. 2010-05-14 16:53:52 -07:00
README Add README file describing glcpp. 2010-05-11 12:20:15 -07:00
xtalloc.c Convert lexer to talloc and add xtalloc wrappers. 2010-05-12 12:47:29 -07:00

glcpp -- GLSL "C" preprocessor

This is a simple preprocessor designed to provide the preprocessing
needs of the GLSL language. The requirements for this preprocessor are
specified in the GLSL 1.30 specification availble from:

http://www.opengl.org/registry/doc/GLSLangSpec.Full.1.30.08.pdf

This specification is not precise on some semantics, (for example,
#define and #if), defining these merely "as is standard for C++
preprocessors". To fill in these details, I've been using the C99
standard (for which I had a convenient copy) as available from:

http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdf