parse.bend checks
raw source on the hub · import 0xf40d06f265422706966baaec48c3e5f2/parse.bend as Parse
7 imports
import Base import ./books.bend as Books import ./normalize.bend as Norm import ./share.bend as Share import ./complete.bend as Comp import ./context.bend as Ctx import ./route.bend as Route
Types
type BookSt source · line 40 · raw
Data
BookCheckBookSt
BookDecide@stop:Bool -> BookSt
BookTakeBookSt
type DigSt source · line 73 · raw
Data
DigCheckDigSt
DigDecide@is_d:Bool -> DigSt
DigTakeDigSt
type RangeKind source · line 151 · raw
Data
SingleRangeKind
ChapterRangeKind
SameChapterRangeKind
ChapterRangeRangeKind
type ParseErr source · line 157 · raw
Data
EmptyParseErr
BadBookParseErr
BadFormatParseErr
BadNumberParseErr
CapChapter@book:String -> @max:U32 -> @got:U32 -> ParseErr
CapVerse@book:String -> @chapter:U32 -> @max:U32 -> @got:U32 -> ParseErr
ReversedParseErr
type Parsed source · line 166 · raw
Data
Parsed@canonical:String -> @display:String -> @book:String -> @chapter:U32 -> @verse:Maybe<&2, U32> -> @end_chapter:U32 -> @end_verse:Maybe<&2, U32> -> @kind:RangeKind -> Parsed
type DecSt source · line 542 · raw
Data
Single recursive decoder — Maybe results passed as DecSt fields (no computed match)
DecCopyDecSt
DecClass@c:Char -> @is_pct:Bool -> @is_plus:Bool -> DecSt
DecPctDecSt
DecNib1@m:Maybe<&2, U32> -> @spill:Char -> DecSt
DecHi@hi:U32 -> DecSt
DecNib2@hi:U32 -> @m:Maybe<&2, U32> -> @spill:Char -> DecSt
DecApply@hi:U32 -> @lo:U32 -> DecSt
type CutSt source · line 608 · raw
Data
CutCheckCutSt
CutDecide@stop:Bool -> CutSt
CutTakeCutSt
type TrPh source · line 681 · raw
Data
TrStart@h:Char -> @is_a:Bool -> TrPh
TrAlphaTrPh
TrClass@h:Char -> @is_a:Bool -> @is_dot:Bool -> TrPh
TrCommit@ok:Bool -> TrPh
type FrPh source · line 806 · raw
Data
Multi-ref: split on ';' and parse each non-empty trim
FrScanFrPh
FrDecide@is_sep:Bool -> FrPh
FrTakeFrPh
FrEmit@tok:String -> FrPh
Definitions
def char1 source · line 9 · raw
@+c:Char -> String
def is_book_stop_flags source · line 12 · raw
@+has_letter:Bool -> @is_d:Bool -> @is_a:Bool -> @is_s:Bool -> Bool
def is_book_stop source · line 27 · raw
@+has_letter:Bool -> @+c:Char -> Bool
def next_has_letter_go source · line 30 · raw
@has_letter:Bool -> @is_a:Bool -> Bool
def next_has_letter source · line 37 · raw
@+has_letter:Bool -> @+c:Char -> Bool
def take_book_go source · line 45 · raw
@fuel:Nat -> @st:BookSt -> @rest:String -> @acc:String -> @+has_letter:Bool -> Pair(String, String)
def take_book source · line 70 · raw
@+s:String -> Pair(String, String)
def take_digits_go source · line 78 · raw
@fuel:Nat -> @st:DigSt -> @rest:String -> @acc:String -> Pair(String, String)
def take_digits source · line 103 · raw
@+s:String -> Pair(String, String)
def is_colon_or_dot source · line 106 · raw
@+c:Char -> Bool
def drop_head source · line 109 · raw
@s:String -> String
def drop_cv_sep_go source · line 116 · raw
@+s:String -> @drop:Bool -> String
def drop_cv_sep source · line 123 · raw
@+s:String -> String
def drop_dash_go source · line 130 · raw
@+s:String -> @drop:Bool -> String
def drop_dash source · line 137 · raw
@+s:String -> String
def is_dash_head source · line 144 · raw
@s:String -> Bool
def require_u32_nz source · line 178 · raw
@n:U32 -> @z:Bool -> Result<&1, &1, ParseErr, U32>
def require_u32_go source · line 185 · raw
@m:Maybe<&2, U32> -> Result<&1, &1, ParseErr, U32>
def require_u32 source · line 192 · raw
@s:String -> Result<&1, &1, ParseErr, U32>
def check_ch_le source · line 195 · raw
@+book:String -> @+ch:U32 -> @+max:U32 -> @ok:Bool -> Result<&1, &1, ParseErr, Unit>
def check_ch_go source · line 202 · raw
@+book:String -> @+ch:U32 -> @m:Maybe<&2, U32> -> Result<&1, &1, ParseErr, Unit>
def check_ch source · line 209 · raw
@+book:String -> @+ch:U32 -> Result<&1, &1, ParseErr, Unit>
def check_vs_le source · line 212 · raw
@+book:String -> @+ch:U32 -> @+v:U32 -> @+max:U32 -> @ok:Bool -> Result<&1, &1, ParseErr, Unit>
def check_vs_go source · line 219 · raw
@+book:String -> @+ch:U32 -> @+v:U32 -> @m:Maybe<&2, U32> -> Result<&1, &1, ParseErr, Unit>
def check_vs source · line 226 · raw
@+book:String -> @+ch:U32 -> @+v:U32 -> Result<&1, &1, ParseErr, Unit>
def fmt_osis_part source · line 229 · raw
@+book:String -> @+ch:U32 -> @v:Maybe<&2, U32> -> String
def fmt_same_canonical source · line 239 · raw
@+book:String -> @+ch:U32 -> @a:U32 -> @ev:Maybe<&2, U32> -> String
def fmt_canonical_same source · line 246 · raw
@+book:String -> @+ch:U32 -> @v:Maybe<&2, U32> -> @ev:Maybe<&2, U32> -> String
def fmt_canonical source · line 253 · raw
@+book:String -> @+ch:U32 -> @+v:Maybe<&2, U32> -> @+ech:U32 -> @+ev:Maybe<&2, U32> -> @+kind:RangeKind -> String
def fmt_display_verse source · line 264 · raw
@+name:String -> @+ch:U32 -> @v:Maybe<&2, U32> -> String
def fmt_display_same2 source · line 274 · raw
@+name:String -> @+ch:U32 -> @a:U32 -> @ev:Maybe<&2, U32> -> String
def fmt_display_same source · line 287 · raw
@+name:String -> @+ch:U32 -> @v:Maybe<&2, U32> -> @ev:Maybe<&2, U32> -> String
def fmt_display_with source · line 294 · raw
@+name:String -> @+ch:U32 -> @+v:Maybe<&2, U32> -> @+ech:U32 -> @+ev:Maybe<&2, U32> -> @+kind:RangeKind -> String
def fmt_display source · line 308 · raw
@+book:String -> @+ch:U32 -> @+v:Maybe<&2, U32> -> @+ech:U32 -> @+ev:Maybe<&2, U32> -> @+kind:RangeKind -> String
def mk_parsed source · line 311 · raw
@+book:String -> @+ch:U32 -> @+v:Maybe<&2, U32> -> @+ech:U32 -> @+ev:Maybe<&2, U32> -> @+kind:RangeKind -> Parsed
def finish_ch_ok source · line 318 · raw
@+book:String -> @+ch:U32 -> @+ech:U32 -> @+kind:RangeKind -> @rev:Bool -> Result<&1, &1, ParseErr, Parsed>
def finish_ch_after source · line 325 · raw
@+book:String -> @+ch:U32 -> @+ech:U32 -> @+kind:RangeKind -> @r:Result<&1, &1, ParseErr, Unit> -> Result<&1, &1, ParseErr, Parsed>
def finish_ch_match source · line 332 · raw
@+book:String -> @+ch:U32 -> @+ech:U32 -> @+kind:RangeKind -> @r:Result<&1, &1, ParseErr, Unit> -> Result<&1, &1, ParseErr, Parsed>
def finish_ch source · line 339 · raw
@+book:String -> @+ch:U32 -> @+ech:U32 -> @+kind:RangeKind -> Result<&1, &1, ParseErr, Parsed>
def finish_vs_end_ok source · line 342 · raw
@+book:String -> @+ch:U32 -> @+vn:U32 -> @+en:U32 -> @rev:Bool -> Result<&1, &1, ParseErr, Parsed>
def finish_vs_end source · line 349 · raw
@+book:String -> @+ch:U32 -> @+vn:U32 -> @+en:U32 -> @r:Result<&1, &1, ParseErr, Unit> -> Result<&1, &1, ParseErr, Parsed>
def finish_vs_ev source · line 356 · raw
@+book:String -> @+ch:U32 -> @+vn:U32 -> @ev:Maybe<&2, U32> -> Result<&1, &1, ParseErr, Parsed>
def finish_vs_after_vn source · line 363 · raw
@+book:String -> @+ch:U32 -> @+vn:U32 -> @ev:Maybe<&2, U32> -> @r:Result<&1, &1, ParseErr, Unit> -> Result<&1, &1, ParseErr, Parsed>
def finish_vs_match source · line 370 · raw
@+book:String -> @+ch:U32 -> @+vn:U32 -> @ev:Maybe<&2, U32> -> @r:Result<&1, &1, ParseErr, Unit> -> Result<&1, &1, ParseErr, Parsed>
def finish_vs source · line 377 · raw
@+book:String -> @+ch:U32 -> @+vn:U32 -> @ev:Maybe<&2, U32> -> Result<&1, &1, ParseErr, Parsed>
def parse_after_verse_ev source · line 380 · raw
@+book:String -> @+ch:U32 -> @+vn:U32 -> @r:Result<&1, &1, ParseErr, U32> -> Result<&1, &1, ParseErr, Parsed>
def parse_after_verse_digits source · line 387 · raw
@+book:String -> @+ch:U32 -> @+vn:U32 -> @pair:Pair(String, String) -> Result<&1, &1, ParseErr, Parsed>
def parse_after_verse_num_go source · line 392 · raw
@+book:String -> @+ch:U32 -> @+vn:U32 -> @+rest:String -> @empty:Bool -> Result<&1, &1, ParseErr, Parsed>
def parse_after_verse_num_trim source · line 399 · raw
@+book:String -> @+ch:U32 -> @+vn:U32 -> @+r:String -> Result<&1, &1, ParseErr, Parsed>
def parse_after_verse_num source · line 402 · raw
@+book:String -> @+ch:U32 -> @+vn:U32 -> @+rest:String -> Result<&1, &1, ParseErr, Parsed>
def parse_verse_branch_num source · line 405 · raw
@+book:String -> @+ch:U32 -> @+rest2:String -> @r:Result<&1, &1, ParseErr, U32> -> Result<&1, &1, ParseErr, Parsed>
def parse_verse_branch_pair source · line 412 · raw
@+book:String -> @+ch:U32 -> @pair:Pair(String, String) -> Result<&1, &1, ParseErr, Parsed>
def parse_verse_branch source · line 417 · raw
@+book:String -> @+ch:U32 -> @+rest:String -> Result<&1, &1, ParseErr, Parsed>
def parse_chapter_range_num source · line 420 · raw
@+book:String -> @+ch:U32 -> @r:Result<&1, &1, ParseErr, U32> -> Result<&1, &1, ParseErr, Parsed>
def parse_chapter_range_pair source · line 427 · raw
@+book:String -> @+ch:U32 -> @pair:Pair(String, String) -> Result<&1, &1, ParseErr, Parsed>
def parse_chapter_range_branch source · line 432 · raw
@+book:String -> @+ch:U32 -> @+rest:String -> Result<&1, &1, ParseErr, Parsed>
def parse_after_chapter_sep_go source · line 435 · raw
@+book:String -> @+ch:U32 -> @+rest:String -> @empty:Bool -> @dash:Bool -> Result<&1, &1, ParseErr, Parsed>
def parse_after_chapter_sep_trim source · line 446 · raw
@+book:String -> @+ch:U32 -> @+r:String -> Result<&1, &1, ParseErr, Parsed>
def parse_after_chapter_sep source · line 449 · raw
@+book:String -> @+ch:U32 -> @+rest:String -> Result<&1, &1, ParseErr, Parsed>
def parse_tail_num source · line 452 · raw
@+book:String -> @+rest0:String -> @r:Result<&1, &1, ParseErr, U32> -> Result<&1, &1, ParseErr, Parsed>
def parse_tail_pair source · line 459 · raw
@+book:String -> @pair:Pair(String, String) -> Result<&1, &1, ParseErr, Parsed>
def parse_tail source · line 464 · raw
@+book:String -> @+tail:String -> Result<&1, &1, ParseErr, Parsed>
def parse_passage_book source · line 467 · raw
@+rest:String -> @m:Maybe<&2, String> -> Result<&1, &1, ParseErr, Parsed>
def parse_passage_pair source · line 474 · raw
@pair:Pair(String, String) -> Result<&1, &1, ParseErr, Parsed>
def parse_passage_go source · line 479 · raw
@+s0:String -> @empty:Bool -> Result<&1, &1, ParseErr, Parsed>
def hex_digit_lo source · line 489 · raw
@code:U32 -> @ok:Bool -> Maybe<&2, U32>
def hex_digit_up source · line 496 · raw
@code:U32 -> @ok:Bool -> Maybe<&2, U32>
def hex_digit_low source · line 503 · raw
@code:U32 -> @ok:Bool -> Maybe<&2, U32>
def hex_nibble_af source · line 510 · raw
@+code:U32 -> @dig:Maybe<&2, U32> -> Maybe<&2, U32>
def hex_nibble_az source · line 517 · raw
@+code:U32 -> @dig:Maybe<&2, U32> -> Maybe<&2, U32>
def hex_nibble_from_code source · line 527 · raw
@+code:U32 -> Maybe<&2, U32>
def hex_nibble source · line 533 · raw
@+c:Char -> Maybe<&2, U32>
def hex_byte source · line 538 · raw
@hi:U32 -> @lo:U32 -> U32
def url_decode_go source · line 551 · raw
@fuel:Nat -> @st:DecSt -> @rest:String -> @acc:String -> String
def url_decode source · line 605 · raw
@+s:String -> String
def is_query_or_hash source · line 613 · raw
@+c:Char -> Bool
def take_until_qh_go source · line 616 · raw
@fuel:Nat -> @st:CutSt -> @rest:String -> @acc:String -> String
def strip_query source · line 641 · raw
@+s:String -> String
def take_until_slash_go source · line 644 · raw
@fuel:Nat -> @st:CutSt -> @rest:String -> @acc:String -> String
def last_path_segment source · line 669 · raw
@+s:String -> String
def strip_tr_go source · line 687 · raw
@fuel:Nat -> @ph:TrPh -> @rest:String -> @+n:Nat -> @+orig:String -> String
def strip_tr_suffix_rev source · line 722 · raw
@+s:String -> @rev:String -> String
def strip_tr_suffix source · line 735 · raw
@+s:String -> String
def parse_passage_trim source · line 738 · raw
@+s0:String -> Result<&1, &1, ParseErr, Parsed>
def parse_passage source · line 741 · raw
@+input:String -> Result<&1, &1, ParseErr, Parsed>
def looks_like_url source · line 745 · raw
@+s:String -> Bool
def pick_url_ref_go source · line 766 · raw
@+share:String -> @+fallback:String -> @empty:Bool -> String
def pick_url_ref source · line 773 · raw
@+share:String -> @+fallback:String -> String
def extract_url_ref source · line 776 · raw
@+s:String -> String
def parse_any_go source · line 779 · raw
@+s:String -> @is_url:Bool -> Result<&1, &1, ParseErr, Parsed>
def parse_any_trim source · line 786 · raw
@+s:String -> Result<&1, &1, ParseErr, Parsed>
def parse_any source · line 789 · raw
@+input:String -> Result<&1, &1, ParseErr, Parsed>
def canonical_of_r source · line 793 · raw
@r:Result<&1, &1, ParseErr, Parsed> -> String
String-only probe for linkify (avoids Result across modules)
def try_canonical source · line 802 · raw
@+input:String -> String
def find_any_push source · line 812 · raw
@+tok:String -> @acc:List<&2, Parsed> -> @r:Result<&1, &1, ParseErr, Parsed> -> List<&2, Parsed>
def find_any_emit source · line 819 · raw
@fuel:Nat -> @+tok:String -> @rest:String -> @acc:List<&2, Parsed> -> @empty:Bool -> List<&2, Parsed>
def find_any_go source · line 826 · raw
@fuel:Nat -> @ph:FrPh -> @rest:String -> @+tok:String -> @acc:List<&2, Parsed> -> List<&2, Parsed>
def rev_parsed source · line 857 · raw
@xs:List<&2, Parsed> -> @acc:List<&2, Parsed> -> List<&2, Parsed>
def find_any source · line 864 · raw
@+input:String -> List<&2, Parsed>
def err_msg source · line 876 · raw
@e:ParseErr -> String
def show_ok source · line 902 · raw
@+canonical:String -> @+display:String -> IO(Unit)
def show_result source · line 909 · raw
@r:Result<&1, &1, ParseErr, Parsed> -> IO(Unit)
def join_args source · line 923 · raw
@xs:List<&1, String> -> String
def usage source · line 932 · raw
IO(Unit)
def show_parsed_list_rest source · line 935 · raw
@xs:List<&2, Parsed> -> IO(Unit)
def show_parsed_list source · line 944 · raw
@xs:List<&2, Parsed> -> IO(Unit)
def run_context_v source · line 953 · raw
@+book:String -> @+chapter:U32 -> @verse:Maybe<&2, U32> -> IO(Unit)
def run_context_r source · line 960 · raw
@r:Result<&1, &1, ParseErr, Parsed> -> IO(Unit)
def run_context source · line 969 · raw
@+q:String -> IO(Unit)
def run_query source · line 972 · raw
@+q:String -> IO(Unit)
def run_all source · line 975 · raw
@+q:String -> IO(Unit)
def run_complete source · line 978 · raw
@+q:String -> IO(Unit)
def run_linkify_r source · line 981 · raw
@r:Result<&1, &1, ParseErr, Parsed> -> IO(Unit)
def run_linkify source · line 990 · raw
@+q:String -> IO(Unit)
def run_flag5 source · line 993 · raw
@+h:String -> @t:List<&1, String> -> @is_all:Bool -> @is_comp:Bool -> @is_ctx:Bool -> @is_link:Bool -> IO(Unit)
def run_args source · line 1012 · raw
@xs:List<&1, String> -> IO(Unit)
def main source · line 1026 · raw
IO(Unit)