@@ -1828,18 +1828,24 @@ bool read_body_assignment(char *token,
18281828 return false;
18291829}
18301830
1831- int read_numeric_sconstant ()
1831+ int read_primary_constant ()
18321832{
18331833 /* return signed constant */
18341834 int isneg = 0 , res ;
18351835 char buffer [10 ];
18361836 if (lex_accept (T_minus ))
18371837 isneg = 1 ;
1838- if (lex_peek (T_numeric , buffer ))
1838+ if (lex_accept (T_open_bracket )) {
1839+ res = read_primary_constant ();
1840+ lex_expect (T_close_bracket );
1841+ } else if (lex_peek (T_numeric , buffer )) {
18391842 res = read_numeric_constant (buffer );
1840- else
1843+ lex_expect (T_numeric );
1844+ } else if (lex_peek (T_char , buffer )) {
1845+ res = buffer [0 ];
1846+ lex_expect (T_char );
1847+ } else
18411848 error ("Invalid value after assignment" );
1842- lex_expect (T_numeric );
18431849 if (isneg )
18441850 return (-1 ) * res ;
18451851 return res ;
@@ -1879,6 +1885,18 @@ int eval_expression_imm(opcode_t op, int op1, int op2)
18791885 case OP_rshift :
18801886 res = op1 >> op2 ;
18811887 break ;
1888+ case OP_log_and :
1889+ res = op1 && op2 ;
1890+ break ;
1891+ case OP_log_or :
1892+ res = op1 || op2 ;
1893+ break ;
1894+ case OP_eq :
1895+ res = op1 == op2 ;
1896+ break ;
1897+ case OP_neq :
1898+ res = op1 != op2 ;
1899+ break ;
18821900 case OP_lt :
18831901 res = op1 < op2 ? 1 : 0 ;
18841902 break ;
@@ -1929,7 +1947,7 @@ bool read_global_assignment(char *token)
19291947 int val_stack [10 ];
19301948 int op_stack_index = 0 , val_stack_index = 0 ;
19311949 int operand1 , operand2 ;
1932- operand1 = read_numeric_sconstant ();
1950+ operand1 = read_primary_constant ();
19331951 op = get_operator ();
19341952 /* only one value after assignment */
19351953 if (op == OP_generic ) {
@@ -1955,7 +1973,7 @@ bool read_global_assignment(char *token)
19551973 eval_ternary_imm (operand1 , token );
19561974 return true;
19571975 }
1958- operand2 = read_numeric_sconstant ();
1976+ operand2 = read_primary_constant ();
19591977 next_op = get_operator ();
19601978 if (next_op == OP_generic ) {
19611979 /* only two operands, apply and return */
@@ -2013,7 +2031,7 @@ bool read_global_assignment(char *token)
20132031 } while (op_stack_index > 0 && same_op == 0 );
20142032 }
20152033 /* push next operand on stack */
2016- val_stack [val_stack_index ++ ] = read_numeric_sconstant ();
2034+ val_stack [val_stack_index ++ ] = read_primary_constant ();
20172035 /* push operator on stack */
20182036 op_stack [op_stack_index ++ ] = op ;
20192037 op = get_operator ();
0 commit comments