summaryrefslogtreecommitdiff
path: root/tools/d2c/d2c_gram.y
diff options
context:
space:
mode:
Diffstat (limited to 'tools/d2c/d2c_gram.y')
-rw-r--r--tools/d2c/d2c_gram.y22
1 files changed, 13 insertions, 9 deletions
diff --git a/tools/d2c/d2c_gram.y b/tools/d2c/d2c_gram.y
index 9e1e034..5d83930 100644
--- a/tools/d2c/d2c_gram.y
+++ b/tools/d2c/d2c_gram.y
@@ -143,11 +143,11 @@ struct action_tmp
%token SYNTAX OPERAND_NAME OPERAND_INTERNAL OPERAND_VISIBLE
-%token CONV EQ OP COMMA CP NOT EOR COLON
+%token CONV EQ OP COMMA CP NOT AND_LOG EOR COLON
%token HOOKS
-%token RULES IF EXPR_START EQUAL BINVAL IMMVAL EXPR_END AND THEN SEE CALL UNPREDICTABLE
+%token RULES IF EXPR_START EQUAL BINVAL HEXVAL EXPR_END AND THEN SEE CALL CHK_CALL UNPREDICTABLE
%type <string> COPYRIGHT INS_NAME
@@ -170,7 +170,7 @@ struct action_tmp
%type <string> arg_field
%type <expr> rule_cond
-%type <string> BINVAL IMMVAL
+%type <string> BINVAL HEXVAL
%type <raction> action
@@ -248,7 +248,8 @@ arg_expr : NAME { $$ = build_arg_expr_from_n
arg_expr_un_op : NOT { $$ = CUO_NOT; }
-arg_expr_bin_op : EOR { $$ = CBO_EOR; }
+arg_expr_bin_op : AND_LOG { $$ = CBO_AND; }
+ | EOR { $$ = CBO_EOR; }
arg_composed : arg_field COLON arg_field { $$ = build_composed_arg_expr($1, $3); }
| arg_composed COLON arg_field { $$ = extend_composed_arg_expr($1, $3); }
@@ -273,14 +274,17 @@ rules_list : /* empty */
rule : IF EXPR_START rule_cond EXPR_END THEN action { add_conditional_rule_to_coder(coder, $3, &$6); }
| action { add_conditional_rule_to_coder(coder, NULL, &$1); }
-rule_cond : NAME EQUAL BINVAL { $$ = build_simple_cond_expression($1, CCT_EQUAL, $3); }
- | NAME EQUAL IMMVAL { $$ = build_simple_cond_expression($1, CCT_EQUAL, $3); }
+rule_cond : NAME EQUAL BINVAL { $$ = build_simple_cond_expression($1, CCT_EQUAL, $3, true); }
+ | NAME EQUAL HEXVAL { $$ = build_simple_cond_expression($1, CCT_EQUAL, $3, false); }
+ | NAME AND_LOG BINVAL { $$ = build_simple_cond_expression($1, CCT_AND, $3, true); }
+ | NAME AND_LOG HEXVAL { $$ = build_simple_cond_expression($1, CCT_AND, $3, false); }
| EXPR_START rule_cond EXPR_END AND EXPR_START rule_cond EXPR_END
{ $$ = build_composed_cond_expression($2, COT_AND, $6); }
-action : SEE INS_DETAILS { $$.type = CAT_SEE; $$.details = make_callable($2, false); }
- | UNPREDICTABLE { $$.type = CAT_UNPREDICTABLE; }
- | CALL NAME OP arg_list CP { $$.type = CAT_CALL; $$.callee = $2; $$.args = $4; }
+action : SEE INS_DETAILS { $$.type = CAT_SEE; $$.details = make_callable($2, false); }
+ | UNPREDICTABLE { $$.type = CAT_UNPREDICTABLE; }
+ | CALL NAME OP arg_list CP { $$.type = CAT_CALL; $$.callee = $2; $$.args = $4; }
+ | CHK_CALL NAME OP arg_list CP { $$.type = CAT_CHECKED_CALL; $$.callee = $2; $$.args = $4; }
%%