aboutsummaryrefslogtreecommitdiff
path: root/src/meta1gram.y
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2011-10-22 23:03:24 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2011-10-23 00:42:30 +0300
commit21ffba77b92f79a59c62728ede4ad7a4ecb5a0ee (patch)
treec3204285a3ba57d590d815c682f1113b6f48d834 /src/meta1gram.y
parenteb8797c9a28f3f4e238bad89b56d331492df7828 (diff)
downloadpies-21ffba77b92f79a59c62728ede4ad7a4ecb5a0ee.tar.gz
pies-21ffba77b92f79a59c62728ede4ad7a4ecb5a0ee.tar.bz2
Switch to the latest Grecs.
* Makefile.am (ChangeLog): Use git2chg.awk to build it. * NEWS: Update. * bootstrap.conf (gnulib_modules): Grecs does not depend on gnulib any more. * configure.ac: Version 1.2.90. Define GRECS_HOST_PROJECT_INCLUDES, remove grecs Makefiles from AC_CONFIG_FILES: it is now done by GRECS_SETUP itself. * gnulib.modules (gitlog-to-changelog,argp): Remove. (configmake): New module. * grecs: Update to a52ab6c6. * lib/libpies.h: Remove redefinitions of _() and N_(). * src/Makefile.am: Update for the recent grecs. * src/acl.c: Rewrite using Grecs support for lists and symtabs. * src/acl.h: Likewise. * src/diag.c: Likewise. * src/inetd.c: Likewise. * src/meta1gram.y: Likewise. * src/meta1lex.h: Likewise. * src/meta1lex.l: Likewise. * src/pies.c: Likewise. * src/pies.h: Likewise. * src/progman.c: Likewise. * src/userprivs.c: Likewise.
Diffstat (limited to 'src/meta1gram.y')
-rw-r--r--src/meta1gram.y47
1 files changed, 22 insertions, 25 deletions
diff --git a/src/meta1gram.y b/src/meta1gram.y
index 6256448..deaf382 100644
--- a/src/meta1gram.y
+++ b/src/meta1gram.y
@@ -1,9 +1,9 @@
%{
/* 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
the Free Software Foundation; either version 3, or (at your option)
any later version.
@@ -17,14 +17,16 @@
/* This file implements a grammar for parsing MeTA1 main configuration file,
and a set of functions for converting its statements into Pies
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")
enum meta1_stmt_type
{
meta1_simple,
@@ -48,13 +50,13 @@ struct meta1_stmt *
meta1_stmt_create (enum meta1_stmt_type type, const char *ident)
{
struct meta1_stmt *p = xmalloc (sizeof (*p));
p->next = NULL;
p->type = type;
p->ident = ident;
- p->locus = meta1_locus;
+ p->locus = meta1lloc;
return p;
}
static struct meta1_stmt *
_reverse (struct meta1_stmt *list, struct meta1_stmt **root)
{
@@ -81,15 +83,18 @@ reverse (struct meta1_stmt *in)
return root;
}
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;
}
%token <string> META1_IDENT META1_STRING META1_NUMBER
%type <list> slist values list
@@ -165,35 +170,31 @@ 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))
- meta1_line_add (p, strlen (p));
- gl_list_iterator_free (&itr);
+ for (ep = $1->head; ep; ep = ep->next)
+ {
+ const char *p = ep->data;
+ meta1_line_add (p, strlen (p));
+ }
$$ = 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;
}
;
list : '{' values '}'
{
@@ -204,35 +205,31 @@ list : '{' values '}'
$$ = $2;
}
;
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;
}
;
opt_sc : /* empty */
| ';'
;
%%
int
yyerror (char *s)
{
- meta1_parse_error ("%s", s);
+ grecs_error (&yylloc, 0, "%s", s);
return 0;
}
void
meta1_parser_set_debug ()
{

Return to:

Send suggestions and report system problems to the System administrator.