diff options
author | Carl Worth <cworth@cworth.org> | 2010-05-24 10:37:38 -0700 |
---|---|---|
committer | Carl Worth <cworth@cworth.org> | 2010-05-24 10:37:38 -0700 |
commit | bcbd587b0f5312d85307785ee2df6e5906af4f7b (patch) | |
tree | b44d1115168ddf3bb401c56a1938a6813718cbdc /glcpp-lex.l | |
parent | b20d33c5c6fea8e392c26e9ab060efd14034f1f9 (diff) |
Implement all operators specified for GLSL #if expressions (with tests).
The operator coverage here is quite complete. The one big thing
missing is that we are not yet doing macro expansion in #if
lines. This makes the whole support fairly useless, so we plan to fix
that shortcoming right away.
Diffstat (limited to 'glcpp-lex.l')
-rw-r--r-- | glcpp-lex.l | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/glcpp-lex.l b/glcpp-lex.l index 825ce3d370..84166fb76f 100644 --- a/glcpp-lex.l +++ b/glcpp-lex.l @@ -66,6 +66,51 @@ TOKEN [^[:space:](),]+ return INTEGER; } +<ST_IF>"defined" { + return DEFINED; +} + +<ST_IF>"<<" { + return LEFT_SHIFT; +} + +<ST_IF>">>" { + return RIGHT_SHIFT; +} + +<ST_IF>"<=" { + return LESS_OR_EQUAL; +} + +<ST_IF>">=" { + return GREATER_OR_EQUAL; +} + +<ST_IF>"==" { + return EQUAL; +} + +<ST_IF>"!=" { + return NOT_EQUAL; +} + +<ST_IF>"&&" { + return AND; +} + +<ST_IF>"||" { + return OR; +} + +<ST_IF>[-+*/%<>&^|()] { + return yytext[0]; +} + +<ST_IF>{IDENTIFIER} { + yylval.str = xtalloc_strdup (yyextra, yytext); + return IDENTIFIER; +} + <ST_IF>{HSPACE}+ <ST_IF>\n { |