diff options
Diffstat (limited to 'src/meta1gram.y')
-rw-r--r-- | src/meta1gram.y | 43 |
1 files changed, 20 insertions, 23 deletions
diff --git a/src/meta1gram.y b/src/meta1gram.y index 6256448..deaf382 100644 --- a/src/meta1gram.y +++ b/src/meta1gram.y @@ -1,6 +1,6 @@ %{ /* MeTA1 configuration parser for GNU Pies. - Copyright (C) 2008, 2009, 2010 Sergey Poznyakoff + Copyright (C) 2008, 2009, 2010, 2011 Sergey Poznyakoff GNU Pies is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,7 +20,9 @@ configuration statements. */ #include "pies.h" +#include "grecs-locus.h" #include "meta1lex.h" +#include "meta1gram.h" #define META1_QUEUE_DIR() \ (meta1_queue_dir ? meta1_queue_dir : "/var/spool/meta1") @@ -51,7 +53,7 @@ meta1_stmt_create (enum meta1_stmt_type type, const char *ident) p->next = NULL; p->type = type; p->ident = ident; - p->locus = meta1_locus; + p->locus = meta1lloc; return p; } @@ -84,9 +86,12 @@ reverse (struct meta1_stmt *in) static void meta1_translate (struct meta1_stmt *); %} +%error-verbose +%locations + %union { char *string; - gl_list_t list; + struct grecs_list *list; grecs_value_t *value; struct meta1_stmt *stmt; } @@ -168,29 +173,25 @@ value : string string : META1_IDENT | slist { - const void *p; - gl_list_iterator_t itr = gl_list_iterator ($1); - + struct grecs_list_entry *ep; meta1_line_begin (); - while (gl_list_iterator_next (&itr, &p, NULL)) + for (ep = $1->head; ep; ep = ep->next) + { + const char *p = ep->data; meta1_line_add (p, strlen (p)); - gl_list_iterator_free (&itr); + } $$ = meta1_line_finish (); } ; slist : META1_STRING { - $$ = gl_list_create_empty (&gl_linked_list_implementation, - NULL, - NULL, - NULL, - true); - gl_list_add_last ($$, $1); + $$ = grecs_list_create (); + grecs_list_append ($$, $1); } | slist META1_STRING { - gl_list_add_last ($1, $2); + grecs_list_append ($1, $2); $$ = $1; } ; @@ -207,16 +208,12 @@ list : '{' values '}' values : value { - $$ = gl_list_create_empty (&gl_linked_list_implementation, - NULL, - NULL, - NULL, - true); - gl_list_add_last ($$, $1); + $$ = grecs_list_create (); + grecs_list_append ($$, $1); } | values ',' value { - gl_list_add_last ($1, $3); + grecs_list_append ($1, $3); $$ = $1; } ; @@ -229,7 +226,7 @@ opt_sc : /* empty */ int yyerror (char *s) { - meta1_parse_error ("%s", s); + grecs_error (&yylloc, 0, "%s", s); return 0; } |