diff options
author | Eduardo Julian | 2017-11-29 04:51:04 -0400 |
---|---|---|
committer | Eduardo Julian | 2017-11-29 04:51:04 -0400 |
commit | 8c5cca122817bc63f4f84cc8351ced3cb67e5eea (patch) | |
tree | 8803dd3ed59ddcc6b964354fd312ab9e62e12cd8 /luxc | |
parent | 1ef969c8ce0f1a83ffa8d26d779806190ac3eced (diff) |
- Changed the identifier separator, from the semi-colon (;) to the period/dot (.).
Diffstat (limited to 'luxc')
-rw-r--r-- | luxc/src/lux/analyser/module.clj | 11 | ||||
-rw-r--r-- | luxc/src/lux/base.clj | 8 | ||||
-rw-r--r-- | luxc/src/lux/compiler/cache.clj | 2 | ||||
-rw-r--r-- | luxc/src/lux/compiler/cache/ann.clj | 5 | ||||
-rw-r--r-- | luxc/src/lux/compiler/cache/type.clj | 5 | ||||
-rw-r--r-- | luxc/src/lux/compiler/js/lux.clj | 4 | ||||
-rw-r--r-- | luxc/src/lux/compiler/jvm/lux.clj | 6 | ||||
-rw-r--r-- | luxc/src/lux/lexer.clj | 10 |
8 files changed, 26 insertions, 25 deletions
diff --git a/luxc/src/lux/analyser/module.clj b/luxc/src/lux/analyser/module.clj index c8a263030..090165af9 100644 --- a/luxc/src/lux/analyser/module.clj +++ b/luxc/src/lux/analyser/module.clj @@ -122,7 +122,7 @@ nil) _ - ((&/fail-with-loc (str "[Analyser Error] Cannot create a new global definition outside of a global environment: " module ";" name)) + ((&/fail-with-loc (str "[Analyser Error] Cannot create a new global definition outside of a global environment: " (str module &/+name-separator+ name))) state)))) (defn def-type @@ -133,7 +133,7 @@ (if-let [$def (->> $module (&/get$ $defs) (&/|get name))] (|let [[?type ?meta ?value] $def] (return* state ?type)) - ((&/fail-with-loc (str "[Analyser Error] Unknown definition: " (str module ";" name))) + ((&/fail-with-loc (str "[Analyser Error] Unknown definition: " (str module &/+name-separator+ name))) state)) ((&/fail-with-loc (str "[Analyser Error] Unknown module: " module)) state)))) @@ -156,7 +156,8 @@ ?value])) _ - ((&/fail-with-loc (str "[Analyser Error] Not a type: " (&/ident->text (&/T [module name])))) + ((&/fail-with-loc (str "[Analyser Error] Not a type: " (&/ident->text (&/T [module name])) + "\nMETA: " (&/show-ast ?meta))) state))) ((&/fail-with-loc (str "[Analyser Error] Unknown definition: " (&/ident->text (&/T [module name])))) state)) @@ -398,7 +399,7 @@ [_ ?def-meta _] _def-data] (|case (&meta/meta-get &meta/alias-tag ?def-meta) (&/$Some [_ (&/$Symbol [?r-module ?r-name])]) - (&/T [k (str ?r-module ";" ?r-name) _def-data]) + (&/T [k (str ?r-module &/+name-separator+ ?r-name) _def-data]) _ (&/T [k "" _def-data]) @@ -409,7 +410,7 @@ (|case (&meta/meta-get <tag> meta) (&/$Some [_ (&/$Bool true)]) (&/try-all% (&/|list (&type/check <type> type) - (&/fail-with-loc (str "[Analyser Error] Cannot tag as lux;" <desc> "? if it's not a " <desc> ": " (str module ";" name))))) + (&/fail-with-loc (str "[Analyser Error] Cannot tag as lux;" <desc> "? if it's not a " <desc> ": " (str module &/+name-separator+ name))))) _ (return nil))) diff --git a/luxc/src/lux/base.clj b/luxc/src/lux/base.clj index 910bdfadf..ae9b2bb47 100644 --- a/luxc/src/lux/base.clj +++ b/luxc/src/lux/base.clj @@ -219,7 +219,7 @@ ;; [Exports] (def ^:const value-field "_value") (def ^:const module-class-name "_") -(def ^:const +name-separator+ ";") +(def ^:const +name-separator+ ".") (def ^:const ^String version "0.6.0") @@ -1217,12 +1217,12 @@ [_ ($Tag ?module ?tag)] (if (.equals "" ?module) (str "#" ?tag) - (str "#" ?module ";" ?tag)) + (str "#" ?module +name-separator+ ?tag)) [_ ($Symbol ?module ?name)] (if (.equals "" ?module) ?name - (str ?module ";" ?name)) + (str ?module +name-separator+ ?name)) [_ ($Tuple ?elems)] (str "[" (->> ?elems (|map show-ast) (|interpose " ") (fold str "")) "]") @@ -1245,7 +1245,7 @@ (|let [[?module ?name] ident] (if (= "" ?module) ?name - (str ?module ";" ?name)))) + (str ?module +name-separator+ ?name)))) (defn fold2% [f init xs ys] (|case [xs ys] diff --git a/luxc/src/lux/compiler/cache.clj b/luxc/src/lux/compiler/cache.clj index 4c3b1a436..678fda334 100644 --- a/luxc/src/lux/compiler/cache.clj +++ b/luxc/src/lux/compiler/cache.clj @@ -96,7 +96,7 @@ (let [parts (.split _def-entry &&core/datum-separator)] (case (alength parts) 2 (let [[_name _alias] parts - [_ __module __name] (re-find #"^(.*);(.*)$" _alias) + [_ __module __name] (re-find #"^(.*)\.(.*)$" _alias) def-anns (make-record (&/|list (&/T [(make-tag &a-meta/alias-tag) (make-symbol (&/T [__module __name]))])))] (|do [def-type (&a-module/def-type __module __name) diff --git a/luxc/src/lux/compiler/cache/ann.clj b/luxc/src/lux/compiler/cache/ann.clj index 4be70a611..3111886ba 100644 --- a/luxc/src/lux/compiler/cache/ann.clj +++ b/luxc/src/lux/compiler/cache/ann.clj @@ -8,7 +8,6 @@ (def ^:private stop (->> 7 char str)) (def ^:private cons-signal (->> 5 char str)) (def ^:private nil-signal (->> 6 char str)) -(def ^:private ident-separator ";") (defn ^:private serialize-seq [serialize params] (str (&/fold (fn [so-far param] @@ -19,7 +18,7 @@ (defn ^:private serialize-ident [ident] (|let [[module name] ident] - (str module ident-separator name))) + (str module &/+name-separator+ name))) (defn serialize "(-> Code Text)" @@ -89,7 +88,7 @@ (defn <name> [^String input] (when (.startsWith input <marker>) (let [[^String ident* ^String input*] (.split (.substring input 1) stop 2) - [_module _name] (.split ident* ident-separator 2)] + [_module _name] (.split ident* "\\." 2)] [(&/T [dummy-cursor (<tag> (&/T [_module _name]))]) input*]))) ^:private deserialize-symbol "@" &/$Symbol diff --git a/luxc/src/lux/compiler/cache/type.clj b/luxc/src/lux/compiler/cache/type.clj index 88e1d5a03..76cdbec52 100644 --- a/luxc/src/lux/compiler/cache/type.clj +++ b/luxc/src/lux/compiler/cache/type.clj @@ -9,7 +9,6 @@ (def ^:private stop (->> 7 char str)) (def ^:private cons-signal (->> 5 char str)) (def ^:private nil-signal (->> 6 char str)) -(def ^:private ident-separator ";") (defn ^:private serialize-list [serialize-type params] (str (&/fold (fn [so-far param] @@ -61,7 +60,7 @@ (str "%" (serialize-type left) (serialize-type right)) (&/$Named [module name] type*) - (str "@" module ident-separator name stop (serialize-type type*)) + (str "@" module &/+name-separator+ name stop (serialize-type type*)) _ (assert false (prn 'serialize-type (&type/show-type type))) @@ -118,7 +117,7 @@ (defn ^:private deserialize-named [^String input] (when (.startsWith input "@") (let [[^String module+name ^String input*] (.split (.substring input 1) stop 2) - [module name] (.split module+name ident-separator 2)] + [module name] (.split module+name "\\." 2)] (when-let [[type* ^String input*] (deserialize-type input*)] [(&/$Named (&/T [module name]) type*) input*])))) diff --git a/luxc/src/lux/compiler/js/lux.clj b/luxc/src/lux/compiler/js/lux.clj index 6319f1b2b..ae3a6425c 100644 --- a/luxc/src/lux/compiler/js/lux.clj +++ b/luxc/src/lux/compiler/js/lux.clj @@ -324,7 +324,7 @@ _ (&/without-repl-closure (&a-module/define module-name ?name def-type def-meta def-value))] (return nil)) - (&/fail-with-loc (str "[Compilation Error] Aliases cannot contain meta-data: " module-name ";" ?name))) + (&/fail-with-loc (str "[Compilation Error] Aliases cannot contain meta-data: " (str module-name &/+name-separator+ ?name)))) (&/$Some _) (&/fail-with-loc "[Compilation Error] Invalid syntax for lux;alias meta-data. Must be an Ident.") @@ -371,7 +371,7 @@ [_ (&/$None)] (return nil)) - :let [_ (println 'DEF (str module-name ";" ?name))]] + :let [_ (println 'DEF (str module-name &/+name-separator+ ?name))]] (return nil)) )) ) diff --git a/luxc/src/lux/compiler/jvm/lux.clj b/luxc/src/lux/compiler/jvm/lux.clj index b76a889b0..024abeb73 100644 --- a/luxc/src/lux/compiler/jvm/lux.clj +++ b/luxc/src/lux/compiler/jvm/lux.clj @@ -266,7 +266,7 @@ _ (&/without-repl-closure (&a-module/define module-name ?name def-type def-meta def-value))] (return nil)) - (&/fail-with-loc (str "[Compilation Error] Aliases cannot contain meta-data: " module-name ";" ?name)))) + (&/fail-with-loc (str "[Compilation Error] Aliases cannot contain meta-data: " (str module-name &/+name-separator+ ?name))))) (&/$Some _) (&/fail-with-loc "[Compilation Error] Invalid syntax for lux;alias meta-data. Must be a symbol.") @@ -343,7 +343,7 @@ [_ (&/$None)] (return nil)) - :let [_ (println 'DEF (str module-name ";" ?name))]] + :let [_ (println 'DEF (str module-name &/+name-separator+ ?name))]] (return nil))) _ @@ -412,7 +412,7 @@ [_ (&/$None)] (return nil)) - :let [_ (println 'DEF (str module-name ";" ?name))]] + :let [_ (println 'DEF (str module-name &/+name-separator+ ?name))]] (return nil))) )))) diff --git a/luxc/src/lux/lexer.clj b/luxc/src/lux/lexer.clj index 65a99de6a..7bd329766 100644 --- a/luxc/src/lux/lexer.clj +++ b/luxc/src/lux/lexer.clj @@ -98,7 +98,7 @@ (return (&/T [meta ($Text token)])))) (def +ident-re+ - #"^([^0-9\[\]\{\}\(\)\s\"#;][^\[\]\{\}\(\)\s\"#;]*)") + #"^([^0-9\[\]\{\}\(\)\s\"#.][^\[\]\{\}\(\)\s\"#.]*)") ;; [Lexers] (def ^:private lex-white-space @@ -144,10 +144,12 @@ lex-frac $Frac #"^-?(0\.[0-9_]+|[1-9][0-9_]*\.[0-9_]+)(e-?[1-9][0-9_]*)?" ) +(def +same-module-mark+ (str &/+name-separator+ &/+name-separator+)) + (def ^:private lex-ident (&/try-all-% "[Reader Error]" (&/|list (|do [[meta _ token] (&reader/read-regex +ident-re+) - [_ _ got-it?] (&reader/read-text? ";")] + [_ _ got-it?] (&reader/read-text? &/+name-separator+)] (|case got-it? (&/$Some _) (|do [[_ _ local-token] (&reader/read-regex +ident-re+) @@ -159,11 +161,11 @@ (&/$None) (return (&/T [meta (&/T ["" token])])))) - (|do [[meta _ _] (&reader/read-text ";;") + (|do [[meta _ _] (&reader/read-text +same-module-mark+) [_ _ token] (&reader/read-regex +ident-re+) module-name &/get-module-name] (return (&/T [meta (&/T [module-name token])]))) - (|do [[meta _ _] (&reader/read-text ";") + (|do [[meta _ _] (&reader/read-text &/+name-separator+) [_ _ token] (&reader/read-regex +ident-re+)] (return (&/T [meta (&/T ["lux" token])]))) ))) |