Skip to content

Commit

Permalink
Support for 'bool' type in P4_14
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Dodd committed May 3, 2017
1 parent ca3c7c9 commit 6cf7149
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions frontends/p4-14/p4-14-lex.l
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ static int saveState = -1;
"attribute" { yylval.str = yytext; BEGIN(saveState); return ATTRIBUTE; }
"attributes" { yylval.str = yytext; BEGIN(saveState); return ATTRIBUTES; }
"bit" { yylval.str = yytext; BEGIN(saveState); return BIT; }
"bool" { yylval.str = yytext; BEGIN(saveState); return BOOL; }
"blackbox" { yylval.str = yytext; BEGIN(saveState); return BLACKBOX; }
"blackbox_type" { yylval.str = yytext; BEGIN(saveState); return BLACKBOX_TYPE; }
"block" { yylval.str = yytext; BEGIN(saveState); return BLOCK; }
Expand Down
5 changes: 3 additions & 2 deletions frontends/p4-14/p4-14-parse.ypp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ static const IR::Annotations *getPragmas() {
}

%token<str> ACTION ACTIONS ACTION_PROFILE ACTION_SELECTOR ALGORITHM APPLY
ATTRIBUTE ATTRIBUTES BIT BLACKBOX BLACKBOX_TYPE BLOCK
ATTRIBUTE ATTRIBUTES BIT BLACKBOX BLACKBOX_TYPE BLOCK BOOL
CALCULATED_FIELD CONTROL COUNTER CURRENT DEFAULT DEFAULT_ACTION
DIRECT DROP DYNAMIC_ACTION_SELECTION ELSE EXTRACT EXPRESSION
EXPRESSION_LOCAL_VARIABLES FALSE
Expand Down Expand Up @@ -268,6 +268,7 @@ type: BIT { $$ = IR::Type::Bits::get(@1, 1); }
BUG("%1$: Value too large", @3);
$$ = IR::Type::Bits::get(@3, $3->asInt()); }
| BLOCK { $$ = IR::Type_Block::get(); }
| BOOL { $$ = IR::Type_Boolean::get(); }
| COUNTER { $$ = IR::Type_Counter::get(); }
| EXPRESSION { $$ = IR::Type_Expression::get(); }
| FIELD_LIST_CALCULATION { $$ = IR::Type_FieldListCalculation::get(); }
Expand Down Expand Up @@ -894,7 +895,7 @@ opt_expression_list: /* epsilon */ { $$ = nullptr; } | expression_list

name: IDENTIFIER
| ACTION | ACTIONS | ACTION_PROFILE | ACTION_SELECTOR | ALGORITHM
| ATTRIBUTE | ATTRIBUTES | BIT | BLACKBOX | BLACKBOX_TYPE | BLOCK
| ATTRIBUTE | ATTRIBUTES | BIT | BLACKBOX | BLACKBOX_TYPE | BLOCK | BOOL
| CALCULATED_FIELD | CONTROL | COUNTER | DEFAULT_ACTION
| DIRECT | DROP | DYNAMIC_ACTION_SELECTION | EXPRESSION | EXPRESSION_LOCAL_VARIABLES
| EXTRACT | FIELD_LIST
Expand Down

0 comments on commit 6cf7149

Please sign in to comment.