/** Copyright 2002 Cyril Picard This file is part of the GEDCOMParser library (developed within the Genealogy Free Software Tools project). The GEDCOMParser library 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. The GEDCOMParser library 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 the GEDCOMParser library ; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA **/ %{ #include "GEDCOMParser/personalnameparser_decl.hh" #include "GEDCOMParser/personalnameparser.h" #include #include void personalname_error(char * const s); #define yylex personalnamelex int personalnamelex(void); #include #include std::string _givenname; std::string _givenname_word; std::string _surname; std::string _surname_word; %} %token SURNAME_DELIMITER %token CAR %% name_personal: /* empty */ |name_personal givenname { _givenname = _givenname + _givenname_word; _givenname_word=""; } | name_personal SURNAME_DELIMITER surname SURNAME_DELIMITER { _surname = _surname + _surname_word; _surname_word=""; } | name_personal SURNAME_DELIMITER surname { _surname = _surname + _surname_word; _surname_word=""; } ; givenname: CAR { _givenname_word = $1 + _givenname_word; } | givenname CAR { _givenname_word = _givenname_word + $2; } ; surname: /* empty */ | surname CAR { _surname_word = _surname_word + $2; } ; %% void personalname_error(char * const s) { std::cerr << s << std::endl; return ; } void personalname_runparse(std::string const &s) { _surname = ""; _givenname = ""; personalname_scan_string(s.c_str()); personalname_parse(); } std::string get_given_name(void) { return _givenname; } std::string get_surname(void) { return _surname; }