Copied from old documentation. Removed all Gedcom_val details.
[gedcom-parse.git] / gedcom / gedcom_hilo.lex
index 5c674a7a17287cbabb4537f9450797a8293fabe3..8d1997e524bdf45b06e9de49278e5ff770aeefd1 100644 (file)
@@ -1,11 +1,22 @@
-/*  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.                                   *
-
- (C) 2001 by The Genes Development Team
- Original author: Peter Verthez (Peter.Verthez@advalvas.be)
-*/
+/* Lexer for Unicode encoding (high-low order) of Gedcom.
+   Copyright (C) 2001 The Genes Development Team
+   This file is part of the Gedcom parser library.
+   Contributed by Peter Verthez <Peter.Verthez@advalvas.be>, 2001.
+
+   The Gedcom parser library is free software; you can redistribute it
+   and/or modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The Gedcom parser 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the Gedcom parser library; if not, write to the
+   Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 /* $Id$ */
 /* $Name$ */
@@ -14,7 +25,8 @@
 /* i.e. this is utf-16-be */
 
 %{
-#undef IN_LEX    /* include only a specific part of the following file */
+#define LEX_SECTION 1  /* include only a specific part of the following file */
+#define yymyinit gedcom_hilo_myinit
 #include "gedcom_lex_common.c"
   
 static size_t encoding_width = 2;
@@ -29,6 +41,7 @@ delim        \x00\x20
 tab          \x00[\t]
 hash         \x00#
 literal_at   \x00@\x00@
+normal_at    \x00@
 otherchar    \x00[\x21-\x22\x24-\x2F\x3A-\x3F\x5B-\x5E\x60\x7B-\x7E\x80-\xFF]|[\x01-\xFF][\x00-\xFF]
 terminator   \x00\x0D|\x00\x0A|\x00\x0D\x00\x0A|\x00\x0A\x00\x0D
 
@@ -39,12 +52,13 @@ alphanum     {alpha}|{digit}
 gen_delim    {delim}|{tab}
 
 escape       \x00@\x00#{any_char}+\x00@
-pointer      \x00@{alphanum}{non_at}+\x00@
+pointer      \x00@{alphanum}{non_at}*\x00@
 
 %%
 
 %{
-#define IN_LEX    /* include only a specific part of the following file */
+#undef LEX_SECTION
+#define LEX_SECTION 2  /* include only a specific part of the following file */
 #include "gedcom_lex_common.c"
 
 ACTION_BEFORE_REGEXPS
@@ -201,14 +215,16 @@ ACTION_BEFORE_REGEXPS
 
 <<EOF>>                  ACTION_EOF
 
+{normal_at}              ACTION_NORMAL_AT
+
+{tab}                    ACTION_TAB
+
 .                        ACTION_UNEXPECTED
 
 %%
-
-int yywrap()
-{
-  return 1;
-}
+#undef LEX_SECTION
+#define LEX_SECTION 3  /* include only a specific part of the following file */
+#include "gedcom_lex_common.c"
 
 #ifdef LEXER_TEST
 int gedcom_lex()