diff options
author | Eduardo Julian | 2019-09-14 23:42:56 -0400 |
---|---|---|
committer | Eduardo Julian | 2019-09-14 23:42:56 -0400 |
commit | 7027b09b68a5ad8f7a4eb2f9edd913d43d2f1730 (patch) | |
tree | 93226f666a0ee75d1ef19186a7bead3e770075d8 /stdlib/source/lux/control/parser/text.lux | |
parent | fb7a90d4c56d5e4e726f1e83dc951fa46d36ffdb (diff) |
More fixes.
Diffstat (limited to '')
-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."} |