#ifndef IN_LEX
+#include "external.h"
+#include "gedcom_internal.h"
#include "gedcom.tab.h"
-#include "gedcom.h"
#include "multilex.h"
#include "encoding.h"
line_len = 0;
#define CHECK_LINE_LEN \
- { if (line_len != (size_t)-1) \
+ { if (line_len != (size_t)-1) { \
line_len += strlen(yytext); \
- if (line_len > MAXGEDCLINELEN * encoding_width) { \
- gedcom_error("Line too long, max %d characters", \
- MAXGEDCLINELEN); \
- line_len = (size_t)-1; \
- return BADTOKEN; \
+ if (line_len > MAXGEDCLINELEN * encoding_width) { \
+ gedcom_error("Line too long, max %d characters", \
+ MAXGEDCLINELEN); \
+ line_len = (size_t)-1; \
+ return BADTOKEN; \
+ } \
} \
}
return CLOSE; \
} \
else { \
+ /* Reset our state */ \
+ current_level = -1; \
+ level_diff = MAXGEDCLEVEL; \
+ /* ... then terminate lex */ \
yyterminate(); \
} \
}