aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/parser.lux
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--new-luxc/source/luxc/parser.lux39
1 files changed, 19 insertions, 20 deletions
diff --git a/new-luxc/source/luxc/parser.lux b/new-luxc/source/luxc/parser.lux
index 7eb4dcb16..b58038e7d 100644
--- a/new-luxc/source/luxc/parser.lux
+++ b/new-luxc/source/luxc/parser.lux
@@ -30,14 +30,13 @@
["p" parser "p/" Monad<Parser>])
(data [bool]
[text]
- ["R" result]
+ ["e" error]
[number]
[product]
[maybe]
(text ["l" lexer]
format)
- (coll [list "L/" Functor<List> Fold<List>]
- ["V" vector]))))
+ (coll [sequence #+ Sequence]))))
(def: white-space Text "\t\v \r\f")
(def: new-line Text "\n")
@@ -285,10 +284,10 @@
(l;one-of ".")
rich-digits^
(p;default ""
- ($_ l;seq
- (l;one-of "eE")
- (p;default "" (l;one-of "+-"))
- rich-digits^)))]
+ ($_ l;seq
+ (l;one-of "eE")
+ (p;default "" (l;one-of "+-"))
+ rich-digits^)))]
(case (:: number;Codec<Text,Frac> decode chunk)
(#;Left error)
(p;fail error)
@@ -429,14 +428,14 @@
(l;Lexer [Cursor Code]))
(do p;Monad<Parser>
[_ (l;this <open>)
- [where' elems] (loop [elems (: (V;Vector Code)
- V;empty)
+ [where' elems] (loop [elems (: (Sequence Code)
+ sequence;empty)
where where]
(p;either (do @
[## Must update the cursor as I
## go along, to keep things accurate.
[where' elem] (ast where)]
- (recur (V;add elem elems)
+ (recur (sequence;add elem elems)
where'))
(do @
[## Must take into account any
@@ -445,7 +444,7 @@
where' (left-padding^ where)
_ (l;this <close>)]
(wrap [(update@ #;column n.inc where')
- (V;to-list elems)]))))]
+ (sequence;to-list elems)]))))]
(wrap [where'
[where (<tag> elems)]])))]
@@ -468,19 +467,19 @@
(l;Lexer [Cursor Code]))
(do p;Monad<Parser>
[_ (l;this "{")
- [where' elems] (loop [elems (: (V;Vector [Code Code])
- V;empty)
+ [where' elems] (loop [elems (: (Sequence [Code Code])
+ sequence;empty)
where where]
(p;either (do @
[[where' key] (ast where)
[where' val] (ast where')]
- (recur (V;add [key val] elems)
+ (recur (sequence;add [key val] elems)
where'))
(do @
[where' (left-padding^ where)
_ (l;this "}")]
(wrap [(update@ #;column n.inc where')
- (V;to-list elems)]))))]
+ (sequence;to-list elems)]))))]
(wrap [where'
[where (#;Record elems)]])))
@@ -601,10 +600,10 @@
)))
(def: #export (parse [where code])
- (-> [Cursor Text] (R;Result [[Cursor Text] Code]))
+ (-> [Cursor Text] (e;Error [[Cursor Text] Code]))
(case (p;run [+0 code] (ast where))
- (#R;Error error)
- (#R;Error error)
+ (#e;Error error)
+ (#e;Error error)
- (#R;Success [[_ remaining] [where' output]])
- (#R;Success [[where' remaining] output])))
+ (#e;Success [[_ remaining] [where' output]])
+ (#e;Success [[where' remaining] output])))