From 901b09dada43ec6f3b21618800ec7400fda54a0d Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Wed, 18 Oct 2017 12:42:46 -0400 Subject: - Updated to the latest changes in stdlib. --- new-luxc/source/luxc/parser.lux | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) (limited to 'new-luxc/source/luxc/parser.lux') 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]) (data [bool] [text] - ["R" result] + ["e" error] [number] [product] [maybe] (text ["l" lexer] format) - (coll [list "L/" Functor Fold] - ["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 decode chunk) (#;Left error) (p;fail error) @@ -429,14 +428,14 @@ (l;Lexer [Cursor Code])) (do p;Monad [_ (l;this ) - [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 )] (wrap [(update@ #;column n.inc where') - (V;to-list elems)]))))] + (sequence;to-list elems)]))))] (wrap [where' [where ( elems)]])))] @@ -468,19 +467,19 @@ (l;Lexer [Cursor Code])) (do p;Monad [_ (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]))) -- cgit v1.2.3