JSON.lexemes: def of qasim-bend-kit@0.1.0.2 Import: import qasim-bend-kit@0.1.0.2/libs/JSON.bend as JSON Lines 996-1023 of qasim-bend-kit@0.1.0.2/libs/JSON.bend: https://jend.leeeet.dev/read.txt?path=qasim-bend-kit@0.1.0.2/libs/JSON.bend&start_line=996&end_line=1023 import Base def lexemes(text: String, +mode: LexMode, reversed: String, acc: List<&2, Lexeme>, action: LexAction) -> List<&2, Lexeme>: match text action: case SNil{} LexStop{}: lex_end(mode, reversed, acc) case SNil{} _: List.reverse(&2, Lexeme, flush_lexeme(reversed, acc)) case SCon{h, +t} LexStop{}: lexemes(t, mode, SCon{h, reversed}, acc, lex_seed_action(t, mode)) case SCon{h, +t} LexEscapedChar{}: lexemes(t, Quoted{}, SCon{h, reversed}, acc, lex_seed_action(t, Quoted{})) case SCon{_, +t} LexBackslash{}: lexemes(t, Escaped{}, SCon{'\\', reversed}, acc, lex_seed_action(t, Escaped{})) case SCon{_, +t} LexStringEnd{}: lexemes(t, Outside{}, SNil{}, Payload{String.reverse(SCon{'"', reversed})} <> acc, lex_seed_action(t, Outside{})) case SCon{h, +t} LexStringChar{}: lexemes(t, Quoted{}, SCon{h, reversed}, acc, lex_seed_action(t, Quoted{})) case SCon{_, +t} LexQuote{}: lexemes(t, Quoted{}, SCon{'"', SNil{}}, flush_lexeme(reversed, acc), lex_seed_action(t, Quoted{})) case SCon{_, +t} LexWhitespace{}: lexemes(t, Outside{}, SNil{}, flush_lexeme(reversed, acc), lex_seed_action(t, Outside{})) case SCon{_, +t} LexPunctuation{character}: lexemes(t, Outside{}, SNil{}, Punctuation{character} <> flush_lexeme(reversed, acc), lex_seed_action(t, Outside{})) case SCon{h, +t} LexRaw{}: lexemes(t, Outside{}, SCon{h, reversed}, acc, lex_seed_action(t, Outside{})) Uses (11): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Char https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List.reverse https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=String https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=String.reverse https://jend.leeeet.dev/definition.txt?path=qasim-bend-kit@0.1.0.2/libs/JSON.bend&name=LexAction https://jend.leeeet.dev/definition.txt?path=qasim-bend-kit@0.1.0.2/libs/JSON.bend&name=LexMode https://jend.leeeet.dev/definition.txt?path=qasim-bend-kit@0.1.0.2/libs/JSON.bend&name=Lexeme https://jend.leeeet.dev/definition.txt?path=qasim-bend-kit@0.1.0.2/libs/JSON.bend&name=flush_lexeme https://jend.leeeet.dev/definition.txt?path=qasim-bend-kit@0.1.0.2/libs/JSON.bend&name=lex_end https://jend.leeeet.dev/definition.txt?path=qasim-bend-kit@0.1.0.2/libs/JSON.bend&name=lex_seed_action