diff options
Diffstat (limited to 'luxc/src/lux/analyser/proc/common.clj')
-rw-r--r-- | luxc/src/lux/analyser/proc/common.clj | 285 |
1 files changed, 127 insertions, 158 deletions
diff --git a/luxc/src/lux/analyser/proc/common.clj b/luxc/src/lux/analyser/proc/common.clj index d05c68564..871dec4b3 100644 --- a/luxc/src/lux/analyser/proc/common.clj +++ b/luxc/src/lux/analyser/proc/common.clj @@ -474,161 +474,130 @@ (return (&/|list (&&/|meta exo-type _cursor (&&/$proc (&/T ["process" "schedule"]) (&/|list =milliseconds =procedure) (&/|list))))))) -(defn analyse-proc [analyse exo-type category proc ?values] - (case category - "lux" - (case proc - "is" (analyse-lux-is analyse exo-type ?values) - "try" (analyse-lux-try analyse exo-type ?values)) - - "io" - (case proc - "log" (analyse-io-log analyse exo-type ?values) - "error" (analyse-io-error analyse exo-type ?values) - "exit" (analyse-io-exit analyse exo-type ?values) - "current-time" (analyse-io-current-time analyse exo-type ?values) - ) - - "text" - (case proc - "=" (analyse-text-eq analyse exo-type ?values) - "<" (analyse-text-lt analyse exo-type ?values) - "append" (analyse-text-append analyse exo-type ?values) - "clip" (analyse-text-clip analyse exo-type ?values) - "index" (analyse-text-index analyse exo-type ?values) - "last-index" (analyse-text-last-index analyse exo-type ?values) - "size" (analyse-text-size analyse exo-type ?values) - "hash" (analyse-text-hash analyse exo-type ?values) - "replace-all" (analyse-text-replace-all analyse exo-type ?values) - "trim" (analyse-text-trim analyse exo-type ?values) - "char" (analyse-text-char analyse exo-type ?values) - "upper-case" (analyse-text-upper-case analyse exo-type ?values) - "lower-case" (analyse-text-lower-case analyse exo-type ?values) - "contains?" (analyse-text-contains? analyse exo-type ?values) - ) - - "bit" - (case proc - "count" (analyse-bit-count analyse exo-type ?values) - "and" (analyse-bit-and analyse exo-type ?values) - "or" (analyse-bit-or analyse exo-type ?values) - "xor" (analyse-bit-xor analyse exo-type ?values) - "shift-left" (analyse-bit-shift-left analyse exo-type ?values) - "shift-right" (analyse-bit-shift-right analyse exo-type ?values) - "unsigned-shift-right" (analyse-bit-unsigned-shift-right analyse exo-type ?values)) - - "array" - (case proc - "new" (analyse-array-new analyse exo-type ?values) - "get" (analyse-array-get analyse exo-type ?values) - "put" (analyse-array-put analyse exo-type ?values) - "remove" (analyse-array-remove analyse exo-type ?values) - "size" (analyse-array-size analyse exo-type ?values)) - - "nat" - (case proc - "+" (analyse-nat-add analyse exo-type ?values) - "-" (analyse-nat-sub analyse exo-type ?values) - "*" (analyse-nat-mul analyse exo-type ?values) - "/" (analyse-nat-div analyse exo-type ?values) - "%" (analyse-nat-rem analyse exo-type ?values) - "=" (analyse-nat-eq analyse exo-type ?values) - "<" (analyse-nat-lt analyse exo-type ?values) - "min-value" (analyse-nat-min-value analyse exo-type ?values) - "max-value" (analyse-nat-max-value analyse exo-type ?values) - "to-int" (analyse-nat-to-int analyse exo-type ?values) - "to-char" (analyse-nat-to-char analyse exo-type ?values) - ) - - "int" - (case proc - "+" (analyse-int-add analyse exo-type ?values) - "-" (analyse-int-sub analyse exo-type ?values) - "*" (analyse-int-mul analyse exo-type ?values) - "/" (analyse-int-div analyse exo-type ?values) - "%" (analyse-int-rem analyse exo-type ?values) - "=" (analyse-int-eq analyse exo-type ?values) - "<" (analyse-int-lt analyse exo-type ?values) - "min-value" (analyse-int-min-value analyse exo-type ?values) - "max-value" (analyse-int-max-value analyse exo-type ?values) - "to-nat" (analyse-int-to-nat analyse exo-type ?values) - "to-frac" (analyse-int-to-frac analyse exo-type ?values) - ) - - "deg" - (case proc - "+" (analyse-deg-add analyse exo-type ?values) - "-" (analyse-deg-sub analyse exo-type ?values) - "*" (analyse-deg-mul analyse exo-type ?values) - "/" (analyse-deg-div analyse exo-type ?values) - "%" (analyse-deg-rem analyse exo-type ?values) - "=" (analyse-deg-eq analyse exo-type ?values) - "<" (analyse-deg-lt analyse exo-type ?values) - "min-value" (analyse-deg-min-value analyse exo-type ?values) - "max-value" (analyse-deg-max-value analyse exo-type ?values) - "to-frac" (analyse-deg-to-frac analyse exo-type ?values) - "scale" (analyse-deg-scale analyse exo-type ?values) - "reciprocal" (analyse-deg-reciprocal analyse exo-type ?values) - ) - - "frac" - (case proc - "+" (analyse-frac-add analyse exo-type ?values) - "-" (analyse-frac-sub analyse exo-type ?values) - "*" (analyse-frac-mul analyse exo-type ?values) - "/" (analyse-frac-div analyse exo-type ?values) - "%" (analyse-frac-rem analyse exo-type ?values) - "=" (analyse-frac-eq analyse exo-type ?values) - "<" (analyse-frac-lt analyse exo-type ?values) - "encode" (analyse-frac-encode analyse exo-type ?values) - "decode" (analyse-frac-decode analyse exo-type ?values) - "smallest-value" (analyse-frac-smallest-value analyse exo-type ?values) - "min-value" (analyse-frac-min-value analyse exo-type ?values) - "max-value" (analyse-frac-max-value analyse exo-type ?values) - "not-a-number" (analyse-frac-not-a-number analyse exo-type ?values) - "positive-infinity" (analyse-frac-positive-infinity analyse exo-type ?values) - "negative-infinity" (analyse-frac-negative-infinity analyse exo-type ?values) - "to-deg" (analyse-frac-to-deg analyse exo-type ?values) - "to-int" (analyse-frac-to-int analyse exo-type ?values) - ) - - "math" - (case proc - "e" (analyse-math-e analyse exo-type ?values) - "pi" (analyse-math-pi analyse exo-type ?values) - "cos" (analyse-math-cos analyse exo-type ?values) - "sin" (analyse-math-sin analyse exo-type ?values) - "tan" (analyse-math-tan analyse exo-type ?values) - "acos" (analyse-math-acos analyse exo-type ?values) - "asin" (analyse-math-asin analyse exo-type ?values) - "atan" (analyse-math-atan analyse exo-type ?values) - "cosh" (analyse-math-cosh analyse exo-type ?values) - "sinh" (analyse-math-sinh analyse exo-type ?values) - "tanh" (analyse-math-tanh analyse exo-type ?values) - "exp" (analyse-math-exp analyse exo-type ?values) - "log" (analyse-math-log analyse exo-type ?values) - "root2" (analyse-math-root2 analyse exo-type ?values) - "root3" (analyse-math-root3 analyse exo-type ?values) - "ceil" (analyse-math-ceil analyse exo-type ?values) - "floor" (analyse-math-floor analyse exo-type ?values) - "round" (analyse-math-round analyse exo-type ?values) - "atan2" (analyse-math-atan2 analyse exo-type ?values) - "pow" (analyse-math-pow analyse exo-type ?values) - ) - - "atom" - (case proc - "new" (analyse-atom-new analyse exo-type ?values) - "get" (analyse-atom-get analyse exo-type ?values) - "compare-and-swap" (analyse-atom-compare-and-swap analyse exo-type ?values) - ) - - "process" - (case proc - "concurrency-level" (analyse-process-concurrency-level analyse exo-type ?values) - "future" (analyse-process-future analyse exo-type ?values) - "schedule" (analyse-process-schedule analyse exo-type ?values) - ) - - ;; else - (&/fail-with-loc (str "[Analyser Error] Unknown host procedure: " [category proc])))) +(defn analyse-proc [analyse exo-type proc ?values] + (try (case proc + "lux is" (analyse-lux-is analyse exo-type ?values) + "lux try" (analyse-lux-try analyse exo-type ?values) + + "lux io log" (analyse-io-log analyse exo-type ?values) + "lux io error" (analyse-io-error analyse exo-type ?values) + "lux io exit" (analyse-io-exit analyse exo-type ?values) + "lux io current-time" (analyse-io-current-time analyse exo-type ?values) + + "lux text =" (analyse-text-eq analyse exo-type ?values) + "lux text <" (analyse-text-lt analyse exo-type ?values) + "lux text append" (analyse-text-append analyse exo-type ?values) + "lux text clip" (analyse-text-clip analyse exo-type ?values) + "lux text index" (analyse-text-index analyse exo-type ?values) + "lux text last-index" (analyse-text-last-index analyse exo-type ?values) + "lux text size" (analyse-text-size analyse exo-type ?values) + "lux text hash" (analyse-text-hash analyse exo-type ?values) + "lux text replace-all" (analyse-text-replace-all analyse exo-type ?values) + "lux text trim" (analyse-text-trim analyse exo-type ?values) + "lux text char" (analyse-text-char analyse exo-type ?values) + "lux text upper-case" (analyse-text-upper-case analyse exo-type ?values) + "lux text lower-case" (analyse-text-lower-case analyse exo-type ?values) + "lux text contains?" (analyse-text-contains? analyse exo-type ?values) + + "lux bit count" (analyse-bit-count analyse exo-type ?values) + "lux bit and" (analyse-bit-and analyse exo-type ?values) + "lux bit or" (analyse-bit-or analyse exo-type ?values) + "lux bit xor" (analyse-bit-xor analyse exo-type ?values) + "lux bit shift-left" (analyse-bit-shift-left analyse exo-type ?values) + "lux bit shift-right" (analyse-bit-shift-right analyse exo-type ?values) + "lux bit unsigned-shift-right" (analyse-bit-unsigned-shift-right analyse exo-type ?values) + + "lux array new" (analyse-array-new analyse exo-type ?values) + "lux array get" (analyse-array-get analyse exo-type ?values) + "lux array put" (analyse-array-put analyse exo-type ?values) + "lux array remove" (analyse-array-remove analyse exo-type ?values) + "lux array size" (analyse-array-size analyse exo-type ?values) + + "lux nat +" (analyse-nat-add analyse exo-type ?values) + "lux nat -" (analyse-nat-sub analyse exo-type ?values) + "lux nat *" (analyse-nat-mul analyse exo-type ?values) + "lux nat /" (analyse-nat-div analyse exo-type ?values) + "lux nat %" (analyse-nat-rem analyse exo-type ?values) + "lux nat =" (analyse-nat-eq analyse exo-type ?values) + "lux nat <" (analyse-nat-lt analyse exo-type ?values) + "lux nat min-value" (analyse-nat-min-value analyse exo-type ?values) + "lux nat max-value" (analyse-nat-max-value analyse exo-type ?values) + "lux nat to-int" (analyse-nat-to-int analyse exo-type ?values) + "lux nat to-char" (analyse-nat-to-char analyse exo-type ?values) + + "lux int +" (analyse-int-add analyse exo-type ?values) + "lux int -" (analyse-int-sub analyse exo-type ?values) + "lux int *" (analyse-int-mul analyse exo-type ?values) + "lux int /" (analyse-int-div analyse exo-type ?values) + "lux int %" (analyse-int-rem analyse exo-type ?values) + "lux int =" (analyse-int-eq analyse exo-type ?values) + "lux int <" (analyse-int-lt analyse exo-type ?values) + "lux int min-value" (analyse-int-min-value analyse exo-type ?values) + "lux int max-value" (analyse-int-max-value analyse exo-type ?values) + "lux int to-nat" (analyse-int-to-nat analyse exo-type ?values) + "lux int to-frac" (analyse-int-to-frac analyse exo-type ?values) + + "lux deg +" (analyse-deg-add analyse exo-type ?values) + "lux deg -" (analyse-deg-sub analyse exo-type ?values) + "lux deg *" (analyse-deg-mul analyse exo-type ?values) + "lux deg /" (analyse-deg-div analyse exo-type ?values) + "lux deg %" (analyse-deg-rem analyse exo-type ?values) + "lux deg =" (analyse-deg-eq analyse exo-type ?values) + "lux deg <" (analyse-deg-lt analyse exo-type ?values) + "lux deg min-value" (analyse-deg-min-value analyse exo-type ?values) + "lux deg max-value" (analyse-deg-max-value analyse exo-type ?values) + "lux deg to-frac" (analyse-deg-to-frac analyse exo-type ?values) + "lux deg scale" (analyse-deg-scale analyse exo-type ?values) + "lux deg reciprocal" (analyse-deg-reciprocal analyse exo-type ?values) + + "lux frac +" (analyse-frac-add analyse exo-type ?values) + "lux frac -" (analyse-frac-sub analyse exo-type ?values) + "lux frac *" (analyse-frac-mul analyse exo-type ?values) + "lux frac /" (analyse-frac-div analyse exo-type ?values) + "lux frac %" (analyse-frac-rem analyse exo-type ?values) + "lux frac =" (analyse-frac-eq analyse exo-type ?values) + "lux frac <" (analyse-frac-lt analyse exo-type ?values) + "lux frac encode" (analyse-frac-encode analyse exo-type ?values) + "lux frac decode" (analyse-frac-decode analyse exo-type ?values) + "lux frac smallest-value" (analyse-frac-smallest-value analyse exo-type ?values) + "lux frac min-value" (analyse-frac-min-value analyse exo-type ?values) + "lux frac max-value" (analyse-frac-max-value analyse exo-type ?values) + "lux frac not-a-number" (analyse-frac-not-a-number analyse exo-type ?values) + "lux frac positive-infinity" (analyse-frac-positive-infinity analyse exo-type ?values) + "lux frac negative-infinity" (analyse-frac-negative-infinity analyse exo-type ?values) + "lux frac to-deg" (analyse-frac-to-deg analyse exo-type ?values) + "lux frac to-int" (analyse-frac-to-int analyse exo-type ?values) + + "lux math e" (analyse-math-e analyse exo-type ?values) + "lux math pi" (analyse-math-pi analyse exo-type ?values) + "lux math cos" (analyse-math-cos analyse exo-type ?values) + "lux math sin" (analyse-math-sin analyse exo-type ?values) + "lux math tan" (analyse-math-tan analyse exo-type ?values) + "lux math acos" (analyse-math-acos analyse exo-type ?values) + "lux math asin" (analyse-math-asin analyse exo-type ?values) + "lux math atan" (analyse-math-atan analyse exo-type ?values) + "lux math cosh" (analyse-math-cosh analyse exo-type ?values) + "lux math sinh" (analyse-math-sinh analyse exo-type ?values) + "lux math tanh" (analyse-math-tanh analyse exo-type ?values) + "lux math exp" (analyse-math-exp analyse exo-type ?values) + "lux math log" (analyse-math-log analyse exo-type ?values) + "lux math root2" (analyse-math-root2 analyse exo-type ?values) + "lux math root3" (analyse-math-root3 analyse exo-type ?values) + "lux math ceil" (analyse-math-ceil analyse exo-type ?values) + "lux math floor" (analyse-math-floor analyse exo-type ?values) + "lux math round" (analyse-math-round analyse exo-type ?values) + "lux math atan2" (analyse-math-atan2 analyse exo-type ?values) + "lux math pow" (analyse-math-pow analyse exo-type ?values) + + "lux atom new" (analyse-atom-new analyse exo-type ?values) + "lux atom get" (analyse-atom-get analyse exo-type ?values) + "lux atom compare-and-swap" (analyse-atom-compare-and-swap analyse exo-type ?values) + + "lux process concurrency-level" (analyse-process-concurrency-level analyse exo-type ?values) + "lux process future" (analyse-process-future analyse exo-type ?values) + "lux process schedule" (analyse-process-schedule analyse exo-type ?values) + + ;; else + (&/fail-with-loc (str "[Analyser Error] Unknown host procedure: " proc))) + (catch Exception ex + (&/fail-with-loc (str "[Analyser Error] Invalid syntax for procedure: " proc))))) |