aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/data/text/lexer.lux
diff options
context:
space:
mode:
authorEduardo Julian2017-10-26 14:48:41 -0400
committerEduardo Julian2017-10-26 14:48:41 -0400
commit2c110ba43f77308590187645838582c933a4bfde (patch)
tree4b9724a9208fd0eeb45425e967d7819b5c3d1c88 /stdlib/source/lux/data/text/lexer.lux
parent1fabe19f7eacb668ef26cccde681dce5e2f98072 (diff)
- Fixed some small defects.
Diffstat (limited to '')
-rw-r--r--stdlib/source/lux/data/text/lexer.lux8
1 files changed, 5 insertions, 3 deletions
diff --git a/stdlib/source/lux/data/text/lexer.lux b/stdlib/source/lux/data/text/lexer.lux
index 7ad4a0954..45effa773 100644
--- a/stdlib/source/lux/data/text/lexer.lux
+++ b/stdlib/source/lux/data/text/lexer.lux
@@ -66,11 +66,13 @@
(-> Text (Lexer Unit))
(function [[offset tape]]
(case (text;index-of reference offset tape)
- (^multi (#;Some where) (n.= offset where))
- (#E;Success [[(n.+ (text;size reference) offset) tape] []])
+ (#;Some where)
+ (if (n.= offset where)
+ (#E;Success [[(n.+ (text;size reference) offset) tape] []])
+ (#E;Error ($_ text/compose "Could not match: " (text;encode reference) " @ " (maybe;assume (text;clip' offset tape)))))
_
- (#E;Error ($_ text/compose "Could not match: " (text;encode reference) " @ " tape)))))
+ (#E;Error ($_ text/compose "Could not match: " (text;encode reference))))))
(def: #export (this? reference)
{#;doc "Lex a text if it matches the given sample."}