--- l2_spec_parse.y 2001/11/08 21:58:00 1.4
+++ l2_spec_parse.y 2001/12/14 12:42:07 1.5
@@ -48,8 +48,7 @@
/* generate verbose error messages and remember them inside the context */
#undef yyerror
#define yyerror(msg) \
- do { l2_env_errorinfo(CTX->env, L2_ERR_ARG, "%s", msg); \
- CTX->rv = L2_ERR_ARG; } while (0)
+ l2_spec_error(CTX, L2_ERR_SYN, &yylloc, msg)
#define YYERROR_VERBOSE
/* scanner state transition */
@@ -107,14 +106,14 @@
| channel T_OP_ARROW stream {
$$ = $1;
if ((CTX->rv = l2_channel_link($1, L2_LINK_CHILD, $3, NULL)) != L2_OK) {
- l2_env_errorinfo(CTX->env, CTX->rv, "unable to link parent with child");
+ l2_spec_error(CTX, CTX->rv, &yylloc, "unable to link parent with child");
YYERROR;
}
}
| channel T_OP_ARROW '{' streams '}' {
$$ = $1;
if ((CTX->rv = l2_channel_link($1, L2_LINK_CHILD, $4, NULL)) != L2_OK) {
- l2_env_errorinfo(CTX->env, CTX->rv, "unable to link parent with child list");
+ l2_spec_error(CTX, CTX->rv, &yylloc, "unable to link parent with child list");
YYERROR;
}
}
@@ -128,7 +127,7 @@
| stream ';' streams {
$$ = $1;
if ((CTX->rv = l2_channel_link($1, L2_LINK_SIBLING, $3, NULL)) != L2_OK) {
- l2_env_errorinfo(CTX->env, CTX->rv, "unable to link childs together");
+ l2_spec_error(CTX, CTX->rv, &yylloc, "unable to link childs together");
YYERROR;
}
}
@@ -139,14 +138,14 @@
: channel_level '/' channel_level ':' channel_cons {
$$ = $5;
if ((CTX->rv = l2_channel_levels($5, $1, $3)) != L2_OK) {
- l2_env_errorinfo(CTX->env, CTX->rv, "failed to set channel write and flush levels");
+ l2_spec_error(CTX, CTX->rv, &yylloc, "failed to set channel write and flush levels");
YYERROR;
}
}
| channel_level ':' channel_cons {
$$ = $3;
if ((CTX->rv = l2_channel_levels($3, $1, L2_LEVEL_NONE)) != L2_OK) {
- l2_env_errorinfo(CTX->env, CTX->rv, "failed to set channel write levels");
+ l2_spec_error(CTX, CTX->rv, &yylloc, "failed to set channel write levels");
YYERROR;
}
}
@@ -160,7 +159,7 @@
: T_ID {
unsigned int levelmask;
if ((CTX->rv = l2_util_s2l($1, strlen($1), ',', &levelmask)) != L2_OK) {
- l2_env_errorinfo(CTX->env, CTX->rv, "invalid level '%s'", $1);
+ l2_spec_error(CTX, CTX->rv, &yylloc, "invalid level '%s'", $1);
YYERROR;
}
$$ = L2_LEVEL_UPTO(levelmask);
@@ -175,7 +174,7 @@
: T_ID {
unsigned int levelmask;
if ((CTX->rv = l2_util_s2l($1, strlen($1), ',', &levelmask)) != L2_OK) {
- l2_env_errorinfo(CTX->env, CTX->rv, "invalid level '%s'", $1);
+ l2_spec_error(CTX, CTX->rv, &yylloc, "invalid level '%s'", $1);
YYERROR;
}
$$ = levelmask;
@@ -183,7 +182,7 @@
| T_ID '|' channel_level_mask {
unsigned int levelmask;
if ((CTX->rv = l2_util_s2l($1, strlen($1), ',', &levelmask)) != L2_OK) {
- l2_env_errorinfo(CTX->env, CTX->rv, "invalid level '%s'", $1);
+ l2_spec_error(CTX, CTX->rv, &yylloc, "invalid level '%s'", $1);
YYERROR;
}
$$ = levelmask | $3;
@@ -195,7 +194,7 @@
: T_ID {
l2_channel_t *ch;
if ((CTX->rv = l2_channel_create(&ch, CTX->env, $1)) != L2_OK) {
- l2_env_errorinfo(CTX->env, CTX->rv, "failed to create channel '%s'", $1);
+ l2_spec_error(CTX, CTX->rv, &yylloc, "failed to create channel '%s'", $1);
YYERROR;
}
$$ = ch;
@@ -214,13 +213,13 @@
/* channel parameters */
channel_params
: /* empty */
+ | '(' ')'
| '(' channel_param_list ')'
;
/* channel parameter list */
channel_param_list
- : /* empty */
- | channel_param
+ : channel_param
| channel_param ',' channel_param_list
;
@@ -228,7 +227,7 @@
channel_param
: T_ID '=' { l2_spec_scan_push(CTX, "SS_PARAM"); } T_PARAM { l2_spec_scan_pop(CTX); } {
if ((CTX->rv = l2_channel_configure(CTX->chTmp, "%s=\"%s\"", $1, $4)) != L2_OK) {
- l2_env_errorinfo(CTX->env, CTX->rv, "failed to configure channel with '%s=\"%s\"'", $1, $4);
+ l2_spec_error(CTX, CTX->rv, &yylloc, "failed to configure channel with '%s=\"%s\"'", $1, $4);
YYERROR;
}
}
|