diff options
Diffstat (limited to '')
-rw-r--r-- | new-luxc/test/test/luxc/parser.lux | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/new-luxc/test/test/luxc/parser.lux b/new-luxc/test/test/luxc/parser.lux index 9f8584b2c..5218bb926 100644 --- a/new-luxc/test/test/luxc/parser.lux +++ b/new-luxc/test/test/luxc/parser.lux @@ -10,7 +10,7 @@ ["E" error] (coll [list])) ["R" math/random "R/" Monad<Random>] - (macro [ast]) + (macro [code]) test) (luxc ["&" parser])) @@ -39,15 +39,15 @@ (R;seq ident-part^ ident-part^)) (def: ast^ - (R;Random AST) - (let [numeric^ (: (R;Random AST) + (R;Random Code) + (let [numeric^ (: (R;Random Code) ($_ R;either (|> R;bool (R/map (|>. #;Bool [default-cursor]))) (|> R;nat (R/map (|>. #;Nat [default-cursor]))) (|> R;int (R/map (|>. #;Int [default-cursor]))) (|> R;deg (R/map (|>. #;Deg [default-cursor]))) (|> R;real (R/map (|>. #;Real [default-cursor]))))) - textual^ (: (R;Random AST) + textual^ (: (R;Random Code) ($_ R;either (|> R;char (R/map (|>. #;Char [default-cursor]))) (do R;Monad<Random> @@ -55,7 +55,7 @@ (|> (R;text size) (R/map (|>. #;Text [default-cursor])))) (|> ident^ (R/map (|>. #;Symbol [default-cursor]))) (|> ident^ (R/map (|>. #;Tag [default-cursor]))))) - simple^ (: (R;Random AST) + simple^ (: (R;Random Code) ($_ R;either numeric^ textual^))] @@ -64,7 +64,7 @@ (let [multi^ (do R;Monad<Random> [size (|> R;nat (R/map (n.% +3)))] (R;list size ast^)) - composite^ (: (R;Random AST) + composite^ (: (R;Random Code) ($_ R;either (|> multi^ (R/map (|>. #;Form [default-cursor]))) (|> multi^ (R/map (|>. #;Tuple [default-cursor]))) @@ -78,12 +78,12 @@ (test: "Lux code parser." [sample ast^] (assert "Can parse Lux code." - (case (&;parse [default-cursor (ast;to-text sample)]) + (case (&;parse [default-cursor (code;to-text sample)]) (#E;Error error) false (#E;Success [_ parsed]) - (:: ast;Eq<AST> = parsed sample)) + (:: code;Eq<Code> = parsed sample)) )) (def: comment-text^ @@ -148,21 +148,21 @@ false (#E;Success [_ parsed]) - (:: ast;Eq<AST> = + (:: code;Eq<Code> = parsed - (ast;text good-output))))) + (code;text good-output))))) (assert "Can handle comments." (case (&;parse [default-cursor - (format comment (ast;to-text sample))]) + (format comment (code;to-text sample))]) (#E;Error error) false (#E;Success [_ parsed]) - (:: ast;Eq<AST> = parsed sample))) + (:: code;Eq<Code> = parsed sample))) (assert "Will reject unbalanced multi-line comments." (and (case (&;parse [default-cursor (format "#(" "#(" unbalanced-comment ")#" - (ast;to-text sample))]) + (code;to-text sample))]) (#E;Error error) true @@ -170,7 +170,7 @@ false) (case (&;parse [default-cursor (format "#(" unbalanced-comment ")#" ")#" - (ast;to-text sample))]) + (code;to-text sample))]) (#E;Error error) true |