/* 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 2 of the License, 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. * */ /* Copyright (c) 2006 Clive Nicolson clive@baby.bedroom.gen.nz */ %{ #include #include #include #include #include "fmli.h" #define YYSTYPE char * int yylex(fgfg_param p1); #define yyerror fgfgfg_msg %} %parse-param {fgfg_param p1} %lex-param {fgfg_param p1} %token name %token word_string dblquote_string sngquote_string bckquote_string %% line_list : line | line_list '\n' line ; line : /* empty */ | name '=' opt_value_list { fgfgfg_kv(p1, $1, $3); } ; opt_value_list : /* empty */ { $$ = NULL; } | value_list ; value_list : value | value_list value { if ($2 && *$2) { if ($1) { char *s; s = malloc(strlen($1)+strlen($2)+1); strcpy(s, $1); free($1); strcat(s, $2); free($2); $2 = s; } $1 = $2; } $$ = $1; } ; value : word_string | dblquote_string | sngquote_string | bckquote_string ; %% /* Section 4: Additional C code */ /* The end */