Browse code

- fixed parse error for if (cond) a(); else b(); - fixed dbg. config dumping

Andrei Pelinescu-Onciul authored on 16/11/2005 21:37:20
Showing 3 changed files
... ...
@@ -61,7 +61,7 @@ MAIN_NAME=ser
61 61
 VERSION = 0
62 62
 PATCHLEVEL = 10
63 63
 SUBLEVEL =   99
64
-EXTRAVERSION = -dev21-tcp
64
+EXTRAVERSION = -dev22-tcp
65 65
 
66 66
 RELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
67 67
 OS = $(shell uname -s | sed -e s/SunOS/solaris/ | tr "[A-Z]" "[a-z]")
... ...
@@ -63,6 +63,7 @@
63 63
  * 2005-07-11 added DNS_RETR_TIME, DNS_RETR_NO, DNS_SERVERS_NO, DNS_USE_SEARCH,
64 64
  *             DNS_TRY_IPV6 (andrei)
65 65
  * 2005-07-12  default onreply route added (andrei)
66
+ * 2005-11-16  fixed if (cond) cmd; (andrei)
66 67
  *
67 68
  */
68 69
 
... ...
@@ -304,7 +305,7 @@ static struct socket_id* mk_listen_id(char*, int, int);
304 304
 
305 305
 /*non-terminals */
306 306
 %type <expr> exp exp_elem /*, condition*/
307
-%type <action> action actions cmd if_cmd stm
307
+%type <action> action actions cmd if_cmd stm exp_stm
308 308
 %type <ipaddr> ipv4 ipv6 ipv6addr ip
309 309
 %type <ipnet> ipnet
310 310
 %type <strval> host
... ...
@@ -338,7 +339,6 @@ statement:	assign_stm
338 338
 		| {rt=FAILURE_ROUTE;} failure_route_stm
339 339
 		| {rt=ONREPLY_ROUTE;} onreply_route_stm
340 340
 		| {rt=BRANCH_ROUTE;} branch_route_stm
341
-
342 341
 		| CR	/* null statement*/
343 342
 	;
344 343
 
... ...
@@ -1050,7 +1050,7 @@ exp_elem:	METHOD strop STRING	{$$= mk_elem(	$2, STRING_ST,
1050 1050
 		| MYSELF error	{ $$=0; 
1051 1051
 							yyerror ("invalid operator, == or != expected");
1052 1052
 						}
1053
-		| stm				{ $$=mk_elem( NO_OP, ACTIONS_ST, ACTION_O, $1 ); }
1053
+		| exp_stm			{ $$=mk_elem( NO_OP, ACTIONS_ST, ACTION_O, $1 );  }
1054 1054
 		| NUMBER		{$$=mk_elem( NO_OP, NUMBER_ST, NUMBER_O, (void*)$1 ); }
1055 1055
 	;
1056 1056
 
... ...
@@ -1095,11 +1095,15 @@ host:	ID				{ $$=$1; }
1095 1095
 	;
1096 1096
 
1097 1097
 
1098
-stm:		cmd						{ $$=$1; }
1098
+exp_stm:	cmd						{ $$=$1; }
1099 1099
 		|	if_cmd					{ $$=$1; }
1100 1100
 		|	LBRACE actions RBRACE	{ $$=$2; }
1101 1101
 	;
1102 1102
 
1103
+stm:		action					{ $$=$1; }
1104
+		|	LBRACE actions	RBRACE	{ $$=$2; }
1105
+	;
1106
+
1103 1107
 actions:	actions action	{$$=append_action($1, $2); }
1104 1108
 		| action			{$$=$1;}
1105 1109
 		| actions error { $$=0; yyerror("bad command"); }
... ...
@@ -162,10 +162,12 @@ void print_expr(struct expr* exp)
162 162
 			case DSTIP_O:
163 163
 				DBG("dstip");
164 164
 				break;
165
+			case DSTPORT_O:
166
+				DBG("dstport");
167
+				break;
165 168
 			case NUMBER_O:
166 169
 				break;
167 170
 			case ACTION_O:
168
-				print_action((struct action*) exp->r.param);
169 171
 				break;
170 172
 			default:
171 173
 				DBG("UNKNOWN");
... ...
@@ -179,6 +181,21 @@ void print_expr(struct expr* exp)
179 179
 				break;
180 180
 			case NO_OP:
181 181
 				break;
182
+			case GT_OP:
183
+				DBG(">");
184
+				break;
185
+			case GTE_OP:
186
+				DBG(">=");
187
+				break;
188
+			case LT_OP:
189
+				DBG("<");
190
+				break;
191
+			case LTE_OP:
192
+				DBG("<=");
193
+				break;
194
+			case DIFF_OP:
195
+				DBG("!=");
196
+				break;
182 197
 			default:
183 198
 				DBG("<UNKNOWN>");
184 199
 		}