diff options
author | Ian Romanick <ian.d.romanick@intel.com> | 2010-02-22 19:10:25 -0800 |
---|---|---|
committer | Ian Romanick <ian.d.romanick@intel.com> | 2010-02-22 19:10:25 -0800 |
commit | 88349b22caa0ab0b44188dbb9e002549aadb0590 (patch) | |
tree | e308a20dca7272e48a4de3539708e0f0cf2c3d9a /glsl_parser_extras.cpp | |
parent | 89227f6ce40aa34d77fb61edbd32e522afc6e493 (diff) |
Add ast_expression_bin subclass of ast_expression
The ast_expression_bin subclass is used for all binary expressions
such as addition, subtraction, and comparisons. Several other
subclasses are soon to follow.
Diffstat (limited to 'glsl_parser_extras.cpp')
-rw-r--r-- | glsl_parser_extras.cpp | 74 |
1 files changed, 7 insertions, 67 deletions
diff --git a/glsl_parser_extras.cpp b/glsl_parser_extras.cpp index 36a6ca8..a0fad52 100644 --- a/glsl_parser_extras.cpp +++ b/glsl_parser_extras.cpp @@ -239,72 +239,8 @@ ast_compound_statement::ast_compound_statement(int new_scope, void ast_expression::print(void) const { - static const char *const operators[] = { - "=", - "+", - "-", - "+", - "-", - "*", - "/", - "%", - "<<", - ">>", - "<", - ">", - "<=", - ">=", - "==", - "!=", - "&", - "^", - "|", - "~", - "&&", - "^^", - "!", - - "*=", - "/=", - "%=", - "+=", - "-=", - "<<=", - ">>=", - "&=", - "^=", - "|=", - - "?:", - "++", - "--", - "++", - "--", - ".", - }; - - switch (oper) { case ast_assign: - case ast_add: - case ast_sub: - case ast_mul: - case ast_div: - case ast_mod: - case ast_lshift: - case ast_rshift: - case ast_less: - case ast_greater: - case ast_lequal: - case ast_gequal: - case ast_equal: - case ast_nequal: - case ast_bit_and: - case ast_bit_xor: - case ast_bit_or: - case ast_logic_and: - case ast_logic_xor: - case ast_logic_or: case ast_mul_assign: case ast_div_assign: case ast_mod_assign: @@ -316,7 +252,7 @@ ast_expression::print(void) const case ast_xor_assign: case ast_or_assign: subexpressions[0]->print(); - printf("%s ", operators[oper]); + printf("%s ", operator_string(oper)); subexpressions[1]->print(); break; @@ -331,14 +267,14 @@ ast_expression::print(void) const case ast_logic_not: case ast_pre_inc: case ast_pre_dec: - printf("%s ", operators[oper]); + printf("%s ", operator_string(oper)); subexpressions[0]->print(); break; case ast_post_inc: case ast_post_dec: subexpressions[0]->print(); - printf("%s ", operators[oper]); + printf("%s ", operator_string(oper)); break; case ast_conditional: @@ -412,6 +348,10 @@ ast_expression::print(void) const printf(") "); break; } + + default: + assert(0); + break; } } |