/************************************************************************ * grammer - include/parse.h * Copyright (C) 2002 Marcello Barnaba * * This program 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 1, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * parser functions . . . */ #ifndef __PARSE_H__ #define __PARSE_H__ #include "struct.h" #include "io.h" #include "memory.h" #include "manip.h" #include #include Grammar *acquire_grammar(void); Part *acquire_part(char *, short); List *acquire_list(char *, short); Prod *acquire_prod(void); void parser_sigint_handler(int); Part *find_part(List *, Part *); #define HEAD(var, head, type) \ (var) = (head) = xmalloc(sizeof(type)) #define CUT(var, head) (var)->next = NULL; \ (var) = (head); \ (head) = (head)->next; \ xfree((var)) #define NEW(var, type) if(!(var)->next) \ (var)->next = xmalloc(sizeof(type)) #define ASSIGN(var, item, obj) \ (var)->next->item = (obj) #define NEXT(var) (var) = (var)->next #define STATE_IDLE 0x0 #define STATE_SYMBOL 0x1 #define STATE_OR 0x2 #define FLAGS_NONE 0x0 #define FLAGS_ACQUIRE_DUPS 0x1 #define FLAGS_ACQUIRE_OR 0x2 #endif