--- l2_spec_parse.y 2003/01/06 11:19:45 1.9
+++ l2_spec_parse.y 2003/01/06 11:41:52 1.10
@@ -1,10 +1,11 @@
%{
/*
-** OSSP l2 - Logging Library
-** Copyright (c) 2001-2002 The OSSP Project (http://www.ossp.org/)
-** Copyright (c) 2001-2002 Cable & Wireless Deutschland (http://www.cw.com/de/)
+** OSSP l2 - Flexible Logging
+** Copyright (c) 2001-2003 Cable & Wireless Deutschland GmbH
+** Copyright (c) 2001-2003 The OSSP Project (http://www.ossp.org/)
+** Copyright (c) 2001-2003 Ralf S. Engelschall <rse@engelschall.com>
**
-** This file is part of OSSP L2, a flexible logging library which
+** This file is part of OSSP l2, a flexible logging library which
** can be found at http://www.ossp.org/pkg/lib/l2/.
**
** Permission to use, copy, modify, and distribute this software for
@@ -39,10 +40,10 @@
#define YYPARSE_PARAM ctx
#define YYLEX_PARAM CTX->yyscan
-/* provide an explicit prototype for the yylex() function but use
- "void *" instead of correct type because at this point in the
+/* provide an explicit prototype for the yylex() function but use
+ "void *" instead of correct type because at this point in the
generation process we have the types still not available */
-extern int yylex(/*YYSTYPE*/ void *lvalp,
+extern int yylex(/*YYSTYPE*/ void *lvalp,
/*YYLTYPE*/ void *llocp, l2_spec_ctx_t *ctx);
/* generate verbose error messages and remember them inside the context */
@@ -85,7 +86,7 @@
/* operator association */
%right T_OP_ARROW
-/* grammar start rule
+/* grammar start rule
(technically redundant but explicit to be sure) */
%start tree
@@ -93,10 +94,10 @@
/* channel tree */
tree
- : stream {
+ : stream {
CTX->ch = $1;
}
- ;
+ ;
/* stream of channels */
stream
@@ -108,18 +109,18 @@
}
$$ = ch;
}
- | channel {
- $$ = $1;
+ | channel {
+ $$ = $1;
}
- | channel T_OP_ARROW stream {
- $$ = $1;
+ | channel T_OP_ARROW stream {
+ $$ = $1;
if ((CTX->rv = l2_channel_link($1, L2_LINK_CHILD, $3, NULL)) != L2_OK) {
l2_spec_error(CTX, CTX->rv, &yylloc, "unable to link parent with child");
YYERROR;
}
}
- | channel T_OP_ARROW '{' streams '}' {
- $$ = $1;
+ | channel T_OP_ARROW '{' streams '}' {
+ $$ = $1;
if ((CTX->rv = l2_channel_link($1, L2_LINK_CHILD, $4, NULL)) != L2_OK) {
l2_spec_error(CTX, CTX->rv, &yylloc, "unable to link parent with child list");
YYERROR;
@@ -129,11 +130,11 @@
/* list of sibling streams */
streams
- : stream {
- $$ = $1;
+ : stream {
+ $$ = $1;
}
- | stream ';' streams {
- $$ = $1;
+ | stream ';' streams {
+ $$ = $1;
if ((CTX->rv = l2_channel_link($1, L2_LINK_SIBLING, $3, NULL)) != L2_OK) {
l2_spec_error(CTX, CTX->rv, &yylloc, "unable to link childs together");
YYERROR;
@@ -143,28 +144,28 @@
/* channel */
channel
- : channel_level '/' channel_level ':' channel_cons {
- $$ = $5;
+ : channel_level '/' channel_level ':' channel_cons {
+ $$ = $5;
if ((CTX->rv = l2_channel_levels($5, $1, $3)) != L2_OK) {
l2_spec_error(CTX, CTX->rv, &yylloc, "failed to set channel write and flush levels");
YYERROR;
}
}
- | channel_level ':' channel_cons {
- $$ = $3;
+ | channel_level ':' channel_cons {
+ $$ = $3;
if ((CTX->rv = l2_channel_levels($3, $1, L2_LEVEL_NONE)) != L2_OK) {
l2_spec_error(CTX, CTX->rv, &yylloc, "failed to set channel write levels");
YYERROR;
}
}
- | channel_cons {
+ | channel_cons {
$$ = $1;
}
;
/* channel level */
channel_level
- : T_ID {
+ : T_ID {
unsigned int levelmask;
if ((CTX->rv = l2_util_s2l($1, strlen($1), ',', &levelmask)) != L2_OK) {
l2_spec_error(CTX, CTX->rv, &yylloc, "invalid level '%s'", $1);
@@ -172,14 +173,14 @@
}
$$ = L2_LEVEL_UPTO(levelmask);
}
- | '(' channel_level_mask ')' {
- $$ = $2;
+ | '(' channel_level_mask ')' {
+ $$ = $2;
}
;
/* channel level mask */
-channel_level_mask
- : T_ID {
+channel_level_mask
+ : T_ID {
unsigned int levelmask;
if ((CTX->rv = l2_util_s2l($1, strlen($1), ',', &levelmask)) != L2_OK) {
l2_spec_error(CTX, CTX->rv, &yylloc, "invalid level '%s'", $1);
@@ -187,19 +188,19 @@
}
$$ = levelmask;
}
- | T_ID '|' channel_level_mask {
+ | T_ID '|' channel_level_mask {
unsigned int levelmask;
if ((CTX->rv = l2_util_s2l($1, strlen($1), ',', &levelmask)) != L2_OK) {
l2_spec_error(CTX, CTX->rv, &yylloc, "invalid level '%s'", $1);
YYERROR;
}
- $$ = levelmask | $3;
+ $$ = levelmask | $3;
}
;
/* channel constructor */
-channel_cons
- : T_ID {
+channel_cons
+ : T_ID {
l2_channel_t *ch;
if ((CTX->rv = l2_channel_create(&ch, CTX->env, $1)) != L2_OK) {
l2_spec_error(CTX, CTX->rv, &yylloc, "failed to create channel '%s'", $1);
@@ -210,36 +211,36 @@
not know where on the token stack our $$ is because it is a
sub-rule of the recursive channel_param_list rule and hence
cannot use "$<chChannel>-n". */
- CTX->chTmp = ch;
+ CTX->chTmp = ch;
}
- channel_params {
+ channel_params {
$$ = $<chChannel>2; /* pass-through result */
CTX->chTmp = NULL;
}
;
/* channel parameters */
-channel_params
+channel_params
: /* empty */
| '(' ')'
| '(' channel_param_list ')'
;
/* channel parameter list */
-channel_param_list
+channel_param_list
: channel_param
| channel_param ',' channel_param_list
;
-
+
/* channel parameter */
-channel_param
- : T_ID '=' { l2_spec_scan_push(CTX, "SS_PARAM"); } T_PARAM { l2_spec_scan_pop(CTX); } {
+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_spec_error(CTX, CTX->rv, &yylloc, "failed to configure channel with '%s=\"%s\"'", $1, $4);
YYERROR;
}
}
;
-
+
%%
|