diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/library/lux/data/text/regex.lux | 46 |
1 files changed, 24 insertions, 22 deletions
diff --git a/stdlib/source/library/lux/data/text/regex.lux b/stdlib/source/library/lux/data/text/regex.lux index 010dbd815..8e48c00d4 100644 --- a/stdlib/source/library/lux/data/text/regex.lux +++ b/stdlib/source/library/lux/data/text/regex.lux @@ -16,7 +16,7 @@ [collection ["[0]" list (.open: "[1]#[0]" mix monad)]]] [macro (.only with_symbols) - [syntax (.only syntax:)] + [syntax (.only syntax)] ["^" pattern] ["[0]" code]] [math @@ -414,24 +414,26 @@ (-> Text (Parser Code)) (at <>.monad each product.right (re_alternative^ #1 re_scoped^ current_module))) -(syntax: .public (regex [pattern <code>.text]) - (do meta.monad - [current_module meta.current_module_name] - (case (<text>.result (regex^ current_module) - pattern) - {try.#Failure error} - (meta.failure (format "Error while parsing regular-expression:" //.new_line - error)) - - {try.#Success regex} - (in (list regex))))) - -(syntax: .public (pattern [[pattern bindings] (<code>.form (<>.and <code>.text (<>.maybe <code>.any))) - body <code>.any - branches (<>.many <code>.any)]) - (with_symbols [g!temp] - (in (partial_list (` (^.multi (~ g!temp) - [((~! <text>.result) (..regex (~ (code.text pattern))) (~ g!temp)) - {try.#Success (~ (maybe.else g!temp bindings))}])) - body - branches)))) +(def: .public regex + (syntax (_ [pattern <code>.text]) + (do meta.monad + [current_module meta.current_module_name] + (case (<text>.result (regex^ current_module) + pattern) + {try.#Failure error} + (meta.failure (format "Error while parsing regular-expression:" //.new_line + error)) + + {try.#Success regex} + (in (list regex)))))) + +(def: .public pattern + (syntax (_ [[pattern bindings] (<code>.form (<>.and <code>.text (<>.maybe <code>.any))) + body <code>.any + branches (<>.many <code>.any)]) + (with_symbols [g!temp] + (in (partial_list (` (^.multi (~ g!temp) + [((~! <text>.result) (..regex (~ (code.text pattern))) (~ g!temp)) + {try.#Success (~ (maybe.else g!temp bindings))}])) + body + branches))))) |