diff --git a/src/scan_kjv.re.c b/src/scan_kjv.re.c index 14261ef..b4b52b7 100644 --- a/src/scan_kjv.re.c +++ b/src/scan_kjv.re.c @@ -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 /**/ * { goto catch; } "\x00" { return 1; } - "\n" @line_start { - fprintf(stderr, "\033[0;37m" "%4zu" "\033[0m" "\n", line); - line++; - continue; - } + "\n" @line_start + { fprintf(stderr, "%4zu\n", line); line++; continue; } * :=> skip /* Guess it can't be simplified? */ "Genesis" / lookat => book { book = Genesis; continue; } "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" | */ + "Leviticus" / lookat => book { book = Leviticus; continue; } + "Numbers" / lookat => book { book = Numbers; continue; } + "Deuteronomy" / lookat => book { book = Deuteronomy; continue; } + "Joshua" / lookat => book { book = Joshua; continue; } + "Judges" / lookat => book { book = Judges; continue; } + "Ruth" / lookat => book { book = Ruth; continue; } + first "Samuel" / lookat => book { book = ISamuel; continue; } + second "Samuel" / lookat => book { book = IISamuel; continue; } + first "Kings" / lookat => book { book = IKings; continue; } + second "Kings" / lookat => book { book = IIKings; continue; } + first "Chronicles" / lookat + => book { book = IChronicles; continue; } + second "Chronicles" / lookat + => book { book = IIChronicles; continue; } + "Ezra" / lookat => book { book = Ezra; continue; } + "Nehemiah" / lookat => book { book = Nehemiah; continue; } + "Esther" / lookat => book { book = Esther; continue; } + "Job" / lookat => book { book = Job; continue; } + "Psalms" / lookat => book { book = Psalms; continue; } + "Proverbs" / lookat => book { book = Proverbs; continue; } + "Ecclesiastes" / lookat + => book { book = Ecclesiastes; continue; } + "Song of Solomon" / lookat + => book { book = Song_of_Solomon; continue; } + "Isaiah" / lookat => book { book = Isaiah; continue; } + "Jeremiah" / lookat => book { book = Jeremiah; continue; } + "Lamentations" / lookat + => book { book = Lamentations; continue; } + "Ezekiel" / lookat => book { book = Ezekiel; continue; } + "Daniel" / lookat => book { book = Daniel; continue; } + "Hosea" / lookat => book { book = Hosea; continue; } + "Joel" / lookat => book { book = Joel; continue; } + "Amos" / lookat => book { book = Amos; continue; } + "Obadiah" / lookat => book { book = Obadiah; continue; } + "Jonah" / lookat => book { book = Jonah; continue; } + "Micah" / lookat => book { book = Micah; continue; } + "Nahum" / lookat => book { book = Nahum; continue; } + "Habakkuk" / lookat => book { book = Habakkuk; continue; } + "Zephaniah" / lookat => book { book = Zephaniah; continue; } + "Haggai" / lookat => book { book = Haggai; continue; } + "Zechariah" / lookat => book { book = Zechariah; continue; } + "Malachi" / lookat => book { book = Malachi; continue; } + "Matthew" / lookat => book { book = Matthew; continue; } + "Mark" / lookat => book { book = Mark; continue; } + "Luke" / lookat => book { book = Luke; continue; } + "John" / lookat => book { book = John; continue; } + "Acts" / lookat => book { book = Acts; continue; } "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+ "``" */ - // [^\n\x00]* newline { printf("throw\n"); line++; continue; } + first "Corinthians" / lookat + => book { book = ICorinthians; continue; } + second "Corinthians" / lookat + => book { book = IICorinthians; continue; } + "Galatians" / lookat => book { book = Galatians; continue; } + "Ephesians" / lookat => book { book = Ephesians; continue; } + "Philippians" / lookat => book { book = Philippians; continue; } + "Colossians" / lookat => book { book = Colossians; continue; } + first "Thessalonians" / lookat + => book { book = IThessalonians; continue; } + second "Thessalonians" / lookat + => book { book = IIThessalonians; continue; } + first "Timothy" / lookat => book { book = ITimothy; continue; } + second "Timothy" / lookat => book { book = IITimothy; continue; } + "Titus" / lookat => book { book = Titus; continue; } + "Philemon" / lookat => book { book = Philemon; continue; } + "Hebrews" / lookat => book { book = Hebrews; continue; } + "James" / lookat => book { book = James; continue; } + first "Peter" / lookat => book { book = IPeter; continue; } + second "Peter" / lookat => book { book = IIPeter; continue; } + first "John" / lookat => book { book = IJohn; continue; } + second "John" / lookat => book { book = IIJohn; continue; } + third "John" / lookat => book { book = IIIJohn; continue; } + "Jude" / lookat => book { book = Jude; continue; } + "Revelation" / lookat => book { book = Revelation; continue; } ws+ @s0 natural @s1 ":" @t0 natural @t1 [ab]? { if(chapter || verse || verse_end || !helper_natural(s0, s1, &chapter)