MXS-1346: Use a different style for grammar files
The BISON files now use a different style for declaring non-terminal symbols.
This commit is contained in:
@ -51,67 +51,67 @@
|
|||||||
|
|
||||||
%%
|
%%
|
||||||
|
|
||||||
input:
|
input
|
||||||
line_input
|
: line_input
|
||||||
| line_input command { MXS_WARNING("Firewall rules file lacks a trailing newline."); }
|
| line_input command { MXS_WARNING("Firewall rules file lacks a trailing newline."); }
|
||||||
;
|
;
|
||||||
|
|
||||||
line_input:
|
line_input
|
||||||
|
:
|
||||||
| line_input line
|
| line_input line
|
||||||
;
|
;
|
||||||
|
|
||||||
line:
|
line
|
||||||
'\n'
|
: '\n'
|
||||||
| command '\n'
|
| command '\n'
|
||||||
;
|
;
|
||||||
|
|
||||||
command:
|
command
|
||||||
rule
|
: rule
|
||||||
| user
|
| user
|
||||||
| FWTOK_COMMENT
|
| FWTOK_COMMENT
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
rule:
|
rule
|
||||||
FWTOK_RULE rulename {if (!create_rule(scanner, $2)){YYERROR;}} FWTOK_DENY ruleparams
|
: FWTOK_RULE rulename {if (!create_rule(scanner, $2)){YYERROR;}} FWTOK_DENY ruleparams
|
||||||
;
|
;
|
||||||
|
|
||||||
ruleparams:
|
ruleparams
|
||||||
mandatory optional optional
|
: mandatory optional optional
|
||||||
| mandatory optional
|
| mandatory optional
|
||||||
| mandatory
|
| mandatory
|
||||||
| optional
|
| optional
|
||||||
;
|
;
|
||||||
|
|
||||||
rulename:
|
rulename
|
||||||
FWTOK_RULENAME
|
: FWTOK_RULENAME
|
||||||
| FWTOK_STR
|
| FWTOK_STR
|
||||||
;
|
;
|
||||||
|
|
||||||
user:
|
user
|
||||||
FWTOK_USERS userlist FWTOK_MATCH cond FWTOK_RULES namelist
|
: FWTOK_USERS userlist FWTOK_MATCH cond FWTOK_RULES namelist
|
||||||
{if (!create_user_templates(scanner)){YYERROR;}}
|
{if (!create_user_templates(scanner)){YYERROR;}}
|
||||||
;
|
;
|
||||||
|
|
||||||
userlist:
|
userlist
|
||||||
FWTOK_USER {if (!add_active_user(scanner, $1)){YYERROR;}}
|
: FWTOK_USER {if (!add_active_user(scanner, $1)){YYERROR;}}
|
||||||
| userlist FWTOK_USER {if (!add_active_user(scanner, $2)){YYERROR;}}
|
| userlist FWTOK_USER {if (!add_active_user(scanner, $2)){YYERROR;}}
|
||||||
;
|
;
|
||||||
|
|
||||||
namelist:
|
namelist
|
||||||
rulename {if (!add_active_rule(scanner, $1)){YYERROR;}}
|
: rulename {if (!add_active_rule(scanner, $1)){YYERROR;}}
|
||||||
| namelist rulename {if (!add_active_rule(scanner, $2)){YYERROR;}}
|
| namelist rulename {if (!add_active_rule(scanner, $2)){YYERROR;}}
|
||||||
;
|
;
|
||||||
|
|
||||||
cond:
|
cond
|
||||||
FWTOK_ANY {set_matching_mode(scanner, FWTOK_MATCH_ANY);}
|
: FWTOK_ANY {set_matching_mode(scanner, FWTOK_MATCH_ANY);}
|
||||||
| FWTOK_ALL {set_matching_mode(scanner, FWTOK_MATCH_ALL);}
|
| FWTOK_ALL {set_matching_mode(scanner, FWTOK_MATCH_ALL);}
|
||||||
| FWTOK_STRICT_ALL {set_matching_mode(scanner, FWTOK_MATCH_STRICT_ALL);}
|
| FWTOK_STRICT_ALL {set_matching_mode(scanner, FWTOK_MATCH_STRICT_ALL);}
|
||||||
;
|
;
|
||||||
|
|
||||||
mandatory:
|
mandatory
|
||||||
FWTOK_WILDCARD {define_wildcard_rule(scanner);}
|
: FWTOK_WILDCARD {define_wildcard_rule(scanner);}
|
||||||
| FWTOK_WHERE_CLAUSE {define_where_clause_rule(scanner);}
|
| FWTOK_WHERE_CLAUSE {define_where_clause_rule(scanner);}
|
||||||
| FWTOK_LIMIT_QUERIES FWTOK_INT FWTOK_INT FWTOK_INT
|
| FWTOK_LIMIT_QUERIES FWTOK_INT FWTOK_INT FWTOK_INT
|
||||||
{if (!define_limit_queries_rule(scanner, $2, $3, $4)){YYERROR;}}
|
{if (!define_limit_queries_rule(scanner, $2, $3, $4)){YYERROR;}}
|
||||||
@ -122,48 +122,48 @@ mandatory:
|
|||||||
| FWTOK_USES_FUNCTION functionusagelist
|
| FWTOK_USES_FUNCTION functionusagelist
|
||||||
;
|
;
|
||||||
|
|
||||||
columnvalue:
|
columnvalue
|
||||||
FWTOK_BTSTR {if (!define_columns_rule(scanner, $1)){YYERROR;}}
|
: FWTOK_BTSTR {if (!define_columns_rule(scanner, $1)){YYERROR;}}
|
||||||
| FWTOK_STR {if (!define_columns_rule(scanner, $1)){YYERROR;}}
|
| FWTOK_STR {if (!define_columns_rule(scanner, $1)){YYERROR;}}
|
||||||
;
|
;
|
||||||
|
|
||||||
columnlist:
|
columnlist
|
||||||
columnvalue
|
: columnvalue
|
||||||
| columnlist columnvalue
|
| columnlist columnvalue
|
||||||
;
|
;
|
||||||
|
|
||||||
functionvalue:
|
functionvalue
|
||||||
FWTOK_CMP {if (!define_function_rule(scanner, $1)){YYERROR;}}
|
: FWTOK_CMP {if (!define_function_rule(scanner, $1)){YYERROR;}}
|
||||||
| FWTOK_STR {if (!define_function_rule(scanner, $1)){YYERROR;}}
|
| FWTOK_STR {if (!define_function_rule(scanner, $1)){YYERROR;}}
|
||||||
| FWTOK_BTSTR {if (!define_function_rule(scanner, $1)){YYERROR;}}
|
| FWTOK_BTSTR {if (!define_function_rule(scanner, $1)){YYERROR;}}
|
||||||
;
|
;
|
||||||
|
|
||||||
functionlist:
|
functionlist
|
||||||
functionvalue
|
: functionvalue
|
||||||
| functionlist functionvalue
|
| functionlist functionvalue
|
||||||
;
|
;
|
||||||
|
|
||||||
functionusagevalue:
|
functionusagevalue
|
||||||
FWTOK_BTSTR {if (!define_function_usage_rule(scanner, $1)){YYERROR;}}
|
: FWTOK_BTSTR {if (!define_function_usage_rule(scanner, $1)){YYERROR;}}
|
||||||
| FWTOK_STR {if (!define_function_usage_rule(scanner, $1)){YYERROR;}}
|
| FWTOK_STR {if (!define_function_usage_rule(scanner, $1)){YYERROR;}}
|
||||||
|
|
||||||
functionusagelist:
|
functionusagelist
|
||||||
functionusagevalue
|
: functionusagevalue
|
||||||
| functionusagelist functionusagevalue
|
| functionusagelist functionusagevalue
|
||||||
;
|
;
|
||||||
|
|
||||||
/** Optional parts of a rule */
|
/** Optional parts of a rule */
|
||||||
optional:
|
optional
|
||||||
FWTOK_AT_TIMES timelist
|
: FWTOK_AT_TIMES timelist
|
||||||
| FWTOK_ON_QUERIES orlist
|
| FWTOK_ON_QUERIES orlist
|
||||||
;
|
;
|
||||||
|
|
||||||
timelist:
|
timelist
|
||||||
FWTOK_TIME {if (!add_at_times_rule(scanner, $1)){YYERROR;}}
|
: FWTOK_TIME {if (!add_at_times_rule(scanner, $1)){YYERROR;}}
|
||||||
| timelist FWTOK_TIME {if (!add_at_times_rule(scanner, $2)){YYERROR;}}
|
| timelist FWTOK_TIME {if (!add_at_times_rule(scanner, $2)){YYERROR;}}
|
||||||
;
|
;
|
||||||
|
|
||||||
orlist:
|
orlist
|
||||||
FWTOK_SQLOP {add_on_queries_rule(scanner, $1);}
|
: FWTOK_SQLOP {add_on_queries_rule(scanner, $1);}
|
||||||
| orlist FWTOK_PIPE FWTOK_SQLOP {add_on_queries_rule(scanner, $3);}
|
| orlist FWTOK_PIPE FWTOK_SQLOP {add_on_queries_rule(scanner, $3);}
|
||||||
;
|
;
|
||||||
|
Reference in New Issue
Block a user