aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/data
diff options
context:
space:
mode:
authorEduardo Julian2018-07-21 23:57:21 -0400
committerEduardo Julian2018-07-21 23:57:21 -0400
commit9671d6064dd02dfe6c32492f5b9907b096e5bd89 (patch)
treedb89e3908dedd606ce5838096bc5df9ebcc9b1c4 /stdlib/source/lux/data
parent22d10692d87ac1c07fc14f6100917b913bb0f8b3 (diff)
Re-named "seq" to "and" and "alt" to "or".
Diffstat (limited to 'stdlib/source/lux/data')
-rw-r--r--stdlib/source/lux/data/collection/tree/rose.lux4
-rw-r--r--stdlib/source/lux/data/format/binary.lux34
-rw-r--r--stdlib/source/lux/data/format/json.lux8
-rw-r--r--stdlib/source/lux/data/format/xml.lux2
-rw-r--r--stdlib/source/lux/data/text/lexer.lux8
-rw-r--r--stdlib/source/lux/data/text/regex.lux18
6 files changed, 37 insertions, 37 deletions
diff --git a/stdlib/source/lux/data/collection/tree/rose.lux b/stdlib/source/lux/data/collection/tree/rose.lux
index 414f44f31..62b65422a 100644
--- a/stdlib/source/lux/data/collection/tree/rose.lux
+++ b/stdlib/source/lux/data/collection/tree/rose.lux
@@ -40,11 +40,11 @@
(def: tree^
(Syntax Tree-Code)
- (|> (|>> p.some s.record (p.seq s.any))
+ (|> (|>> p.some s.record (p.and s.any))
p.rec
p.some
s.record
- (p.seq s.any)
+ (p.and s.any)
s.tuple))
(syntax: #export (tree {root tree^})
diff --git a/stdlib/source/lux/data/format/binary.lux b/stdlib/source/lux/data/format/binary.lux
index 4ea21c30c..b2feda2c5 100644
--- a/stdlib/source/lux/data/format/binary.lux
+++ b/stdlib/source/lux/data/format/binary.lux
@@ -1,5 +1,5 @@
(.module:
- [lux (#- nat int rev list type)
+ [lux (#- and or nat int rev list type)
[control
[monad (#+ do Monad)]
["p" parser]
@@ -86,7 +86,7 @@
)
## Combinators
-(def: #export (alt leftB rightB)
+(def: #export (or leftB rightB)
(All [l r] (-> (Format l) (Format r) (Format (| l r))))
{#read (do p.Monad<Parser>
[flag (get@ #read bits/8)]
@@ -115,9 +115,9 @@
(rightT (.inc offset))))])
))})
-(def: #export (seq preB postB)
+(def: #export (and preB postB)
(All [a b] (-> (Format a) (Format b) (Format [a b])))
- {#read (p.seq (get@ #read preB) (get@ #read postB))
+ {#read (p.and (get@ #read preB) (get@ #read postB))
#write (function (_ [preV postV])
(let [[preS preT] ((get@ #write preB) preV)
[postS postT] ((get@ #write postB) postV)]
@@ -210,29 +210,29 @@
(def: #export maybe
(All [a] (-> (Format a) (Format (Maybe a))))
- (..alt ..any))
+ (..or ..any))
(def: #export (list value)
(All [a] (-> (Format a) (Format (List a))))
(..rec
(function (_ recur)
- (..alt ..any
- (..seq value recur)))))
+ (..or ..any
+ (..and value recur)))))
(def: #export name
(Format Name)
- (..seq ..text ..text))
+ (..and ..text ..text))
(def: #export type
(Format Type)
(..rec
(function (_ type)
- (let [pair (..seq type type)
+ (let [pair (..and type type)
indexed ..nat
- quantified (..seq (..list type) type)]
- ($_ ..alt
+ quantified (..and (..list type) type)]
+ ($_ ..or
## #Primitive
- (..seq ..text (..list type))
+ (..and ..text (..list type))
## #Sum
pair
## #Product
@@ -252,19 +252,19 @@
## #Apply
pair
## #Named
- (..seq ..name type)
+ (..and ..name type)
)))))
(def: #export cursor
(Format Cursor)
- ($_ ..seq ..text ..nat ..nat))
+ ($_ ..and ..text ..nat ..nat))
(def: #export code
(Format Code)
(..rec
(function (_ code)
(let [sequence (..list code)
- code' ($_ ..alt
+ code' ($_ ..or
## #Bit
..bit
## #Nat
@@ -286,5 +286,5 @@
## #Tuple
sequence
## #Record
- (..list (..seq code code)))]
- (..seq ..cursor code')))))
+ (..list (..and code code)))]
+ (..and ..cursor code')))))
diff --git a/stdlib/source/lux/data/format/json.lux b/stdlib/source/lux/data/format/json.lux
index 79510cb5c..02c05f5dd 100644
--- a/stdlib/source/lux/data/format/json.lux
+++ b/stdlib/source/lux/data/format/json.lux
@@ -284,8 +284,8 @@
(def: #export (nullable parser)
(All [a] (-> (Reader a) (Reader (Maybe a))))
- (p.alt null
- parser))
+ (p.or null
+ parser))
(def: #export (array parser)
{#.doc "Parses a JSON array, assuming that every element can be parsed the same way."}
@@ -405,7 +405,7 @@
(def: data-sep
(l.Lexer [Text Any Text])
- ($_ p.seq space~ (l.this ",") space~))
+ ($_ p.and space~ (l.this ",") space~))
(def: null~
(l.Lexer Null)
@@ -502,7 +502,7 @@
(def: (json~' _)
(-> Any (l.Lexer JSON))
- ($_ p.alt null~ boolean~ number~ string~ (array~ json~') (object~ json~')))
+ ($_ p.or null~ boolean~ number~ string~ (array~ json~') (object~ json~')))
(structure: #export _ (Codec Text JSON)
(def: encode show-json)
diff --git a/stdlib/source/lux/data/format/xml.lux b/stdlib/source/lux/data/format/xml.lux
index a990e6901..61215813b 100644
--- a/stdlib/source/lux/data/format/xml.lux
+++ b/stdlib/source/lux/data/format/xml.lux
@@ -99,7 +99,7 @@
(l.Lexer Attrs)
(<| (:: p.Monad<Parser> map (d.from-list name.Hash<Name>))
p.some
- (p.seq (spaced^ attr-name^))
+ (p.and (spaced^ attr-name^))
(p.after (l.this "="))
(spaced^ attr-value^)))
diff --git a/stdlib/source/lux/data/text/lexer.lux b/stdlib/source/lux/data/text/lexer.lux
index bd7a0ff98..6e16ee6ec 100644
--- a/stdlib/source/lux/data/text/lexer.lux
+++ b/stdlib/source/lux/data/text/lexer.lux
@@ -1,5 +1,5 @@
(.module:
- [lux (#- not)
+ [lux (#- or and not)
[control
[monad (#+ do Monad)]
["p" parser]]
@@ -128,8 +128,8 @@
[char any
#let [char' (maybe.assume (text.nth +0 char))]
_ (p.assert ($_ text/compose "Character is not within range: " (text.from-code bottom) "-" (text.from-code top))
- (and (n/>= bottom char')
- (n/<= top char')))]
+ (.and (n/>= bottom char')
+ (n/<= top char')))]
(wrap char)))
(do-template [<name> <bottom> <top> <desc>]
@@ -208,7 +208,7 @@
(Lexer Text)
(satisfies text.space?))
-(def: #export (seq left right)
+(def: #export (and left right)
(-> (Lexer Text) (Lexer Text) (Lexer Text))
(do p.Monad<Parser>
[=left left
diff --git a/stdlib/source/lux/data/text/regex.lux b/stdlib/source/lux/data/text/regex.lux
index b009d9dea..2e4087b23 100644
--- a/stdlib/source/lux/data/text/regex.lux
+++ b/stdlib/source/lux/data/text/regex.lux
@@ -67,10 +67,10 @@
(def: (name^ current-module)
(-> Text (l.Lexer Name))
($_ p.either
- (p.seq (parser/wrap current-module) (p.after (l.this "..") name-part^))
- (p.seq name-part^ (p.after (l.this ".") name-part^))
- (p.seq (parser/wrap "lux") (p.after (l.this ".") name-part^))
- (p.seq (parser/wrap "") name-part^)))
+ (p.and (parser/wrap current-module) (p.after (l.this "..") name-part^))
+ (p.and name-part^ (p.after (l.this ".") name-part^))
+ (p.and (parser/wrap "lux") (p.after (l.this ".") name-part^))
+ (p.and (parser/wrap "") name-part^)))
(def: (re-var^ current-module)
(-> Text (l.Lexer Code))
@@ -231,7 +231,7 @@
(l.enclosed ["{" "}"]
($_ p.either
(do @
- [[from to] (p.seq number^ (p.after (l.this ",") number^))]
+ [[from to] (p.and number^ (p.after (l.this ",") number^))]
(wrap (` ((~! join-text^) (p.between (~ (code.nat from))
(~ (code.nat to))
(~ base))))))
@@ -266,8 +266,8 @@
Text
(l.Lexer [Nat Code]))
(do p.Monad<Parser>
- [parts (p.many (p.alt (re-complex^ current-module)
- (re-scoped^ current-module)))
+ [parts (p.many (p.or (re-complex^ current-module)
+ (re-scoped^ current-module)))
#let [g!total (code.identifier ["" "0total"])
g!temp (code.identifier ["" "0temp"])
[_ names steps] (list/fold (: (-> (Either Code [Re-Group Code])
@@ -313,7 +313,7 @@
(def: (unflatten^ lexer)
(-> (l.Lexer Text) (l.Lexer [Text Any]))
- (p.seq lexer (:: p.Monad<Parser> wrap [])))
+ (p.and lexer (:: p.Monad<Parser> wrap [])))
(def: (|||^ left right)
(All [l r] (-> (l.Lexer [Text l]) (l.Lexer [Text r]) (l.Lexer [Text (| l r)])))
@@ -472,7 +472,7 @@
(wrap (list regex))
)))
-(syntax: #export (^regex {[pattern bindings] (s.form (p.seq s.text (p.maybe s.any)))}
+(syntax: #export (^regex {[pattern bindings] (s.form (p.and s.text (p.maybe s.any)))}
body
{branches (p.many s.any)})
{#.doc (doc "Allows you to test text against regular expressions."