diff options
Diffstat (limited to '')
-rw-r--r-- | luxc/src/lux/analyser.clj | 46 | ||||
-rw-r--r-- | luxc/src/lux/analyser/case.clj | 36 | ||||
-rw-r--r-- | luxc/src/lux/analyser/proc/js.clj | 2 | ||||
-rw-r--r-- | luxc/src/lux/analyser/proc/jvm.clj | 6 | ||||
-rw-r--r-- | luxc/src/lux/analyser/record.clj | 4 | ||||
-rw-r--r-- | luxc/src/lux/base.clj | 48 | ||||
-rw-r--r-- | luxc/src/lux/parser.clj | 24 | ||||
-rw-r--r-- | luxc/test/test/lux/parser.clj | 64 |
8 files changed, 115 insertions, 115 deletions
diff --git a/luxc/src/lux/analyser.clj b/luxc/src/lux/analyser.clj index c47eaddfa..18bfdcd3e 100644 --- a/luxc/src/lux/analyser.clj +++ b/luxc/src/lux/analyser.clj @@ -24,7 +24,7 @@ :let [is-last? (= idx (dec (&/|length group)))]] (if (= 1 (&/|length group)) (|do [_cursor &/cursor] - (analyse exo-type (&/T [_cursor (&/$TupleS values)]))) + (analyse exo-type (&/T [_cursor (&/$Tuple values)]))) (|case exo-type (&/$VarT id) (|do [? (&type/bound? id)] @@ -66,53 +66,53 @@ macro-caller (aget compilers 2)] (|case token ;; Standard special forms - (&/$BoolS ?value) + (&/$Bool ?value) (|do [_ (&type/check exo-type &type/Bool)] (return (&/|list (&&/|meta exo-type cursor (&&/$bool ?value))))) - (&/$NatS ?value) + (&/$Nat ?value) (|do [_ (&type/check exo-type &type/Nat)] (return (&/|list (&&/|meta exo-type cursor (&&/$nat ?value))))) - (&/$IntS ?value) + (&/$Int ?value) (|do [_ (&type/check exo-type &type/Int)] (return (&/|list (&&/|meta exo-type cursor (&&/$int ?value))))) - (&/$DegS ?value) + (&/$Deg ?value) (|do [_ (&type/check exo-type &type/Deg)] (return (&/|list (&&/|meta exo-type cursor (&&/$deg ?value))))) - (&/$RealS ?value) + (&/$Real ?value) (|do [_ (&type/check exo-type &type/Real)] (return (&/|list (&&/|meta exo-type cursor (&&/$real ?value))))) - (&/$CharS ?value) + (&/$Char ?value) (|do [_ (&type/check exo-type &type/Char)] (return (&/|list (&&/|meta exo-type cursor (&&/$char ?value))))) - (&/$TextS ?value) + (&/$Text ?value) (|do [_ (&type/check exo-type &type/Text)] (return (&/|list (&&/|meta exo-type cursor (&&/$text ?value))))) - (&/$TupleS ?elems) + (&/$Tuple ?elems) (&/with-analysis-meta cursor exo-type (&&lux/analyse-tuple analyse (&/$Right exo-type) ?elems)) - (&/$RecordS ?elems) + (&/$Record ?elems) (&/with-analysis-meta cursor exo-type (&&lux/analyse-record analyse exo-type ?elems)) - (&/$TagS ?ident) + (&/$Tag ?ident) (&/with-analysis-meta cursor exo-type (analyse-variant+ analyse exo-type ?ident &/$Nil)) - (&/$SymbolS ?ident) + (&/$Symbol ?ident) (&/with-analysis-meta cursor exo-type (&&lux/analyse-symbol analyse exo-type ?ident)) - (&/$FormS (&/$Cons [command-meta command] parameters)) + (&/$Form (&/$Cons [command-meta command] parameters)) (|case command - (&/$SymbolS _ command-name) + (&/$Symbol _ command-name) (case command-name "_lux_case" (|let [(&/$Cons ?value ?branches) parameters] @@ -120,18 +120,18 @@ (&&lux/analyse-case analyse exo-type ?value ?branches))) "_lux_function" - (|let [(&/$Cons [_ (&/$SymbolS "" ?self)] - (&/$Cons [_ (&/$SymbolS "" ?arg)] + (|let [(&/$Cons [_ (&/$Symbol "" ?self)] + (&/$Cons [_ (&/$Symbol "" ?arg)] (&/$Cons ?body (&/$Nil)))) parameters] (&/with-analysis-meta cursor exo-type (&&lux/analyse-function analyse exo-type ?self ?arg ?body))) "_lux_proc" - (|let [(&/$Cons [_ (&/$TupleS (&/$Cons [_ (&/$TextS ?category)] - (&/$Cons [_ (&/$TextS ?proc)] + (|let [(&/$Cons [_ (&/$Tuple (&/$Cons [_ (&/$Text ?category)] + (&/$Cons [_ (&/$Text ?proc)] (&/$Nil))))] - (&/$Cons [_ (&/$TupleS ?args)] + (&/$Cons [_ (&/$Tuple ?args)] (&/$Nil))) parameters] (&/with-analysis-meta cursor exo-type (case ?category @@ -158,7 +158,7 @@ (&&lux/analyse-coerce analyse eval! exo-type ?type ?value))) "_lux_def" - (|let [(&/$Cons [_ (&/$SymbolS "" ?name)] + (|let [(&/$Cons [_ (&/$Symbol "" ?name)] (&/$Cons ?value (&/$Cons ?meta (&/$Nil)) @@ -172,7 +172,7 @@ (&&lux/analyse-module analyse optimize eval! compile-module ?meta))) "_lux_program" - (|let [(&/$Cons [_ (&/$SymbolS "" ?args)] + (|let [(&/$Cons [_ (&/$Symbol "" ?args)] (&/$Cons ?body (&/$Nil))) parameters] (&/with-cursor cursor @@ -183,11 +183,11 @@ (|do [=fn (just-analyse analyse (&/T [command-meta command]))] (&&lux/analyse-apply analyse cursor exo-type macro-caller =fn parameters)))) - (&/$NatS idx) + (&/$Nat idx) (&/with-analysis-meta cursor exo-type (&&lux/analyse-variant analyse (&/$Right exo-type) idx nil parameters)) - (&/$TagS ?ident) + (&/$Tag ?ident) (&/with-analysis-meta cursor exo-type (analyse-variant+ analyse exo-type ?ident parameters)) diff --git a/luxc/src/lux/analyser/case.clj b/luxc/src/lux/analyser/case.clj index 2f3a4d575..1e3214dad 100644 --- a/luxc/src/lux/analyser/case.clj +++ b/luxc/src/lux/analyser/case.clj @@ -37,7 +37,7 @@ ;; [Utils] (def ^:private unit-tuple - (&/T [(&/T ["" -1 -1]) (&/$TupleS &/$Nil)])) + (&/T [(&/T ["" -1 -1]) (&/$Tuple &/$Nil)])) (defn ^:private resolve-type [type] (|case type @@ -255,7 +255,7 @@ (defn ^:private analyse-pattern [var?? value-type pattern kont] (|let [[meta pattern*] pattern] (|case pattern* - (&/$SymbolS "" name) + (&/$Symbol "" name) (|case var?? (&/$Some var-analysis) (|do [=kont (&env/with-alias name var-analysis @@ -268,45 +268,45 @@ idx &env/next-local-idx] (return (&/T [($StoreTestAC idx) =kont])))) - (&/$SymbolS ident) + (&/$Symbol ident) (&/fail-with-loc (str "[Pattern-matching Error] Symbols must be unqualified: " (&/ident->text ident))) - (&/$BoolS ?value) + (&/$Bool ?value) (|do [_ (&type/check value-type &type/Bool) =kont kont] (return (&/T [($BoolTestAC ?value) =kont]))) - (&/$NatS ?value) + (&/$Nat ?value) (|do [_ (&type/check value-type &type/Nat) =kont kont] (return (&/T [($NatTestAC ?value) =kont]))) - (&/$IntS ?value) + (&/$Int ?value) (|do [_ (&type/check value-type &type/Int) =kont kont] (return (&/T [($IntTestAC ?value) =kont]))) - (&/$DegS ?value) + (&/$Deg ?value) (|do [_ (&type/check value-type &type/Deg) =kont kont] (return (&/T [($DegTestAC ?value) =kont]))) - (&/$RealS ?value) + (&/$Real ?value) (|do [_ (&type/check value-type &type/Real) =kont kont] (return (&/T [($RealTestAC ?value) =kont]))) - (&/$CharS ?value) + (&/$Char ?value) (|do [_ (&type/check value-type &type/Char) =kont kont] (return (&/T [($CharTestAC ?value) =kont]))) - (&/$TextS ?value) + (&/$Text ?value) (|do [_ (&type/check value-type &type/Text) =kont kont] (return (&/T [($TextTestAC ?value) =kont]))) - (&/$TupleS ?members) + (&/$Tuple ?members) (|case ?members (&/$Nil) (|do [_ (&type/check value-type &/$UnitT) @@ -343,16 +343,16 @@ _ (&/fail-with-loc (str "[Pattern-matching Error] Tuples require tuple-types: " (&type/show-type value-type)))))) - (&/$RecordS pairs) + (&/$Record pairs) (|do [[rec-members rec-type] (&&record/order-record pairs) must-infer? (&type/unknown? value-type) rec-type* (if must-infer? (&type/instantiate-inference rec-type) (return value-type)) _ (&type/check value-type rec-type*)] - (analyse-pattern &/$None rec-type* (&/T [meta (&/$TupleS rec-members)]) kont)) + (analyse-pattern &/$None rec-type* (&/T [meta (&/$Tuple rec-members)]) kont)) - (&/$TagS ?ident) + (&/$Tag ?ident) (|do [[=module =name] (&&/resolved-ident ?ident) must-infer? (&type/unknown? value-type) variant-type (if must-infer? @@ -368,17 +368,17 @@ [=test =kont] (analyse-pattern &/$None case-type unit-tuple kont)] (return (&/T [($VariantTestAC (&/T [idx (&/|length group) =test])) =kont]))) - (&/$FormS (&/$Cons [_ (&/$NatS idx)] ?values)) + (&/$Form (&/$Cons [_ (&/$Nat idx)] ?values)) (|do [value-type* (adjust-type value-type) case-type (&type/sum-at idx value-type*) [=test =kont] (case (int (&/|length ?values)) 0 (analyse-pattern &/$None case-type unit-tuple kont) 1 (analyse-pattern &/$None case-type (&/|head ?values) kont) ;; 1+ - (analyse-pattern &/$None case-type (&/T [(&/T ["" -1 -1]) (&/$TupleS ?values)]) kont))] + (analyse-pattern &/$None case-type (&/T [(&/T ["" -1 -1]) (&/$Tuple ?values)]) kont))] (return (&/T [($VariantTestAC (&/T [idx (&/|length (&type/flatten-sum value-type*)) =test])) =kont]))) - (&/$FormS (&/$Cons [_ (&/$TagS ?ident)] ?values)) + (&/$Form (&/$Cons [_ (&/$Tag ?ident)] ?values)) (|do [[=module =name] (&&/resolved-ident ?ident) must-infer? (&type/unknown? value-type) variant-type (if must-infer? @@ -395,7 +395,7 @@ 0 (analyse-pattern &/$None case-type unit-tuple kont) 1 (analyse-pattern &/$None case-type (&/|head ?values) kont) ;; 1+ - (analyse-pattern &/$None case-type (&/T [(&/T ["" -1 -1]) (&/$TupleS ?values)]) kont))] + (analyse-pattern &/$None case-type (&/T [(&/T ["" -1 -1]) (&/$Tuple ?values)]) kont))] (return (&/T [($VariantTestAC (&/T [idx (&/|length group) =test])) =kont]))) _ diff --git a/luxc/src/lux/analyser/proc/js.clj b/luxc/src/lux/analyser/proc/js.clj index ff6a21c11..986720108 100644 --- a/luxc/src/lux/analyser/proc/js.clj +++ b/luxc/src/lux/analyser/proc/js.clj @@ -32,7 +32,7 @@ (&&/$proc (&/T ["js" "object-call"]) (&/$Cons =object (&/$Cons =field =args)) (&/|list))))))) (defn ^:private analyse-js-ref [analyse exo-type ?values] - (|do [:let [(&/$Cons [_ (&/$TextS ?ref-name)] (&/$Nil)) ?values] + (|do [:let [(&/$Cons [_ (&/$Text ?ref-name)] (&/$Nil)) ?values] _ (&type/check exo-type (&/$HostT "object" &/$Nil)) _cursor &/cursor] (return (&/|list (&&/|meta exo-type _cursor diff --git a/luxc/src/lux/analyser/proc/jvm.clj b/luxc/src/lux/analyser/proc/jvm.clj index 3fc3e2e8c..ba9be52b1 100644 --- a/luxc/src/lux/analyser/proc/jvm.clj +++ b/luxc/src/lux/analyser/proc/jvm.clj @@ -553,7 +553,7 @@ (let [length-type &type/Nat idx-type &type/Nat] (defn ^:private analyse-jvm-anewarray [analyse exo-type ?values] - (|do [:let [(&/$Cons [_ (&/$TextS _gclass)] (&/$Cons length (&/$Nil))) ?values] + (|do [:let [(&/$Cons [_ (&/$Text _gclass)] (&/$Cons length (&/$Nil))) ?values] gclass (&reader/with-source "jvm-anewarray" _gclass &&a-parser/parse-gclass) gtype-env &/get-type-env @@ -805,7 +805,7 @@ (&&/$proc (&/T ["jvm" "instanceof"]) (&/|list =object) (&/|list class))))))) (defn ^:private analyse-jvm-load-class [analyse exo-type ?values] - (|do [:let [(&/$Cons [_ (&/$TextS _class-name)] (&/$Nil)) ?values] + (|do [:let [(&/$Cons [_ (&/$Text _class-name)] (&/$Nil)) ?values] ^ClassLoader class-loader &/loader _ (try (do (.loadClass class-loader _class-name) (return nil)) @@ -856,7 +856,7 @@ &/$Nil &/$Nil &/$Nil - (&/$TupleS &/$Nil)])) + (&/$Tuple &/$Nil)])) captured-slot-class "java.lang.Object" captured-slot-type (&/$GenericClass captured-slot-class &/$Nil)] (defn ^:private analyse-jvm-anon-class [analyse compile-class exo-type super-class interfaces ctor-args methods] diff --git a/luxc/src/lux/analyser/record.clj b/luxc/src/lux/analyser/record.clj index 9268f4c22..90be7d330 100644 --- a/luxc/src/lux/analyser/record.clj +++ b/luxc/src/lux/analyser/record.clj @@ -13,7 +13,7 @@ (&/$Nil) (return (&/T [&/$Nil &/$UnitT])) - (&/$Cons [[_ (&/$TagS tag1)] _] _) + (&/$Cons [[_ (&/$Tag tag1)] _] _) (|do [[module name] (&&/resolved-ident tag1) tags (&&module/tag-group module name) type (&&module/tag-type module name)] @@ -23,7 +23,7 @@ (&/fail-with-loc "[Analyser Error] Wrong syntax for records. Odd elements must be tags.")) =pairs (&/map% (fn [kv] (|case kv - [[_ (&/$TagS k)] v] + [[_ (&/$Tag k)] v] (|do [=k (&&/resolved-ident k)] (return (&/T [(&/ident->text =k) v]))) diff --git a/luxc/src/lux/base.clj b/luxc/src/lux/base.clj index 536009a39..7e36ca903 100644 --- a/luxc/src/lux/base.clj +++ b/luxc/src/lux/base.clj @@ -71,18 +71,18 @@ ;; AST (defvariant - ("BoolS" 1) - ("NatS" 1) - ("IntS" 1) - ("DegS" 1) - ("RealS" 1) - ("CharS" 1) - ("TextS" 1) - ("SymbolS" 1) - ("TagS" 1) - ("FormS" 1) - ("TupleS" 1) - ("RecordS" 1)) + ("Bool" 1) + ("Nat" 1) + ("Int" 1) + ("Deg" 1) + ("Real" 1) + ("Char" 1) + ("Text" 1) + ("Symbol" 1) + ("Tag" 1) + ("Form" 1) + ("Tuple" 1) + ("Record" 1)) ;; Type (defvariant @@ -1205,48 +1205,48 @@ (defn show-ast [ast] (|case ast - [_ ($BoolS ?value)] + [_ ($Bool ?value)] (pr-str ?value) - [_ ($NatS ?value)] + [_ ($Nat ?value)] (str "+" (Long/toUnsignedString ?value)) - [_ ($IntS ?value)] + [_ ($Int ?value)] (pr-str ?value) - [_ ($DegS ?value)] + [_ ($Deg ?value)] (encode-deg ?value) - [_ ($RealS ?value)] + [_ ($Real ?value)] (pr-str ?value) - [_ ($CharS ?value)] + [_ ($Char ?value)] (str "#\"" (pr-str ?value) "\"") - [_ ($TextS ?value)] + [_ ($Text ?value)] (str "\"" ?value "\"") - [_ ($TagS ?module ?tag)] + [_ ($Tag ?module ?tag)] (if (.equals "" ?module) (str "#" ?tag) (str "#" ?module ";" ?tag)) - [_ ($SymbolS ?module ?name)] + [_ ($Symbol ?module ?name)] (if (.equals "" ?module) ?name (str ?module ";" ?name)) - [_ ($TupleS ?elems)] + [_ ($Tuple ?elems)] (str "[" (->> ?elems (|map show-ast) (|interpose " ") (fold str "")) "]") - [_ ($RecordS ?elems)] + [_ ($Record ?elems)] (str "{" (->> ?elems (|map (fn [elem] (|let [[k v] elem] (str (show-ast k) " " (show-ast v))))) (|interpose " ") (fold str "")) "}") - [_ ($FormS ?elems)] + [_ ($Form ?elems)] (str "(" (->> ?elems (|map show-ast) (|interpose " ") (fold str "")) ")") _ diff --git a/luxc/src/lux/parser.clj b/luxc/src/lux/parser.clj index 3f0a95653..c502efff2 100644 --- a/luxc/src/lux/parser.clj +++ b/luxc/src/lux/parser.clj @@ -35,8 +35,8 @@ (&/fail-with-loc (str "[Parser Error] Unbalanced " <description> ".")) ))) - ^:private parse-form &lexer/$Close_Paren "parantheses" &/$FormS - ^:private parse-tuple &lexer/$Close_Bracket "brackets" &/$TupleS + ^:private parse-form &lexer/$Close_Paren "parantheses" &/$Form + ^:private parse-tuple &lexer/$Close_Bracket "brackets" &/$Tuple ) (defn ^:private parse-record [parse] @@ -47,7 +47,7 @@ [meta (&lexer/$Close_Brace _)] (|do [_ (&/assert! (even? (&/|length elems)) (&/fail-with-loc base-uneven-record-error))] - (return (&/$RecordS (&/|as-pairs elems)))) + (return (&/$Record (&/|as-pairs elems)))) _ (&/fail-with-loc "[Parser Error] Unbalanced braces.") @@ -65,31 +65,31 @@ (return &/$Nil) (&lexer/$Bool ?value) - (return (&/|list (&/T [meta (&/$BoolS (Boolean/parseBoolean ?value))]))) + (return (&/|list (&/T [meta (&/$Bool (Boolean/parseBoolean ?value))]))) (&lexer/$Nat ?value) - (return (&/|list (&/T [meta (&/$NatS (Long/parseUnsignedLong ?value))]))) + (return (&/|list (&/T [meta (&/$Nat (Long/parseUnsignedLong ?value))]))) (&lexer/$Int ?value) - (return (&/|list (&/T [meta (&/$IntS (Long/parseLong ?value))]))) + (return (&/|list (&/T [meta (&/$Int (Long/parseLong ?value))]))) (&lexer/$Deg ?value) - (return (&/|list (&/T [meta (&/$DegS (&/decode-deg ?value))]))) + (return (&/|list (&/T [meta (&/$Deg (&/decode-deg ?value))]))) (&lexer/$Real ?value) - (return (&/|list (&/T [meta (&/$RealS (Double/parseDouble ?value))]))) + (return (&/|list (&/T [meta (&/$Real (Double/parseDouble ?value))]))) (&lexer/$Char ^String ?value) - (return (&/|list (&/T [meta (&/$CharS (.charAt ?value 0))]))) + (return (&/|list (&/T [meta (&/$Char (.charAt ?value 0))]))) (&lexer/$Text ?value) - (return (&/|list (&/T [meta (&/$TextS ?value)]))) + (return (&/|list (&/T [meta (&/$Text ?value)]))) (&lexer/$Symbol ?ident) - (return (&/|list (&/T [meta (&/$SymbolS ?ident)]))) + (return (&/|list (&/T [meta (&/$Symbol ?ident)]))) (&lexer/$Tag ?ident) - (return (&/|list (&/T [meta (&/$TagS ?ident)]))) + (return (&/|list (&/T [meta (&/$Tag ?ident)]))) (&lexer/$Open_Paren _) (|do [syntax (parse-form parse)] diff --git a/luxc/test/test/lux/parser.clj b/luxc/test/test/lux/parser.clj index 327b61bb3..2cf76def7 100644 --- a/luxc/test/test/lux/parser.clj +++ b/luxc/test/test/lux/parser.clj @@ -44,7 +44,7 @@ output2 &parser/parse] (return (&/|++ output1 output2))) (make-state (str input1 "\n" input2))) - (&/$Right state (&/$Cons [_ (&/$BoolS output1)] (&/$Cons [_ (&/$BoolS output2)] (&/$Nil)))) + (&/$Right state (&/$Cons [_ (&/$Bool output1)] (&/$Cons [_ (&/$Bool output2)] (&/$Nil)))) (are [input output] (= input output) true output1 false output2) @@ -62,7 +62,7 @@ output3 &parser/parse] (return (&/|++ output1 (&/|++ output2 output3)))) (make-state (str input1 "\n" input2 "\n" input3))) - (&/$Right state (&/$Cons [_ (&/$IntS output1)] (&/$Cons [_ (&/$IntS output2)] (&/$Cons [_ (&/$IntS output3)] (&/$Nil))))) + (&/$Right state (&/$Cons [_ (&/$Int output1)] (&/$Cons [_ (&/$Int output2)] (&/$Cons [_ (&/$Int output3)] (&/$Nil))))) (are [input output] (= input output) 0 output1 12 output2 @@ -81,7 +81,7 @@ output3 &parser/parse] (return (&/|++ output1 (&/|++ output2 output3)))) (make-state (str input1 "\n" input2 "\n" input3))) - (&/$Right state (&/$Cons [_ (&/$RealS output1)] (&/$Cons [_ (&/$RealS output2)] (&/$Cons [_ (&/$RealS output3)] (&/$Nil))))) + (&/$Right state (&/$Cons [_ (&/$Real output1)] (&/$Cons [_ (&/$Real output2)] (&/$Cons [_ (&/$Real output3)] (&/$Nil))))) (are [input output] (= input output) 0.00123 output1 12.010203 output2 @@ -114,15 +114,15 @@ (make-state (str "#\"" input1 "\"" "\n" "#\"" input2 "\"" "\n" "#\"" input3 "\"" "\n" "#\"" input4 "\"" "\n" "#\"" input5 "\"" "\n" "#\"" input6 "\"" "\n" "#\"" input7 "\"" "\n" "#\"" input8 "\"" "\n" "#\"" input9 "\""))) - (&/$Right state (&/$Cons [_ (&/$CharS output1)] - (&/$Cons [_ (&/$CharS output2)] - (&/$Cons [_ (&/$CharS output3)] - (&/$Cons [_ (&/$CharS output4)] - (&/$Cons [_ (&/$CharS output5)] - (&/$Cons [_ (&/$CharS output6)] - (&/$Cons [_ (&/$CharS output7)] - (&/$Cons [_ (&/$CharS output8)] - (&/$Cons [_ (&/$CharS output9)] + (&/$Right state (&/$Cons [_ (&/$Char output1)] + (&/$Cons [_ (&/$Char output2)] + (&/$Cons [_ (&/$Char output3)] + (&/$Cons [_ (&/$Char output4)] + (&/$Cons [_ (&/$Char output5)] + (&/$Cons [_ (&/$Char output6)] + (&/$Cons [_ (&/$Char output7)] + (&/$Cons [_ (&/$Char output8)] + (&/$Cons [_ (&/$Char output9)] (&/$Nil))))))))))) (are [input output] (= input output) \a output1 @@ -150,7 +150,7 @@ output4 &parser/parse] (return (&/|++ output1 (&/|++ output2 (&/|++ output3 output4))))) (make-state (str "\"" input1 "\"" "\n" "\"" input2 "\"" "\n" "\"" input3 "\"" "\n" "\"" input4 "\""))) - (&/$Right state (&/$Cons [_ (&/$TextS output1)] (&/$Cons [_ (&/$TextS output2)] (&/$Cons [_ (&/$TextS output3)] (&/$Cons [_ (&/$TextS output4)] (&/$Nil)))))) + (&/$Right state (&/$Cons [_ (&/$Text output1)] (&/$Cons [_ (&/$Text output2)] (&/$Cons [_ (&/$Text output3)] (&/$Cons [_ (&/$Text output4)] (&/$Nil)))))) (are [input output] (= input output) input1 output1 input2 output2 @@ -175,11 +175,11 @@ output5 &parser/parse] (return (&/|++ output1 (&/|++ output2 (&/|++ output3 (&/|++ output4 output5)))))) (make-state (str input1 "\n" input2 "\n" input3 "\n" input4 "\n" input5 " "))) - (&/$Right state (&/$Cons [_ (&/$SymbolS output1)] - (&/$Cons [_ (&/$SymbolS output2)] - (&/$Cons [_ (&/$SymbolS output3)] - (&/$Cons [_ (&/$SymbolS output4)] - (&/$Cons [_ (&/$SymbolS output5)] + (&/$Right state (&/$Cons [_ (&/$Symbol output1)] + (&/$Cons [_ (&/$Symbol output2)] + (&/$Cons [_ (&/$Symbol output3)] + (&/$Cons [_ (&/$Symbol output4)] + (&/$Cons [_ (&/$Symbol output5)] (&/$Nil))))))) (are [input output] (&/ident= input output) (&/T ["" "foo"]) output1 @@ -206,11 +206,11 @@ output5 &parser/parse] (return (&/|++ output1 (&/|++ output2 (&/|++ output3 (&/|++ output4 output5)))))) (make-state (str "#" input1 "\n" "#" input2 "\n" "#" input3 "\n" "#" input4 "\n" "#" input5 " "))) - (&/$Right state (&/$Cons [_ (&/$TagS output1)] - (&/$Cons [_ (&/$TagS output2)] - (&/$Cons [_ (&/$TagS output3)] - (&/$Cons [_ (&/$TagS output4)] - (&/$Cons [_ (&/$TagS output5)] + (&/$Right state (&/$Cons [_ (&/$Tag output1)] + (&/$Cons [_ (&/$Tag output2)] + (&/$Cons [_ (&/$Tag output3)] + (&/$Cons [_ (&/$Tag output4)] + (&/$Cons [_ (&/$Tag output5)] (&/$Nil))))))) (are [input output] (&/ident= input output) (&/T ["" "foo"]) output1 @@ -228,10 +228,10 @@ (let [input1 "yolo 123 \"lol\" #meme"] (|case (&/run-state &parser/parse (make-state (str <open> input1 <close>))) - (&/$Right state (&/$Cons [_ (<tag> (&/$Cons [_ (&/$SymbolS symv)] - (&/$Cons [_ (&/$IntS intv)] - (&/$Cons [_ (&/$TextS textv)] - (&/$Cons [_ (&/$TagS tagv)] + (&/$Right state (&/$Cons [_ (<tag> (&/$Cons [_ (&/$Symbol symv)] + (&/$Cons [_ (&/$Int intv)] + (&/$Cons [_ (&/$Text textv)] + (&/$Cons [_ (&/$Tag tagv)] (&/$Nil))))))] (&/$Nil))) (do (is (&/ident= (&/T ["" "yolo"]) symv)) @@ -243,17 +243,17 @@ (is false "Couldn't read.") ))) - parse-form &/$FormS "(" ")" - parse-tuple &/$TupleS "[" "]" + parse-form &/$Form "(" ")" + parse-tuple &/$Tuple "[" "]" ) (deftest parse-record (let [input1 "yolo 123 \"lol\" #meme"] (|case (&/run-state &parser/parse (make-state (str "{" input1 "}"))) - (&/$Right state (&/$Cons [_ (&/$RecordS (&/$Cons [[_ (&/$SymbolS symv)] [_ (&/$IntS intv)]] - (&/$Cons [[_ (&/$TextS textv)] [_ (&/$TagS tagv)]] - (&/$Nil))))] + (&/$Right state (&/$Cons [_ (&/$Record (&/$Cons [[_ (&/$Symbol symv)] [_ (&/$Int intv)]] + (&/$Cons [[_ (&/$Text textv)] [_ (&/$Tag tagv)]] + (&/$Nil))))] (&/$Nil))) (do (is (&/ident= (&/T ["" "yolo"]) symv)) (is (= 123 intv)) |