summaryrefslogtreecommitdiffstats
path: root/src/glsl/glcpp/tests
diff options
context:
space:
mode:
authorCarl Worth <[email protected]>2014-06-20 16:18:23 -0700
committerCarl Worth <[email protected]>2014-07-29 15:11:49 -0700
commitf583f214d5b8292aca91ec2217296b7ed17d9df4 (patch)
treecac5f5879e2745f92fa8bceabcf4fa94fcfc5736 /src/glsl/glcpp/tests
parent09b4e12900ae496cbbc2a8864b721eefffb9d74a (diff)
glsl/glcpp: Stop using a lexer start condition (<SKIP>) for token skipping.
Here, "skipping" refers to the lexer not emitting any tokens for portions of the file within an #if condition (or similar) that evaluates to false. Previously, the lexer had a special <SKIP> start condition used to control this skipping. This start condition was not handled like a normal start condition. Instead, there was a particularly ugly block of code set to be included at the top of the generated lexing loop that would change from <INITIAL> to <SKIP> or from <SKIP> to <INITIAL> depending on various pieces of parser state, (such as parser->skip_state and parser->lexing_directive). Not only was that an ugly approach, but the <SKIP> start condition was complicating several glcpp bug fixes I attempted recently that want to use start conditions for other purposes, (such as a new <HASH> start condition). The recently added RETURN_TOKEN macro gives us a convenient way to implement skipping without using a lexer start condition. Now, at the top of the generated lexer, we examine all the necessary parser state and set a new parser->skipping bit. Then, in RETURN_TOKEN, we examine parser->skipping to determine whether to actually emit the token or not. Besides this, there are only a couple of other places where we need to examine the skipping bit (other than when returning a token): * To avoid emitting an error for #error if skipped. * To avoid entering the <DEFINE> start condition for a #define that is skipped. With all of this in place in the present commit, there are hopefully no behavioral changes with this patch, ("make check" still passes all of the glcpp tests at least). Reviewed-by: Jordan Justen <[email protected]>
Diffstat (limited to 'src/glsl/glcpp/tests')
0 files changed, 0 insertions, 0 deletions