From: Peter Verthez Date: Sat, 1 Dec 2001 17:23:26 +0000 (+0000) Subject: Return level number together with OPEN token. X-Git-Url: https://git.dlugolecki.net.pl/?a=commitdiff_plain;h=0c341b31ca4de86b12b8b98f724b4f746e98a5d2;p=gedcom-parse.git Return level number together with OPEN token. --- diff --git a/gedcom.y b/gedcom.y index e512aa6..98d36e2 100644 --- a/gedcom.y +++ b/gedcom.y @@ -223,13 +223,14 @@ int compat_mode(int flags); %union { char *string; + int number; } %token_table %expect 300 %token BADTOKEN -%token OPEN +%token OPEN %token CLOSE %token ESCAPE %token DELIM diff --git a/gedcom_1byte.lex b/gedcom_1byte.lex index 5705c1e..df4559a 100644 --- a/gedcom_1byte.lex +++ b/gedcom_1byte.lex @@ -97,6 +97,7 @@ if (level_diff < 1) { } else if (level_diff == 1) { level_diff++; + gedcom_lval.number = current_level; return OPEN; } else { @@ -133,6 +134,7 @@ else { } else if (level_diff == 1) { level_diff++; + gedcom_lval.number = current_level; return OPEN; } else { @@ -355,7 +357,7 @@ int main() while (tok) { switch(tok) { case BADTOKEN: printf("BADTOKEN "); break; - case OPEN: printf("OPEN "); break; + case OPEN: printf("OPEN(%d) ", gedcom_lval.number); break; case CLOSE: printf("CLOSE "); break; case ESCAPE: printf("ESCAPE(%s) ", gedcom_lval.string); break; case DELIM: printf("DELIM "); break; diff --git a/gedcom_hilo.lex b/gedcom_hilo.lex index 62b9645..e5135dc 100644 --- a/gedcom_hilo.lex +++ b/gedcom_hilo.lex @@ -99,6 +99,7 @@ if (level_diff < 1) { } else if (level_diff == 1) { level_diff++; + gedcom_lval.number = current_level; return OPEN; } else { @@ -135,6 +136,7 @@ else { } else if (level_diff == 1) { level_diff++; + gedcom_lval.number = current_level; return OPEN; } else { @@ -352,7 +354,7 @@ int main() while (tok) { switch(tok) { case BADTOKEN: printf("BADTOKEN "); break; - case OPEN: printf("OPEN "); break; + case OPEN: printf("OPEN(%d) ", gedcom_lval.number); break; case CLOSE: printf("CLOSE "); break; case ESCAPE: printf("ESCAPE(%s) ", gedcom_lval.string); break; case DELIM: printf("DELIM "); break; diff --git a/gedcom_lohi.lex b/gedcom_lohi.lex index 2545343..9b76ac9 100644 --- a/gedcom_lohi.lex +++ b/gedcom_lohi.lex @@ -99,6 +99,7 @@ if (level_diff < 1) { } else if (level_diff == 1) { level_diff++; + gedcom_lval.number = current_level; return OPEN; } else { @@ -135,6 +136,7 @@ else { } else if (level_diff == 1) { level_diff++; + gedcom_lval.number = current_level; return OPEN; } else { @@ -352,7 +354,7 @@ int main() while (tok) { switch(tok) { case BADTOKEN: printf("BADTOKEN "); break; - case OPEN: printf("OPEN "); break; + case OPEN: printf("OPEN(%d) ", gedcom_lval.number); break; case CLOSE: printf("CLOSE "); break; case ESCAPE: printf("ESCAPE(%s) ", gedcom_lval.string); break; case DELIM: printf("DELIM "); break;