aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/control/parser
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/lux/control/parser.lux6
-rw-r--r--stdlib/source/lux/control/parser/analysis.lux4
-rw-r--r--stdlib/source/lux/control/parser/binary.lux10
-rw-r--r--stdlib/source/lux/control/parser/cli.lux10
-rw-r--r--stdlib/source/lux/control/parser/code.lux40
-rw-r--r--stdlib/source/lux/control/parser/json.lux18
-rw-r--r--stdlib/source/lux/control/parser/synthesis.lux4
-rw-r--r--stdlib/source/lux/control/parser/text.lux32
-rw-r--r--stdlib/source/lux/control/parser/type.lux17
-rw-r--r--stdlib/source/lux/control/parser/xml.lux6
10 files changed, 72 insertions, 75 deletions
diff --git a/stdlib/source/lux/control/parser.lux b/stdlib/source/lux/control/parser.lux
index 259748caa..7397d03e0 100644
--- a/stdlib/source/lux/control/parser.lux
+++ b/stdlib/source/lux/control/parser.lux
@@ -12,7 +12,7 @@
[number
["n" nat]]
[collection
- ["." list ("#@." functor monoid)]]]])
+ ["." list ("#\." functor monoid)]]]])
(type: #export (Parser s a)
{#.doc "A generic parser."}
@@ -169,7 +169,7 @@
(do ..monad
[min (exactly n p)
extra (some p)]
- (wrap (list@compose min extra))))
+ (wrap (list\compose min extra))))
(def: #export (at-most n p)
{#.doc "Parse at most N times."}
@@ -208,7 +208,7 @@
(#.Some x)
(do !
[xs' (some (..and sep p))]
- (wrap (#.Cons x (list@map product.right xs'))))
+ (wrap (#.Cons x (list\map product.right xs'))))
)))
(def: #export (not p)
diff --git a/stdlib/source/lux/control/parser/analysis.lux b/stdlib/source/lux/control/parser/analysis.lux
index eb1757862..6105b5f5a 100644
--- a/stdlib/source/lux/control/parser/analysis.lux
+++ b/stdlib/source/lux/control/parser/analysis.lux
@@ -17,7 +17,7 @@
["." text
["%" format (#+ format)]]
[collection
- ["." list ("#@." functor)]]]
+ ["." list ("#\." functor)]]]
[tool
[compiler
[reference (#+)
@@ -32,7 +32,7 @@
(-> (List Analysis) Text)
(format text.new-line "Remaining input: "
(|> asts
- (list@map /.%analysis)
+ (list\map /.%analysis)
(list.interpose " ")
(text.join-with ""))))
diff --git a/stdlib/source/lux/control/parser/binary.lux b/stdlib/source/lux/control/parser/binary.lux
index 4ed003882..3d1d30564 100644
--- a/stdlib/source/lux/control/parser/binary.lux
+++ b/stdlib/source/lux/control/parser/binary.lux
@@ -21,7 +21,7 @@
["." set (#+ Set)]]]
[macro
["." template]]]
- ["." // ("#@." monad)])
+ ["." // ("#\." monad)])
(type: #export Offset Nat)
@@ -94,7 +94,7 @@
(def: #export frac
(Parser Frac)
- (//@map frac.from-bits ..bits/64))
+ (//\map frac.from-bits ..bits/64))
(exception: #export (invalid-tag {range Nat} {byte Nat})
(exception.report
@@ -124,7 +124,7 @@
(def: #export any
(Parser Any)
- (//@wrap []))
+ (//\wrap []))
(exception: #export (not-a-bit {value Nat})
(exception.report
@@ -155,7 +155,7 @@
[(def: #export <name>
(Parser Binary)
(do //.monad
- [size (//@map .nat <bits>)]
+ [size (//\map .nat <bits>)]
(..segment size)))]
[binary/8 ..bits/8]
@@ -196,7 +196,7 @@
[value valueP]
(recur (.inc index)
(row.add value output)))
- (//@wrap output)))))]
+ (//\wrap output)))))]
[row/8 ..bits/8]
[row/16 ..bits/16]
diff --git a/stdlib/source/lux/control/parser/cli.lux b/stdlib/source/lux/control/parser/cli.lux
index 0c1910d2f..e89b77a16 100644
--- a/stdlib/source/lux/control/parser/cli.lux
+++ b/stdlib/source/lux/control/parser/cli.lux
@@ -7,8 +7,8 @@
["." try (#+ Try)]]
[data
[collection
- ["." list ("#@." monoid monad)]]
- ["." text ("#@." equivalence)
+ ["." list ("#\." monoid monad)]]
+ ["." text ("#\." equivalence)
["%" format (#+ format)]]]
[meta (#+ with-gensyms)]
[macro
@@ -65,7 +65,7 @@
(function (_ inputs)
(do try.monad
[[remaining raw] (any inputs)]
- (if (text@= reference raw)
+ (if (text\= reference raw)
(wrap [remaining []])
(try.fail (format "Missing token: '" reference "'"))))))
@@ -166,9 +166,9 @@
(case ((: (~! (..Parser (io.IO .Any)))
((~! do) (~! //.monad)
[(~+ (|> args
- (list@map (function (_ [binding parser])
+ (list\map (function (_ [binding parser])
(list binding parser)))
- list@join))]
+ list\join))]
((~' wrap) (~ initialization+event-loop))))
(~ g!args))
(#.Right [(~ g!_) (~ g!output)])
diff --git a/stdlib/source/lux/control/parser/code.lux b/stdlib/source/lux/control/parser/code.lux
index f03188e15..2df442a8f 100644
--- a/stdlib/source/lux/control/parser/code.lux
+++ b/stdlib/source/lux/control/parser/code.lux
@@ -6,7 +6,7 @@
["." try (#+ Try)]]
[data
["." bit]
- ["." text ("#@." monoid)]
+ ["." text ("#\." monoid)]
["." name]
[number
["." nat]
@@ -14,9 +14,9 @@
["." rev]
["." frac]]
[collection
- ["." list ("#@." functor)]]]
+ ["." list ("#\." functor)]]]
[macro
- ["." code ("#@." equivalence)]]]
+ ["." code ("#\." equivalence)]]]
["." //])
(def: (join-pairs pairs)
@@ -31,8 +31,8 @@
(def: (remaining-inputs asts)
(-> (List Code) Text)
- ($_ text@compose text.new-line "Remaining input: "
- (|> asts (list@map code.format) (list.interpose " ") (text.join-with ""))))
+ ($_ text\compose text.new-line "Remaining input: "
+ (|> asts (list\map code.format) (list.interpose " ") (text.join-with ""))))
(def: #export any
{#.doc "Just returns the next input without applying any logic."}
@@ -46,9 +46,9 @@
(#try.Success [tokens' t]))))
(template [<query> <check> <type> <tag> <eq> <desc>]
- [(with-expansions [<failure> (as-is (#try.Failure ($_ text@compose "Cannot parse " <desc> (remaining-inputs tokens))))]
+ [(with-expansions [<failure> (as-is (#try.Failure ($_ text\compose "Cannot parse " <desc> (remaining-inputs tokens))))]
(def: #export <query>
- {#.doc (code.text ($_ text@compose "Parses the next " <desc> " input."))}
+ {#.doc (code.text ($_ text\compose "Parses the next " <desc> " input."))}
(Parser <type>)
(function (_ tokens)
(case tokens
@@ -86,18 +86,18 @@
(function (_ tokens)
(case tokens
(#.Cons [token tokens'])
- (if (code@= ast token)
+ (if (code\= ast token)
(#try.Success [tokens' []])
- (#try.Failure ($_ text@compose "Expected a " (code.format ast) " but instead got " (code.format token)
+ (#try.Failure ($_ text\compose "Expected a " (code.format ast) " but instead got " (code.format token)
(remaining-inputs tokens))))
_
(#try.Failure "There are no tokens to parse!"))))
(template [<query> <check> <tag> <eq> <desc>]
- [(with-expansions [<failure> (as-is (#try.Failure ($_ text@compose "Cannot parse " <desc> (remaining-inputs tokens))))]
+ [(with-expansions [<failure> (as-is (#try.Failure ($_ text\compose "Cannot parse " <desc> (remaining-inputs tokens))))]
(def: #export <query>
- {#.doc (code.text ($_ text@compose "Parse a local " <desc> " (a " <desc> " that has no module prefix)."))}
+ {#.doc (code.text ($_ text\compose "Parse a local " <desc> " (a " <desc> " that has no module prefix)."))}
(Parser Text)
(function (_ tokens)
(case tokens
@@ -125,7 +125,7 @@
(template [<name> <tag> <desc>]
[(def: #export (<name> p)
- {#.doc (code.text ($_ text@compose "Parse inside the contents of a " <desc> " as if they were the input Codes."))}
+ {#.doc (code.text ($_ text\compose "Parse inside the contents of a " <desc> " as if they were the input Codes."))}
(All [a]
(-> (Parser a) (Parser a)))
(function (_ tokens)
@@ -133,17 +133,17 @@
(#.Cons [[_ (<tag> members)] tokens'])
(case (p members)
(#try.Success [#.Nil x]) (#try.Success [tokens' x])
- _ (#try.Failure ($_ text@compose "Parser was expected to fully consume " <desc> (remaining-inputs tokens))))
+ _ (#try.Failure ($_ text\compose "Parser was expected to fully consume " <desc> (remaining-inputs tokens))))
_
- (#try.Failure ($_ text@compose "Cannot parse " <desc> (remaining-inputs tokens))))))]
+ (#try.Failure ($_ text\compose "Cannot parse " <desc> (remaining-inputs tokens))))))]
[ form #.Form "form"]
[tuple #.Tuple "tuple"]
)
(def: #export (record p)
- {#.doc (code.text ($_ text@compose "Parse inside the contents of a record as if they were the input Codes."))}
+ {#.doc (code.text ($_ text\compose "Parse inside the contents of a record as if they were the input Codes."))}
(All [a]
(-> (Parser a) (Parser a)))
(function (_ tokens)
@@ -151,10 +151,10 @@
(#.Cons [[_ (#.Record pairs)] tokens'])
(case (p (join-pairs pairs))
(#try.Success [#.Nil x]) (#try.Success [tokens' x])
- _ (#try.Failure ($_ text@compose "Parser was expected to fully consume record" (remaining-inputs tokens))))
+ _ (#try.Failure ($_ text\compose "Parser was expected to fully consume record" (remaining-inputs tokens))))
_
- (#try.Failure ($_ text@compose "Cannot parse record" (remaining-inputs tokens))))))
+ (#try.Failure ($_ text\compose "Cannot parse record" (remaining-inputs tokens))))))
(def: #export end!
{#.doc "Ensures there are no more inputs."}
@@ -162,7 +162,7 @@
(function (_ tokens)
(case tokens
#.Nil (#try.Success [tokens []])
- _ (#try.Failure ($_ text@compose "Expected list of tokens to be empty!" (remaining-inputs tokens))))))
+ _ (#try.Failure ($_ text\compose "Expected list of tokens to be empty!" (remaining-inputs tokens))))))
(def: #export end?
{#.doc "Checks whether there are no more inputs."}
@@ -184,8 +184,8 @@
(#try.Success value)
_
- (#try.Failure (text@compose "Unconsumed inputs: "
- (|> (list@map code.format unconsumed)
+ (#try.Failure (text\compose "Unconsumed inputs: "
+ (|> (list\map code.format unconsumed)
(text.join-with ", ")))))))
(def: #export (local inputs syntax)
diff --git a/stdlib/source/lux/control/parser/json.lux b/stdlib/source/lux/control/parser/json.lux
index 48006855b..fe82104d0 100644
--- a/stdlib/source/lux/control/parser/json.lux
+++ b/stdlib/source/lux/control/parser/json.lux
@@ -7,18 +7,18 @@
["." exception (#+ exception:)]]
[data
["." bit]
- ["." text ("#@." equivalence monoid)]
+ ["." text ("#\." equivalence monoid)]
[number
["." frac]]
[collection
- ["." list ("#@." functor)]
+ ["." list ("#\." functor)]
["." row]
["." dictionary (#+ Dictionary)]]
[format
["/" json (#+ JSON)]]]
[macro
["." code]]]
- ["." // ("#@." functor)])
+ ["." // ("#\." functor)])
(type: #export (Parser a)
{#.doc "JSON parser."}
@@ -61,7 +61,7 @@
(template [<name> <type> <tag> <desc>]
[(def: #export <name>
- {#.doc (code.text ($_ text@compose "Reads a JSON value as " <desc> "."))}
+ {#.doc (code.text ($_ text\compose "Reads a JSON value as " <desc> "."))}
(Parser <type>)
(do //.monad
[head ..any]
@@ -85,7 +85,7 @@
(template [<test> <check> <type> <equivalence> <tag> <desc>]
[(def: #export (<test> test)
- {#.doc (code.text ($_ text@compose "Asks whether a JSON value is a " <desc> "."))}
+ {#.doc (code.text ($_ text\compose "Asks whether a JSON value is a " <desc> "."))}
(-> <type> (Parser Bit))
(do //.monad
[head ..any]
@@ -97,7 +97,7 @@
(//.fail (exception.construct ..unexpected-value [head])))))
(def: #export (<check> test)
- {#.doc (code.text ($_ text@compose "Ensures a JSON value is a " <desc> "."))}
+ {#.doc (code.text ($_ text\compose "Ensures a JSON value is a " <desc> "."))}
(-> <type> (Parser Any))
(do //.monad
[head ..any]
@@ -151,7 +151,7 @@
(#/.Object kvs)
(case (|> kvs
dictionary.entries
- (list@map (function (_ [key value])
+ (list\map (function (_ [key value])
(list (#/.String key) value)))
list.concat
(//.run parser))
@@ -175,7 +175,7 @@
(function (recur inputs)
(case inputs
(^ (list& (#/.String key) value inputs'))
- (if (text@= key field-name)
+ (if (text\= key field-name)
(case (//.run parser (list value))
(#try.Success [#.Nil output])
(#try.Success [inputs' output])
@@ -202,4 +202,4 @@
(|>> (//.and ..string)
//.some
..object
- (//@map (dictionary.from-list text.hash))))
+ (//\map (dictionary.from-list text.hash))))
diff --git a/stdlib/source/lux/control/parser/synthesis.lux b/stdlib/source/lux/control/parser/synthesis.lux
index 0e42618f6..cdca47d1c 100644
--- a/stdlib/source/lux/control/parser/synthesis.lux
+++ b/stdlib/source/lux/control/parser/synthesis.lux
@@ -13,9 +13,7 @@
["n" nat]
["." frac]]
["." text
- ["%" format (#+ format)]]
- [collection
- ["." list ("#@." functor)]]]
+ ["%" format (#+ format)]]]
[tool
[compiler
[reference (#+)
diff --git a/stdlib/source/lux/control/parser/text.lux b/stdlib/source/lux/control/parser/text.lux
index 114b53deb..aede52006 100644
--- a/stdlib/source/lux/control/parser/text.lux
+++ b/stdlib/source/lux/control/parser/text.lux
@@ -8,11 +8,11 @@
[data
["." product]
["." maybe]
- ["/" text (#+ Char) ("#@." monoid)]
+ ["/" text (#+ Char) ("#\." monoid)]
[number
- ["n" nat ("#@." decimal)]]
+ ["n" nat ("#\." decimal)]]
[collection
- ["." list ("#@." fold)]]]
+ ["." list ("#\." fold)]]]
[macro
["." code]]]
["." //])
@@ -34,13 +34,13 @@
(exception: #export (unconsumed-input {offset Offset} {tape Text})
(exception.report
- ["Offset" (n@encode offset)]
- ["Input size" (n@encode (/.size tape))]
+ ["Offset" (n\encode offset)]
+ ["Input size" (n\encode (/.size tape))]
["Remaining input" (remaining offset tape)]))
(exception: #export (expected-to-fail {offset Offset} {tape Text})
(exception.report
- ["Offset" (n@encode offset)]
+ ["Offset" (n\encode offset)]
["Input" (remaining offset tape)]))
(exception: #export cannot-parse)
@@ -67,7 +67,7 @@
(do //.monad
[offset ..offset
slices parser]
- (wrap (list@fold (function (_ [slice::basis slice::distance]
+ (wrap (list\fold (function (_ [slice::basis slice::distance]
[total::basis total::distance])
[total::basis ("lux i64 +" slice::distance total::distance)])
{#basis offset
@@ -163,14 +163,14 @@
(do //.monad
[char any
#let [char' (maybe.assume (/.nth 0 char))]
- _ (//.assert ($_ /@compose "Character is not within range: " (/.from-code bottom) "-" (/.from-code top))
+ _ (//.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."))}
(Parser Text)
(..range (char <bottom>) (char <top>)))]
@@ -210,7 +210,7 @@
(template [<name> <modifier> <exception> <description-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 (Parser Text))
(function (_ [offset tape])
(case (/.nth offset tape)
@@ -229,7 +229,7 @@
(template [<name> <modifier> <exception> <description-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 (Parser Slice))
(function (_ [offset tape])
(case (/.nth offset tape)
@@ -275,7 +275,7 @@
(do //.monad
[=left left
=right right]
- (wrap ($_ /@compose =left =right))))
+ (wrap ($_ /\compose =left =right))))
(def: #export (and! left right)
(-> (Parser Slice) (Parser Slice) (Parser Slice))
@@ -286,7 +286,7 @@
(template [<name> <base> <doc-modifier>]
[(def: #export (<name> parser)
- {#.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."))}
(-> (Parser Text) (Parser Text))
(|> parser <base> (:: //.monad map /.concat)))]
@@ -296,7 +296,7 @@
(template [<name> <base> <doc-modifier>]
[(def: #export (<name> parser)
- {#.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."))}
(-> (Parser Slice) (Parser Slice))
(with-slices (<base> parser)))]
@@ -306,7 +306,7 @@
(template [<name> <base> <doc-modifier>]
[(def: #export (<name> amount parser)
- {#.doc (code.text ($_ /@compose "Lex " <doc-modifier> " N characters."))}
+ {#.doc (code.text ($_ /\compose "Lex " <doc-modifier> " N characters."))}
(-> Nat (Parser Text) (Parser Text))
(|> parser (<base> amount) (:: //.monad map /.concat)))]
@@ -317,7 +317,7 @@
(template [<name> <base> <doc-modifier>]
[(def: #export (<name> amount parser)
- {#.doc (code.text ($_ /@compose "Lex " <doc-modifier> " N characters."))}
+ {#.doc (code.text ($_ /\compose "Lex " <doc-modifier> " N characters."))}
(-> Nat (Parser Slice) (Parser Slice))
(with-slices (<base> amount parser)))]
diff --git a/stdlib/source/lux/control/parser/type.lux b/stdlib/source/lux/control/parser/type.lux
index f361809e5..c9b8a5c96 100644
--- a/stdlib/source/lux/control/parser/type.lux
+++ b/stdlib/source/lux/control/parser/type.lux
@@ -7,17 +7,16 @@
["." exception (#+ exception:)]
["." function]]
[data
- ["." name ("#@." codec)]
[number
- ["n" nat ("#@." decimal)]]
- ["." text ("#@." monoid)
+ ["n" nat ("#\." decimal)]]
+ ["." text ("#\." monoid)
["%" format (#+ format)]]
[collection
- ["." list ("#@." functor)]
+ ["." list ("#\." functor)]
["." dictionary (#+ Dictionary)]]]
[macro
["." code]]
- ["." type ("#@." equivalence)
+ ["." type ("#\." equivalence)
["." check]]]
["." //])
@@ -53,7 +52,7 @@
(exception: #export (unconsumed-input {remaining (List Type)})
(exception.report
["Types" (|> remaining
- (list@map (|>> %.type (format text.new-line "* ")))
+ (list\map (|>> %.type (format text.new-line "* ")))
(text.join-with ""))]))
(type: #export Env
@@ -131,7 +130,7 @@
(def: (label idx)
(-> Nat Code)
- (code.local-identifier ($_ text@compose "label" text.tab (n@encode idx))))
+ (code.local-identifier ($_ text\compose "label" text.tab (n\encode idx))))
(def: #export (with-extension type poly)
(All [a] (-> Type (Parser a) (Parser [Code a])))
@@ -193,7 +192,7 @@
partial-varI (inc partialI)
partial-varL (label partial-varI)
partialC (` ((~ funcL) (~+ (|> (list.indices num-args)
- (list@map (|>> (n.* 2) inc (n.+ funcI) label))
+ (list\map (|>> (n.* 2) inc (n.+ funcI) label))
list.reverse))))]
(recur (inc current-arg)
(|> env'
@@ -235,7 +234,7 @@
(wrap [])
(//.fail (exception.construct ..types-do-not-match [expected actual])))))]
- [exactly type@=]
+ [exactly type\=]
[sub check.checks?]
[super (function.flip check.checks?)]
)
diff --git a/stdlib/source/lux/control/parser/xml.lux b/stdlib/source/lux/control/parser/xml.lux
index 8ba28d20d..c3d3136c7 100644
--- a/stdlib/source/lux/control/parser/xml.lux
+++ b/stdlib/source/lux/control/parser/xml.lux
@@ -6,11 +6,11 @@
["." try (#+ Try)]
["." exception (#+ exception:)]]
[data
- ["." name ("#@." equivalence codec)]
+ ["." name ("#\." equivalence codec)]
["." text
["%" format (#+ format)]]
[collection
- ["." list ("#@." functor)]
+ ["." list]
["." dictionary]]
[format
["/" xml (#+ Attribute Tag XML)]]]]
@@ -63,7 +63,7 @@
(exception.throw ..unexpected-input [])
(#/.Node _tag _attributes _children)
- (if (name@= tag _tag)
+ (if (name\= tag _tag)
(#try.Success [docs []])
(exception.throw ..wrong-tag tag))))))