diff options
Diffstat (limited to 'stdlib/source/lux/control/parser/text.lux')
-rw-r--r-- | stdlib/source/lux/control/parser/text.lux | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/stdlib/source/lux/control/parser/text.lux b/stdlib/source/lux/control/parser/text.lux index 44d568eaf..5a7c2bb10 100644 --- a/stdlib/source/lux/control/parser/text.lux +++ b/stdlib/source/lux/control/parser/text.lux @@ -109,19 +109,20 @@ [not! Slice ..any!] ) -(def: #export (this reference) - {#.doc "Lex a text if it matches the given sample."} - (-> Text (Parser Any)) - (function (_ [offset tape]) - (case (/.index-of' reference offset tape) - (#.Some where) - (if (n.= offset where) - (#try.Success [[("lux i64 +" (/.size reference) offset) tape] - []]) - (#try.Failure ($_ /@compose "Could not match: " (/.encode reference) " @ " (maybe.assume (/.clip' offset tape))))) - - _ - (#try.Failure ($_ /@compose "Could not match: " (/.encode reference)))))) +(with-expansions [<failure> (as-is (#try.Failure ($_ /@compose "Could not match: " (/.encode reference) " @ " (maybe.assume (/.clip' offset tape)))))] + (def: #export (this reference) + {#.doc "Lex a text if it matches the given sample."} + (-> Text (Parser Any)) + (function (_ [offset tape]) + (case (/.index-of' reference offset tape) + (#.Some where) + (if (n.= offset where) + (#try.Success [[("lux i64 +" (/.size reference) offset) tape] + []]) + <failure>) + + _ + <failure>)))) (def: #export (this? reference) {#.doc "Lex a text if it matches the given sample."} |