diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/lux/control/parser/text.lux (renamed from stdlib/source/lux/data/text/lexer.lux) | 145 | ||||
-rw-r--r-- | stdlib/source/lux/data/format/json.lux | 6 | ||||
-rw-r--r-- | stdlib/source/lux/data/format/xml.lux | 6 | ||||
-rw-r--r-- | stdlib/source/lux/data/text/regex.lux | 4 | ||||
-rw-r--r-- | stdlib/source/lux/macro/poly/json.lux | 4 | ||||
-rw-r--r-- | stdlib/source/lux/math/modular.lux | 6 | ||||
-rw-r--r-- | stdlib/source/lux/time/date.lux | 6 | ||||
-rw-r--r-- | stdlib/source/lux/time/duration.lux | 6 | ||||
-rw-r--r-- | stdlib/source/lux/time/instant.lux | 6 | ||||
-rw-r--r-- | stdlib/source/lux/tool/compiler/default/syntax.lux | 5 | ||||
-rw-r--r-- | stdlib/source/lux/world/net/http/cookie.lux | 6 | ||||
-rw-r--r-- | stdlib/source/lux/world/net/http/query.lux | 6 | ||||
-rw-r--r-- | stdlib/source/test/lux/control.lux | 9 | ||||
-rw-r--r-- | stdlib/source/test/lux/control/parser/text.lux (renamed from stdlib/source/test/lux/data/text/lexer.lux) | 0 | ||||
-rw-r--r-- | stdlib/source/test/lux/data.lux | 2 | ||||
-rw-r--r-- | stdlib/source/test/lux/data/text/regex.lux | 14 | ||||
-rw-r--r-- | stdlib/source/test/lux/tool/compiler/default/syntax.lux | 6 |
17 files changed, 124 insertions, 113 deletions
diff --git a/stdlib/source/lux/data/text/lexer.lux b/stdlib/source/lux/control/parser/text.lux index 958011b1c..22f49a572 100644 --- a/stdlib/source/lux/data/text/lexer.lux +++ b/stdlib/source/lux/control/parser/text.lux @@ -3,26 +3,26 @@ [abstract [monad (#+ Monad do)]] [control - ["p" parser] - ["ex" exception (#+ exception:)]] + ["." exception (#+ exception:)]] [data ["." product] ["." maybe] ["." error (#+ Error)] + ["/" text ("#@." monoid)] [number ["." nat ("#@." decimal)]] [collection ["." list ("#@." fold)]]] [macro ["." code]]] - ["." // ("#@." monoid)]) + ["." //]) (type: #export Offset Nat) (def: start-offset Offset 0) (type: #export Lexer - (p.Parser [Offset Text])) + (//.Parser [Offset Text])) (type: #export Slice {#basis Offset @@ -32,12 +32,13 @@ (def: (remaining offset tape) (-> Offset Text Text) - (|> tape (//.split offset) maybe.assume product.right)) + (|> tape (/.split offset) maybe.assume product.right)) (exception: #export (unconsumed-input {offset Offset} {tape Text}) - (ex.report ["Offset" (nat@encode offset)] - ["Input size" (nat@encode (//.size tape))] - ["Remaining input" (remaining offset tape)])) + (exception.report + ["Offset" (nat@encode offset)] + ["Input size" (nat@encode (/.size tape))] + ["Remaining input" (remaining offset tape)])) (def: #export (run input lexer) (All [a] (-> Text (Lexer a) (Error a))) @@ -46,9 +47,9 @@ (#error.Failure msg) (#error.Success [[end-offset _] output]) - (if (n/= end-offset (//.size input)) + (if (n/= end-offset (/.size input)) (#error.Success output) - (ex.throw unconsumed-input [end-offset input])))) + (exception.throw unconsumed-input [end-offset input])))) (def: #export offset (Lexer Offset) @@ -57,7 +58,7 @@ (def: (with-slices lexer) (-> (Lexer (List Slice)) (Lexer Slice)) - (do p.monad + (do //.monad [offset ..offset slices lexer] (wrap (list@fold (function (_ [slice::basis slice::distance] @@ -71,9 +72,9 @@ {#.doc "Just returns the next character without applying any logic."} (Lexer Text) (function (_ [offset tape]) - (case (//.nth offset tape) + (case (/.nth offset tape) (#.Some output) - (#error.Success [[("lux i64 +" 1 offset) tape] (//.from-code output)]) + (#error.Success [[("lux i64 +" 1 offset) tape] (/.from-code output)]) _ (#error.Failure cannot-lex-error)))) @@ -106,23 +107,23 @@ {#.doc "Lex a text if it matches the given sample."} (-> Text (Lexer Any)) (function (_ [offset tape]) - (case (//.index-of' reference offset tape) + (case (/.index-of' reference offset tape) (#.Some where) (if (n/= offset where) - (#error.Success [[("lux i64 +" (//.size reference) offset) tape] + (#error.Success [[("lux i64 +" (/.size reference) offset) tape] []]) - (#error.Failure ($_ //@compose "Could not match: " (//.encode reference) " @ " (maybe.assume (//.clip' offset tape))))) + (#error.Failure ($_ /@compose "Could not match: " (/.encode reference) " @ " (maybe.assume (/.clip' offset tape))))) _ - (#error.Failure ($_ //@compose "Could not match: " (//.encode reference)))))) + (#error.Failure ($_ /@compose "Could not match: " (/.encode reference)))))) (def: #export (this? reference) {#.doc "Lex a text if it matches the given sample."} (-> Text (Lexer Bit)) (function (_ (^@ input [offset tape])) - (case (//.index-of' reference offset tape) + (case (/.index-of' reference offset tape) (^multi (#.Some where) (n/= offset where)) - (#error.Success [[("lux i64 +" (//.size reference) offset) tape] + (#error.Success [[("lux i64 +" (/.size reference) offset) tape] #1]) _ @@ -132,23 +133,23 @@ {#.doc "Ensure the lexer's input is empty."} (Lexer Any) (function (_ (^@ input [offset tape])) - (if (n/= offset (//.size tape)) + (if (n/= offset (/.size tape)) (#error.Success [input []]) - (ex.throw unconsumed-input [offset tape])))) + (exception.throw unconsumed-input [offset tape])))) (def: #export end? {#.doc "Ask if the lexer's input is empty."} (Lexer Bit) (function (_ (^@ input [offset tape])) - (#error.Success [input (n/= offset (//.size tape))]))) + (#error.Success [input (n/= offset (/.size tape))]))) (def: #export peek {#.doc "Lex the next character (without consuming it from the input)."} (Lexer Text) (function (_ (^@ input [offset tape])) - (case (//.nth offset tape) + (case (/.nth offset tape) (#.Some output) - (#error.Success [input (//.from-code output)]) + (#error.Success [input (/.from-code output)]) _ (#error.Failure cannot-lex-error)))) @@ -162,17 +163,17 @@ (def: #export (range bottom top) {#.doc "Only lex characters within a range."} (-> Nat Nat (Lexer Text)) - (do p.monad + (do //.monad [char any - #let [char' (maybe.assume (//.nth 0 char))] - _ (p.assert ($_ //@compose "Character is not within range: " (//.from-code bottom) "-" (//.from-code top)) - (.and (n/>= bottom char') - (n/<= top char')))] + #let [char' (maybe.assume (/.nth 0 char))] + _ (//.assert ($_ /@compose "Character is not within range: " (/.from-code bottom) "-" (/.from-code top)) + (.and (n/>= bottom char') + (n/<= top char')))] (wrap char))) (template [<name> <bottom> <top> <desc>] [(def: #export <name> - {#.doc (code.text ($_ //@compose "Only lex " <desc> " characters."))} + {#.doc (code.text ($_ /@compose "Only lex " <desc> " characters."))} (Lexer Text) (range (char <bottom>) (char <top>)))] @@ -185,32 +186,32 @@ (def: #export alpha {#.doc "Only lex alphabetic characters."} (Lexer Text) - (p.either lower upper)) + (//.either lower upper)) (def: #export alpha-num {#.doc "Only lex alphanumeric characters."} (Lexer Text) - (p.either alpha decimal)) + (//.either alpha decimal)) (def: #export hexadecimal {#.doc "Only lex hexadecimal digits."} (Lexer Text) - ($_ p.either + ($_ //.either decimal (range (char "a") (char "f")) (range (char "A") (char "F")))) (template [<name> <description-modifier> <modifier>] [(def: #export (<name> options) - {#.doc (code.text ($_ //@compose "Only lex characters that are" <description-modifier> " part of a piece of text."))} + {#.doc (code.text ($_ /@compose "Only lex characters that are" <description-modifier> " part of a piece of text."))} (-> Text (Lexer Text)) (function (_ [offset tape]) - (case (//.nth offset tape) + (case (/.nth offset tape) (#.Some output) - (let [output (//.from-code output)] - (if (<modifier> (//.contains? output options)) + (let [output (/.from-code output)] + (if (<modifier> (/.contains? output options)) (#error.Success [[("lux i64 +" 1 offset) tape] output]) - (#error.Failure ($_ //@compose "Character (" output + (#error.Failure ($_ /@compose "Character (" output ") is should " <description-modifier> "be one of: " options)))) @@ -223,17 +224,17 @@ (template [<name> <description-modifier> <modifier>] [(def: #export (<name> options) - {#.doc (code.text ($_ //@compose "Only lex characters that are" <description-modifier> " part of a piece of text."))} + {#.doc (code.text ($_ /@compose "Only lex characters that are" <description-modifier> " part of a piece of text."))} (-> Text (Lexer Slice)) (function (_ [offset tape]) - (case (//.nth offset tape) + (case (/.nth offset tape) (#.Some output) - (let [output (//.from-code output)] - (if (<modifier> (//.contains? output options)) + (let [output (/.from-code output)] + (if (<modifier> (/.contains? output options)) (#error.Success [[("lux i64 +" 1 offset) tape] {#basis offset #distance 1}]) - (#error.Failure ($_ //@compose "Character (" output + (#error.Failure ($_ /@compose "Character (" output ") is should " <description-modifier> "be one of: " options)))) @@ -248,11 +249,11 @@ {#.doc "Only lex characters that satisfy a predicate."} (-> (-> Nat Bit) (Lexer Text)) (function (_ [offset tape]) - (case (//.nth offset tape) + (case (/.nth offset tape) (#.Some output) (if (p output) - (#error.Success [[("lux i64 +" 1 offset) tape] (//.from-code output)]) - (#error.Failure ($_ //@compose "Character does not satisfy predicate: " (//.from-code output)))) + (#error.Success [[("lux i64 +" 1 offset) tape] (/.from-code output)]) + (#error.Failure ($_ /@compose "Character does not satisfy predicate: " (/.from-code output)))) _ (#error.Failure cannot-lex-error)))) @@ -260,79 +261,79 @@ (def: #export space {#.doc "Only lex white-space."} (Lexer Text) - (satisfies //.space?)) + (satisfies /.space?)) (def: #export (and left right) (-> (Lexer Text) (Lexer Text) (Lexer Text)) - (do p.monad + (do //.monad [=left left =right right] - (wrap ($_ //@compose =left =right)))) + (wrap ($_ /@compose =left =right)))) (def: #export (and! left right) (-> (Lexer Slice) (Lexer Slice) (Lexer Slice)) - (do p.monad + (do //.monad [[left::basis left::distance] left [right::basis right::distance] right] (wrap [left::basis ("lux i64 +" left::distance right::distance)]))) (template [<name> <base> <doc-modifier>] [(def: #export (<name> lexer) - {#.doc (code.text ($_ //@compose "Lex " <doc-modifier> " characters as a single continuous text."))} + {#.doc (code.text ($_ /@compose "Lex " <doc-modifier> " characters as a single continuous text."))} (-> (Lexer Text) (Lexer Text)) - (|> lexer <base> (:: p.monad map //.concat)))] + (|> lexer <base> (:: //.monad map /.concat)))] - [some p.some "some"] - [many p.many "many"] + [some //.some "some"] + [many //.many "many"] ) (template [<name> <base> <doc-modifier>] [(def: #export (<name> lexer) - {#.doc (code.text ($_ //@compose "Lex " <doc-modifier> " characters as a single continuous text."))} + {#.doc (code.text ($_ /@compose "Lex " <doc-modifier> " characters as a single continuous text."))} (-> (Lexer Slice) (Lexer Slice)) (with-slices (<base> lexer)))] - [some! p.some "some"] - [many! p.many "many"] + [some! //.some "some"] + [many! //.many "many"] ) (template [<name> <base> <doc-modifier>] [(def: #export (<name> amount lexer) - {#.doc (code.text ($_ //@compose "Lex " <doc-modifier> " N characters."))} + {#.doc (code.text ($_ /@compose "Lex " <doc-modifier> " N characters."))} (-> Nat (Lexer Text) (Lexer Text)) - (|> lexer (<base> amount) (:: p.monad map //.concat)))] + (|> lexer (<base> amount) (:: //.monad map /.concat)))] - [exactly p.exactly "exactly"] - [at-most p.at-most "at most"] - [at-least p.at-least "at least"] + [exactly //.exactly "exactly"] + [at-most //.at-most "at most"] + [at-least //.at-least "at least"] ) (template [<name> <base> <doc-modifier>] [(def: #export (<name> amount lexer) - {#.doc (code.text ($_ //@compose "Lex " <doc-modifier> " N characters."))} + {#.doc (code.text ($_ /@compose "Lex " <doc-modifier> " N characters."))} (-> Nat (Lexer Slice) (Lexer Slice)) (with-slices (<base> amount lexer)))] - [exactly! p.exactly "exactly"] - [at-most! p.at-most "at most"] - [at-least! p.at-least "at least"] + [exactly! //.exactly "exactly"] + [at-most! //.at-most "at most"] + [at-least! //.at-least "at least"] ) (def: #export (between from to lexer) {#.doc "Lex between N and M characters."} (-> Nat Nat (Lexer Text) (Lexer Text)) - (|> lexer (p.between from to) (:: p.monad map //.concat))) + (|> lexer (//.between from to) (:: //.monad map /.concat))) (def: #export (between! from to lexer) {#.doc "Lex between N and M characters."} (-> Nat Nat (Lexer Slice) (Lexer Slice)) - (with-slices (p.between from to lexer))) + (with-slices (//.between from to lexer))) (def: #export (enclosed [start end] lexer) (All [a] (-> [Text Text] (Lexer a) (Lexer a))) (|> lexer - (p.before (this end)) - (p.after (this start)))) + (//.before (this end)) + (//.after (this start)))) (def: #export (local local-input lexer) {#.doc "Run a lexer with the given input, instead of the real one."} @@ -347,10 +348,10 @@ (def: #export (slice lexer) (-> (Lexer Slice) (Lexer Text)) - (do p.monad + (do //.monad [[basis distance] lexer] (function (_ (^@ input [offset tape])) - (case (//.clip basis ("lux i64 +" basis distance) tape) + (case (/.clip basis ("lux i64 +" basis distance) tape) (#.Some output) (#error.Success [input output]) diff --git a/stdlib/source/lux/data/format/json.lux b/stdlib/source/lux/data/format/json.lux index 34fcf4dfb..beb5eca8d 100644 --- a/stdlib/source/lux/data/format/json.lux +++ b/stdlib/source/lux/data/format/json.lux @@ -7,7 +7,8 @@ codec] [control pipe - ["p" parser (#+ Parser) ("#@." monad)] + ["p" parser (#+ Parser) ("#@." monad) + ["l" text]] ["ex" exception (#+ exception:)]] [data ["." bit] @@ -17,8 +18,7 @@ ["." product] [number ["." frac ("#@." decimal)]] - ["." text ("#@." equivalence monoid) - ["l" lexer]] + ["." text ("#@." equivalence monoid)] [collection ["." list ("#@." fold monad)] ["." row (#+ Row row) ("#@." monad)] diff --git a/stdlib/source/lux/data/format/xml.lux b/stdlib/source/lux/data/format/xml.lux index 6cd469e04..29a77c0df 100644 --- a/stdlib/source/lux/data/format/xml.lux +++ b/stdlib/source/lux/data/format/xml.lux @@ -5,7 +5,8 @@ [equivalence (#+ Equivalence)] codec] [control - ["p" parser ("#;." monad)] + ["p" parser ("#;." monad) + ["l" text]] ["ex" exception (#+ exception:)]] [data ["." error (#+ Error)] @@ -13,8 +14,7 @@ ["." name ("#;." equivalence codec)] [number ["." int]] - ["." text ("#;." equivalence monoid) - ["l" lexer]] + ["." text ("#;." equivalence monoid)] [collection ["." list ("#;." monad)] ["d" dictionary]]]]) diff --git a/stdlib/source/lux/data/text/regex.lux b/stdlib/source/lux/data/text/regex.lux index 73b6dab3b..ad648677d 100644 --- a/stdlib/source/lux/data/text/regex.lux +++ b/stdlib/source/lux/data/text/regex.lux @@ -3,7 +3,8 @@ [abstract monad] [control - ["p" parser ("#@." monad)]] + ["p" parser ("#@." monad) + ["l" text]]] [data ["." product] ["." error] @@ -16,7 +17,6 @@ ["." code] ["s" syntax (#+ syntax:)]]] ["." // - ["l" lexer] format]) (def: regex-char^ diff --git a/stdlib/source/lux/macro/poly/json.lux b/stdlib/source/lux/macro/poly/json.lux index e0e122eb1..1253ec328 100644 --- a/stdlib/source/lux/macro/poly/json.lux +++ b/stdlib/source/lux/macro/poly/json.lux @@ -6,7 +6,8 @@ ["." codec]] [control ["p" parser - ["<.>" type]]] + ["<.>" type] + ["l" text]]] [data ["." bit] maybe @@ -18,7 +19,6 @@ ["." nat ("#@." decimal)] ["." frac ("#@." decimal)]] ["." text ("#@." equivalence) - ["l" lexer] format] [format ["/" json (#+ JSON)]] diff --git a/stdlib/source/lux/math/modular.lux b/stdlib/source/lux/math/modular.lux index 24c7b0e72..07fa14c3d 100644 --- a/stdlib/source/lux/math/modular.lux +++ b/stdlib/source/lux/math/modular.lux @@ -5,13 +5,13 @@ [monad (#+ do)]] [control ["ex" exception (#+ exception:)] - ["p" parser]] + ["p" parser + ["l" text (#+ Lexer)]]] [data ["." error (#+ Error)] [number ["." int ("#@." decimal)]] - ["." text ("#@." monoid) - ["l" lexer (#+ Lexer)]]] + ["." text ("#@." monoid)]] [type abstract] [macro diff --git a/stdlib/source/lux/time/date.lux b/stdlib/source/lux/time/date.lux index fa7a40676..383988c14 100644 --- a/stdlib/source/lux/time/date.lux +++ b/stdlib/source/lux/time/date.lux @@ -7,15 +7,15 @@ codec [monad (#+ do)]] [control - ["p" parser ("#@." functor)]] + ["p" parser ("#@." functor) + ["l" text]]] [data ["." error (#+ Error)] ["." maybe] [number ["." nat ("#@." decimal)] ["." int ("#@." decimal)]] - ["." text ("#@." monoid) - ["l" lexer]] + ["." text ("#@." monoid)] [collection ["." row (#+ Row row)]]]] ["." // #_ diff --git a/stdlib/source/lux/time/duration.lux b/stdlib/source/lux/time/duration.lux index d420cfa0d..0bbdd94ea 100644 --- a/stdlib/source/lux/time/duration.lux +++ b/stdlib/source/lux/time/duration.lux @@ -7,13 +7,13 @@ [monoid (#+ Monoid)] [monad (#+ do)]] [control - ["p" parser]] + ["p" parser + ["l" text]]] [data [number ["." nat ("#@." decimal)] ["." int ("#@." decimal number)]] - ["." text ("#@." monoid) - ["l" lexer]] + ["." text ("#@." monoid)] ["e" error]] [type abstract]]) diff --git a/stdlib/source/lux/time/instant.lux b/stdlib/source/lux/time/instant.lux index 51087e4fc..fcde19a3f 100644 --- a/stdlib/source/lux/time/instant.lux +++ b/stdlib/source/lux/time/instant.lux @@ -8,14 +8,14 @@ [monad (#+ do Monad)]] [control [io (#+ IO io)] - ["p" parser]] + ["p" parser + ["l" text]]] [data ["." error (#+ Error)] ["." maybe] [number ["." int ("#@." decimal)]] - ["." text ("#@." monoid) - ["l" lexer]] + ["." text ("#@." monoid)] [collection ["." list ("#@." fold)] ["." row (#+ Row row) ("#@." functor fold)]]] diff --git a/stdlib/source/lux/tool/compiler/default/syntax.lux b/stdlib/source/lux/tool/compiler/default/syntax.lux index 4a3ee89d2..788a492cd 100644 --- a/stdlib/source/lux/tool/compiler/default/syntax.lux +++ b/stdlib/source/lux/tool/compiler/default/syntax.lux @@ -29,7 +29,9 @@ [abstract monad] [control - ["." exception (#+ exception:)]] + ["." exception (#+ exception:)] + [parser + [text (#+ Offset)]]] [data ["." maybe] ["." error (#+ Error)] @@ -39,7 +41,6 @@ ["." rev] ["." frac]] ["." text - [lexer (#+ Offset)] format] [collection ["." list] diff --git a/stdlib/source/lux/world/net/http/cookie.lux b/stdlib/source/lux/world/net/http/cookie.lux index 4806b9714..174231251 100644 --- a/stdlib/source/lux/world/net/http/cookie.lux +++ b/stdlib/source/lux/world/net/http/cookie.lux @@ -2,12 +2,12 @@ [lux #* [control [monad (#+ do)] - ["p" parser ("#;." monad)]] + ["p" parser ("#;." monad) + ["l" text (#+ Lexer)]]] [data ["." error (#+ Error)] [text - format - ["l" lexer (#+ Lexer)]] + format] [format ["." context (#+ Context)]] [collection diff --git a/stdlib/source/lux/world/net/http/query.lux b/stdlib/source/lux/world/net/http/query.lux index 716910c4a..8b0379108 100644 --- a/stdlib/source/lux/world/net/http/query.lux +++ b/stdlib/source/lux/world/net/http/query.lux @@ -3,14 +3,14 @@ [control pipe [monad (#+ do)] - ["p" parser]] + ["p" parser + ["l" text (#+ Lexer)]]] [data ["." error (#+ Error)] [number ["." nat]] ["." text - format - ["l" lexer (#+ Lexer)]] + format] [format ["." context (#+ Context)]] [collection diff --git a/stdlib/source/test/lux/control.lux b/stdlib/source/test/lux/control.lux index 9d95dc969..bacb4cb24 100644 --- a/stdlib/source/test/lux/control.lux +++ b/stdlib/source/test/lux/control.lux @@ -19,6 +19,8 @@ ["#." frp] ["#." actor] ["#." stm]] + ["#." parser #_ + ["#/." text]] [security ["#." privacy] ["#." integrity]] @@ -34,6 +36,12 @@ /stm.test )) +(def: parser + Test + ($_ _.and + /parser/text.test + )) + (def: security Test ($_ _.and @@ -57,5 +65,6 @@ /thread.test /writer.test ..concurrency + ..parser ..security )) diff --git a/stdlib/source/test/lux/data/text/lexer.lux b/stdlib/source/test/lux/control/parser/text.lux index 3693b0fd0..3693b0fd0 100644 --- a/stdlib/source/test/lux/data/text/lexer.lux +++ b/stdlib/source/test/lux/control/parser/text.lux diff --git a/stdlib/source/test/lux/data.lux b/stdlib/source/test/lux/data.lux index 92680f03a..a29358b6b 100644 --- a/stdlib/source/test/lux/data.lux +++ b/stdlib/source/test/lux/data.lux @@ -20,7 +20,6 @@ ["#." ratio] ["#." complex]] ["#." text - ["#/." lexer] ["#/." regex]] [format ["#." json] @@ -42,7 +41,6 @@ (def: text ($_ _.and /text.test - /text/lexer.test /text/regex.test )) diff --git a/stdlib/source/test/lux/data/text/regex.lux b/stdlib/source/test/lux/data/text/regex.lux index a683c446f..eeec23d2f 100644 --- a/stdlib/source/test/lux/data/text/regex.lux +++ b/stdlib/source/test/lux/data/text/regex.lux @@ -5,12 +5,12 @@ [abstract/monad (#+ do)] [control pipe - ["p" parser]] + ["p" parser + ["<.>" text (#+ Lexer)]]] [data [number (#+ hex)] ["." error] - ["." text ("#@." equivalence) - ["." lexer (#+ Lexer)]]] + ["." text ("#@." equivalence)]] [math ["r" random]] ["." macro @@ -20,7 +20,7 @@ (def: (should-pass regex input) (-> (Lexer Text) Text Bit) - (|> (lexer.run input regex) + (|> (<text>.run input regex) (case> (#error.Success parsed) (text@= parsed input) @@ -29,7 +29,7 @@ (def: (text-should-pass test regex input) (-> Text (Lexer Text) Text Bit) - (|> (lexer.run input regex) + (|> (<text>.run input regex) (case> (#error.Success parsed) (text@= test parsed) @@ -38,7 +38,7 @@ (def: (should-fail regex input) (All [a] (-> (Lexer a) Text Bit)) - (|> (lexer.run input regex) + (|> (<text>.run input regex) (case> (#error.Failure _) true @@ -47,7 +47,7 @@ (syntax: (should-check pattern regex input) (macro.with-gensyms [g!message g!_] - (wrap (list (` (|> (lexer.run (~ input) (~ regex)) + (wrap (list (` (|> (<text>.run (~ input) (~ regex)) (case> (^ (#error.Success (~ pattern))) true diff --git a/stdlib/source/test/lux/tool/compiler/default/syntax.lux b/stdlib/source/test/lux/tool/compiler/default/syntax.lux index 9f36c551f..a0005cc64 100644 --- a/stdlib/source/test/lux/tool/compiler/default/syntax.lux +++ b/stdlib/source/test/lux/tool/compiler/default/syntax.lux @@ -6,10 +6,12 @@ ["." name]] ["r" math/random (#+ Random) ("#@." monad)] ["_" test (#+ Test)] + [control + [parser + ["l" text]]] [data ["." error] - ["." text - ["l" lexer]] + ["." text] [collection ["." list] ["." dictionary (#+ Dictionary)]]] |