/[ghosts]/ghosts/gedcomparser/src/GEDCOMParser/personalnameparser.yxx
ViewVC logotype

Diff of /ghosts/gedcomparser/src/GEDCOMParser/personalnameparser.yxx

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by cpcp, Wed Oct 16 17:33:11 2002 UTC revision 1.2 by cpcp, Tue Nov 12 21:25:21 2002 UTC
# Line 0  Line 1 
1    /**
2        Copyright 2002 Cyril Picard
3    
4        This file is part of the GEDCOMParser library
5        (developed within the Genealogy Free Software Tools project).
6    
7        The GEDCOMParser library is free software; you can redistribute it and/or modify
8        it under the terms of the GNU General Public License as published by
9        the Free Software Foundation; either version 2 of the License, or
10        (at your option) any later version.
11    
12        The GEDCOMParser library is distributed in the hope that it will be useful,
13        but WITHOUT ANY WARRANTY; without even the implied warranty of
14        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15        GNU General Public License for more details.
16    
17        You should have received a copy of the GNU General Public License
18        along with the GEDCOMParser library ; if not, write to the Free Software
19        Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20    
21    **/
22    
23    %{
24    #include "GEDCOMParser/personalnameparser_decl.hh"
25    #include "GEDCOMParser/personalnameparser.h"
26    
27    #include <string.h>
28    #include <iostream>
29    
30    void personalname_error(char * const s);        
31    #define yylex personalnamelex
32    int personalnamelex(void);
33    
34    #include <iostream>
35    #include <string>
36    
37    std::string _givenname;
38    std::string _givenname_word;
39    std::string _surname;
40    std::string _surname_word;
41    
42    %}
43    
44    %token SURNAME_DELIMITER
45    %token CAR
46    %%
47    
48    name_personal:
49            /* empty */
50            |name_personal givenname
51            {
52              _givenname =  _givenname + _givenname_word;
53              _givenname_word="";  
54            }      
55            | name_personal SURNAME_DELIMITER surname SURNAME_DELIMITER
56            {
57              _surname = _surname + _surname_word;
58              _surname_word="";
59            }                      
60            | name_personal SURNAME_DELIMITER surname
61            {
62              _surname = _surname + _surname_word;
63              _surname_word="";
64            }                      
65            ;
66    
67    givenname:
68            CAR
69            {
70            _givenname_word = $1 + _givenname_word;
71            }      
72            | givenname CAR
73            {
74            _givenname_word = _givenname_word + $2;
75            }      
76            ;
77    
78    surname:
79            /* empty */
80            | surname CAR
81            {
82            _surname_word =  _surname_word + $2;
83            }      
84            ;
85    
86    %%
87    
88    void personalname_error(char * const s)
89    {
90      std::cerr << s  << std::endl;
91      return ;
92    }
93    
94    void personalname_runparse(std::string const &s)
95    {
96      _surname = "";
97      _givenname = "";
98      personalname_scan_string(s.c_str());  
99      personalname_parse();
100    }
101    
102    std::string get_given_name(void)
103    {
104      return _givenname;
105    }
106    
107    std::string get_surname(void)
108    {
109      return _surname;
110    }

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26