All done putting books?

This commit is contained in:
Neil 2022-12-29 14:40:43 -08:00
parent e30293e66e
commit 16ce24452f
1 changed files with 77 additions and 19 deletions

View File

@ -41,33 +41,91 @@ static int scan(union date32 date, const char *const buffer,
engage = ws+ "--" ws+;
lookat = ws* natural ":" natural [ab]?
("-" (natural ":")? natural [ab]?)? engage;
first = ("I" | "1") " "?;
second = ("II" | "2") " "?;
third = ("III" | "3") " "?;
*/
for( ; ; ) { /*!re2c /**/
<skip, book> * { goto catch; }
<line> "\x00" { return 1; }
<line> "\n" @line_start {
fprintf(stderr, "\033[0;37m" "%4zu" "\033[0m" "\n", line);
line++;
continue;
}
<line> "\n" @line_start
{ fprintf(stderr, "%4zu\n", line); line++; continue; }
<line> * :=> skip /* Guess it can't be simplified? */
<line> "Genesis" / lookat => book { book = Genesis; continue; }
<line> "Exodus" / lookat => book { book = Exodus; continue; }
/*| "Leviticus" | "Numbers" | "Deuteronomy"
| "Joshua" | "Judges" | "Ruth" | "I"{1,2} " Samuel" | "I"{1,2} " Kings"
| "I"{1,2} " Chronicles" | "Ezra" | "Nehemiah" | "Esther" | "Job"
| "Psalms" | "Proverbs" | "Ecclesiastes" | "Song of Solomon" | "Isaiah"
| "Jeremiah" | "Lamentations" | "Ezekiel" | "Daniel" | "Hosea" | "Joel"
| "Amos" | "Obadiah" | "Jonah" | "Micah" | "Nahum" | "Habakkuk"
| "Zephaniah" | "Haggai" | "Zechariah" | "Malachi" | "Matthew" | "Mark"
| "Luke" | "John" | "Acts" | */
<line> "Leviticus" / lookat => book { book = Leviticus; continue; }
<line> "Numbers" / lookat => book { book = Numbers; continue; }
<line> "Deuteronomy" / lookat => book { book = Deuteronomy; continue; }
<line> "Joshua" / lookat => book { book = Joshua; continue; }
<line> "Judges" / lookat => book { book = Judges; continue; }
<line> "Ruth" / lookat => book { book = Ruth; continue; }
<line> first "Samuel" / lookat => book { book = ISamuel; continue; }
<line> second "Samuel" / lookat => book { book = IISamuel; continue; }
<line> first "Kings" / lookat => book { book = IKings; continue; }
<line> second "Kings" / lookat => book { book = IIKings; continue; }
<line> first "Chronicles" / lookat
=> book { book = IChronicles; continue; }
<line> second "Chronicles" / lookat
=> book { book = IIChronicles; continue; }
<line> "Ezra" / lookat => book { book = Ezra; continue; }
<line> "Nehemiah" / lookat => book { book = Nehemiah; continue; }
<line> "Esther" / lookat => book { book = Esther; continue; }
<line> "Job" / lookat => book { book = Job; continue; }
<line> "Psalms" / lookat => book { book = Psalms; continue; }
<line> "Proverbs" / lookat => book { book = Proverbs; continue; }
<line> "Ecclesiastes" / lookat
=> book { book = Ecclesiastes; continue; }
<line> "Song of Solomon" / lookat
=> book { book = Song_of_Solomon; continue; }
<line> "Isaiah" / lookat => book { book = Isaiah; continue; }
<line> "Jeremiah" / lookat => book { book = Jeremiah; continue; }
<line> "Lamentations" / lookat
=> book { book = Lamentations; continue; }
<line> "Ezekiel" / lookat => book { book = Ezekiel; continue; }
<line> "Daniel" / lookat => book { book = Daniel; continue; }
<line> "Hosea" / lookat => book { book = Hosea; continue; }
<line> "Joel" / lookat => book { book = Joel; continue; }
<line> "Amos" / lookat => book { book = Amos; continue; }
<line> "Obadiah" / lookat => book { book = Obadiah; continue; }
<line> "Jonah" / lookat => book { book = Jonah; continue; }
<line> "Micah" / lookat => book { book = Micah; continue; }
<line> "Nahum" / lookat => book { book = Nahum; continue; }
<line> "Habakkuk" / lookat => book { book = Habakkuk; continue; }
<line> "Zephaniah" / lookat => book { book = Zephaniah; continue; }
<line> "Haggai" / lookat => book { book = Haggai; continue; }
<line> "Zechariah" / lookat => book { book = Zechariah; continue; }
<line> "Malachi" / lookat => book { book = Malachi; continue; }
<line> "Matthew" / lookat => book { book = Matthew; continue; }
<line> "Mark" / lookat => book { book = Mark; continue; }
<line> "Luke" / lookat => book { book = Luke; continue; }
<line> "John" / lookat => book { book = John; continue; }
<line> "Acts" / lookat => book { book = Acts; continue; }
<line> "Romans" / lookat => book { book = Romans; continue; }
/*| "I"{1,2} " Corinthians"
| "Galatians" | "Ephesians" | "Philippians" | "Colossians"
| "I"{1,2} " Thessalonians" | "I"{1,2} " Timothy" | "Titus" | "Philemon"
| "Hebrews" | "James" | "I"{1,2} " Peter" | "I"{1,3} " John" | "Jude"
| "Revelation") @s1 ws* / bible_ref ws+ "--" ws+ "``" */
//<line> [^\n\x00]* newline { printf("throw\n"); line++; continue; }
<line> first "Corinthians" / lookat
=> book { book = ICorinthians; continue; }
<line> second "Corinthians" / lookat
=> book { book = IICorinthians; continue; }
<line> "Galatians" / lookat => book { book = Galatians; continue; }
<line> "Ephesians" / lookat => book { book = Ephesians; continue; }
<line> "Philippians" / lookat => book { book = Philippians; continue; }
<line> "Colossians" / lookat => book { book = Colossians; continue; }
<line> first "Thessalonians" / lookat
=> book { book = IThessalonians; continue; }
<line> second "Thessalonians" / lookat
=> book { book = IIThessalonians; continue; }
<line> first "Timothy" / lookat => book { book = ITimothy; continue; }
<line> second "Timothy" / lookat => book { book = IITimothy; continue; }
<line> "Titus" / lookat => book { book = Titus; continue; }
<line> "Philemon" / lookat => book { book = Philemon; continue; }
<line> "Hebrews" / lookat => book { book = Hebrews; continue; }
<line> "James" / lookat => book { book = James; continue; }
<line> first "Peter" / lookat => book { book = IPeter; continue; }
<line> second "Peter" / lookat => book { book = IIPeter; continue; }
<line> first "John" / lookat => book { book = IJohn; continue; }
<line> second "John" / lookat => book { book = IIJohn; continue; }
<line> third "John" / lookat => book { book = IIIJohn; continue; }
<line> "Jude" / lookat => book { book = Jude; continue; }
<line> "Revelation" / lookat => book { book = Revelation; continue; }
<book> ws+ @s0 natural @s1 ":" @t0 natural @t1 [ab]? {
if(chapter || verse || verse_end
|| !helper_natural(s0, s1, &chapter)