summaryrefslogtreecommitdiff
path: root/src/glsl/glcpp/glcpp-lex.l
AgeCommit message (Collapse)Author
2010-08-23glcpp: Fix handling of "#line 0"Carl Worth
The existing DECIMAL_INTEGER pattern is the correct thing to use when looking for a C decimal integer, (that is, a digit-sequence not starting with 0 which would instead be an octal integer). But for #line, we really want to accept any digit sequence, (including "0"), and always interpret it as a decimal constant. So we add a new DIGITS pattern for this case. This should fix the compilation failure noted in bug #28138 https://bugs.freedesktop.org/show_bug.cgi?id=28138 (Though the generated file will not be updated until the next commit.)
2010-08-23glcpp: Fix source numbers set with "#line LINE_NUMBER SOURCE_NUMBER"Carl Worth
Previously, the YY_USER_ACTION was overwriting the yylloc->source value in every action, (after that value had been carefully set by the handling of the #line directive). Instead, we want to initialize it once in YY_USER_INIT and then not touch it at all in YY_USER_ACTION.
2010-08-18glcpp: Add basic #line support (adapted from the main compiler).Kenneth Graunke
2010-08-17glcpp: Don't include the newline when discarding single-line commentsCarl Worth
Matching the newline here meant having to do some redundant work here, (incrementing line number, resetting column number, and returning a NEWLINE token), that could otherwise simply be left to the existing rule which matches a newline. Worse, when the comment rule matches the newline as well, the parser can lookahead and see a token for something that should actually be skipped. For example, in a case like this: #if 0 // comment here fail #else win #endif Both fail and win appear in the output, (not that the condition is being evaluated incorrectly---merely that one token after the comment's newline was being lexed/parse regardless of the condition). This commit fixes the above test case, (which is also remarkably similar to 087-if-comments which now passes).
2010-08-16glcpp: Remove spurious newline generated by #version handling.Kenneth Graunke
This was causing line numbering to be off by one. The newline comes from the NEWLINE token at the end of the line; there's no need to insert one.
2010-08-13glsl2: Use --nounistd to fix MSVC buildIan Romanick
Also remove the --never-interactive command line option for the preprocessor lexer. This was already done for main compiler lexer.
2010-08-11glcpp: Initialize line and column numbers to 1, not 0.Carl Worth
Error messages make more sense this way since the convention is for the first line of a file to be numbered from 1, rather than 0.
2010-08-04glcpp: Remove xtalloc wrappers in favor of plain talloc.Kenneth Graunke
Calling exit() on a memory failure probably made sense for the standalone preprocessor, but doesn't seem too appealing as part of the GL library. Also, we don't use it in the main compiler.
2010-07-28glcpp: Add __VERSION__ define to the current language version.Eric Anholt
Fixes: glsl-version-define glsl-version-define-110 glsl-version-define-120
2010-07-20glcpp: Avoid warnings in generated flex code.Carl Worth
We define the YY_NO_INPUT macro to avoid one needless function being generated. for the other needless functions, (yyunput and yy_top_state), we add a new UNREACHABLE start condition and call these functions from an action there. This doesn't change functionality at all, (since we never enter the UNREACHABLE start condition), but makes the compiler stop complaining about these two functions being defined but not used.
2010-07-20glcpp-lex: Declare some generated functions to eliminate compiler warnings.Carl Worth
It's really a bug in flex that these functions are generated with neither a declaration nor the 'static' keyword, but we can at least avoid the warnings this way.
2010-07-20glcpp: Fix support for nested #ifdef and nested #ifndefCarl Worth
Previously, if the outer #ifdef/#ifndef evaluated to false, the inner directive would not be parsed correctly, (the identifier as the subject of the #ifdef/#ifndef would inadvertently be skipped along with the other content correctly being skipped). We fix this by setting the lexing_if state in each case here. We also add a new test to the test suite to ensure that this case is tested.
2010-07-20glcpp: Support #if(expression) with no intervening space.Carl Worth
And add a test case to ensure that this works.
2010-07-07glsl2: Initialize yylineno and yycolumn so line numbers are sane.Kenneth Graunke
2010-07-02glcpp: Add #error support.Kenneth Graunke
2010-06-24glsl2: Move the compiler to the subdirectory it will live in in Mesa.Eric Anholt