Skip to content

Commit

Permalink
Fix warning messages from bison #28
Browse files Browse the repository at this point in the history
Warning messages appeared due to an update of the bison parser version.
This commit modifies libfwparser/fw_parser.y file according to the
documentation for the new version of bison.
  • Loading branch information
saushew authored and taitov committed Oct 6, 2023
1 parent a395ed3 commit 2d30d83
Showing 1 changed file with 29 additions and 16 deletions.
45 changes: 29 additions & 16 deletions libfwparser/fw_parser.y
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// require bison version 3.2+
//%require "3.2"
%require "3.0"
%require "3.2"

// generate C++ source code
%language "C++"
Expand All @@ -9,8 +8,7 @@
%define api.namespace {ipfw}

// define custom parser class name
//%define api.parser.class {fw_parser_t} // for bison 3.2+
%define parser_class_name {fw_parser_t} // for bison 3.0
%define api.parser.class {fw_parser_t}

// define type of semantic values
%define api.value.type variant
Expand Down Expand Up @@ -134,13 +132,15 @@
SRCPORT DSTPORT SRCIP DSTIP EQUAL COMMA MINUS EOL M4LQ M4RQ DUMP

// QUEUE could be an argument to *MASK
%nonassoc QUEUE
%nonassoc MASK FLOWMASK SCHEDMASK
%precedence QUEUE
%precedence MASK FLOWMASK SCHEDMASK

%%

commands:
| commands command
commands:
%empty
|
commands command
;
command:
LABEL EOL
Expand Down Expand Up @@ -187,7 +187,7 @@ dnsstate:
ACTUAL | STALE
;
dnsusers:
/* user may not be specified */
%empty // user may not be specified
|
dnsuser
|
Expand Down Expand Up @@ -272,6 +272,7 @@ actionmod:
log
;
comment:
%empty
|
COMMENT
{
Expand Down Expand Up @@ -301,6 +302,7 @@ createtable:
TABLE newtable CREATE tablespec EOL
;
defaulttableconfig:
%empty
{
cfg.create_skipto_table();
}
Expand All @@ -321,7 +323,11 @@ newtable:
cfg.set_table($1);
}
;
endtable: { } ;
endtable:
%empty
{
}
;

tablespec:
tablespecopt
Expand Down Expand Up @@ -400,7 +406,7 @@ tablevaluetype:
}
;
tableopts:
/* empty table value */
%empty
{
cfg.fill_table_entry_value("");
}
Expand Down Expand Up @@ -462,6 +468,7 @@ tablerec:
}
;
rulenumber:
%empty
{
cfg.fill_rule_number(0);
}
Expand Down Expand Up @@ -760,6 +767,7 @@ tag:
}
;
tagunique:
%empty
{
}
;
Expand All @@ -769,6 +777,7 @@ log:
LOG set_have_log logopts
;
set_have_log:
%empty
{
cfg.set_rule_log();
}
Expand Down Expand Up @@ -874,8 +883,8 @@ protoset:
;
statement: statementpre statementbody statementpost;

statementpre: { };
statementpost: { };
statementpre: %empty { };
statementpost: %empty { };

statementbody:
statementtoken
Expand Down Expand Up @@ -1049,12 +1058,14 @@ statementset:
statementset COMMA statementtoken
;
srcports:
%empty
|
portsoption
|
SRCPORT portsoption
;
dstports:
%empty
|
portsoption
;
Expand Down Expand Up @@ -1108,7 +1119,7 @@ porttoken:
}
;
options:
/* no options */
%empty
|
optiontoken options
|
Expand Down Expand Up @@ -1389,6 +1400,7 @@ optiontoken:
}
;
fragspec:
%empty
{
cfg.set_rule_flag(rule_t::ipoff_flags_t::OFFSET);
}
Expand Down Expand Up @@ -1494,6 +1506,7 @@ statename:
{
}
|
%empty
{
}
;
Expand Down Expand Up @@ -1795,7 +1808,7 @@ RPORTrangepaddr:
RANGE | SOCKADDR4 MINUS NUMBER
;
RPORTrangeraddr:
| IP | SOCKADDR4 MINUS NUMBER
%empty | IP | SOCKADDR4 MINUS NUMBER
;
RPORTsingleladdr:
RPORTladdr | RPORTladdr COMMA RPORTsingleladdr
Expand All @@ -1807,7 +1820,7 @@ RPORTsinglepaddr:
NUMBER | SOCKADDR4
;
RPORTsingleraddr:
| IP | SOCKADDR4
%empty | IP | SOCKADDR4
;
RAspec:
RAlocaladdr IP
Expand Down

0 comments on commit 2d30d83

Please sign in to comment.