initial commit

This commit is contained in:
2026-06-25 21:30:32 +00:00
commit 328faf6251
220 changed files with 162103 additions and 0 deletions
+131
View File
@@ -0,0 +1,131 @@
;; Copyright (c) Nicola Mometto, Rich Hickey & contributors.
;; The use and distribution terms for this software are covered by the
;; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
;; which can be found in the file epl-v10.html at the root of this distribution.
;; By using this software in any fashion, you are agreeing to be bound by
;; the terms of this license.
;; You must not remove this notice, or any other, from this software.
(ns cljs.tools.reader.impl.commons
(:refer-clojure :exclude [char])
(:require
[cljs.tools.reader.impl.errors :refer [reader-error]]
[cljs.tools.reader.reader-types :refer [peek-char read-char]]
[cljs.tools.reader.impl.utils :refer [numeric? newline? char]]))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; helpers
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defn ^boolean number-literal?
"Checks whether the reader is at the start of a number literal"
[^not-native reader initch]
(or (numeric? initch)
(and (or (identical? \+ initch) (identical? \- initch))
(numeric? (peek-char reader)))))
(defn read-past
"Read until first character that doesn't match pred, returning
char."
[pred ^not-native rdr]
(loop [ch (read-char rdr)]
(if ^boolean (pred ch)
(recur (read-char rdr))
ch)))
(defn skip-line
"Advances the reader to the end of a line. Returns the reader"
[^not-native reader]
(loop []
(when-not (newline? (read-char reader))
(recur)))
reader)
(def int-pattern #"^([-+]?)(?:(0)|([1-9][0-9]*)|0[xX]([0-9A-Fa-f]+)|0([0-7]+)|([1-9][0-9]?)[rR]([0-9A-Za-z]+)|0[0-9]+)(N)?$")
(def ratio-pattern #"([-+]?[0-9]+)/([0-9]+)")
(def float-pattern #"([-+]?[0-9]+(\.[0-9]*)?([eE][-+]?[0-9]+)?)(M)?")
(defn- match-int
[s]
(let [m (vec (re-find int-pattern s))]
(if-not (nil? (m 2))
0
(let [^boolean negate? (identical? "-" (m 1))
a (cond
(not (nil? (m 3))) [(m 3) 10]
(not (nil? (m 4))) [(m 4) 16]
(not (nil? (m 5))) [(m 5) 8]
(not (nil? (m 7))) [(m 7) (js/parseInt (m 6))]
:else [nil nil])
n (a 0)]
(when-not (nil? n)
(let [bn (js/parseInt n (a 1))
bn (if negate? (* -1 bn) bn)]
(when-not (js/isNaN bn)
bn)))))))
(defn- match-ratio
[s]
(let [m (vec (re-find ratio-pattern s))
numerator (m 1)
denominator (m 2)
numerator (if (re-find #"^\+" numerator)
(subs numerator 1)
numerator)]
(/ (-> numerator js/parseInt) ;;; No ratio type in cljs
(-> denominator js/parseInt)))); So will convert to js/Number
(defn- match-float
[s]
(let [m (vec (re-find float-pattern s))]
(if-not (nil? (m 4)) ;; for BigDecimal "10.03M", as all parsed to js/Number
(js/parseFloat (m 1))
(js/parseFloat s))))
(defn ^boolean matches? [pattern s]
(let [[match] (re-find pattern s)]
(identical? match s)))
(defn match-number [s]
(if (matches? int-pattern s)
(match-int s)
(if (matches? float-pattern s)
(match-float s)
(when (matches? ratio-pattern s)
(match-ratio s)))))
(defn parse-symbol
"Parses a string into a vector of the namespace and symbol"
[token]
(when-not (or (identical? "" token)
(true? (.test #":$" token))
(true? (.test #"^::" token)))
(let [ns-idx (.indexOf token "/")
ns (when (pos? ns-idx)
(subs token 0 ns-idx))]
(if-not (nil? ns)
(let [ns-idx (inc ns-idx)]
(when-not (== ns-idx (count token))
(let [sym (subs token ns-idx)]
(when (and (not (numeric? (nth sym 0)))
(not (identical? "" sym))
(false? (.test #":$" ns))
(or (identical? sym "/")
(== -1 (.indexOf sym "/"))))
[ns sym]))))
(when (or (identical? token "/")
(== -1 (.indexOf token "/")))
[nil token])))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; readers
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defn read-comment
[rdr & _]
(skip-line rdr))
(defn throwing-reader
[msg]
(fn [rdr & _]
(reader-error rdr msg)))
+192
View File
@@ -0,0 +1,192 @@
// Compiled by ClojureScript 1.11.60 {:static-fns true, :optimize-constants true, :optimizations :advanced}
goog.provide('cljs.tools.reader.impl.commons');
goog.require('cljs.core');
goog.require('cljs.core.constants');
goog.require('cljs.tools.reader.impl.errors');
goog.require('cljs.tools.reader.reader_types');
goog.require('cljs.tools.reader.impl.utils');
/**
* Checks whether the reader is at the start of a number literal
*/
cljs.tools.reader.impl.commons.number_literal_QMARK_ = (function cljs$tools$reader$impl$commons$number_literal_QMARK_(reader,initch){
return ((cljs.tools.reader.impl.utils.numeric_QMARK_(initch)) || (((((("+" === initch)) || (("-" === initch)))) && (cljs.tools.reader.impl.utils.numeric_QMARK_(reader.cljs$tools$reader$reader_types$Reader$peek_char$arity$1(null))))));
});
/**
* Read until first character that doesn't match pred, returning
* char.
*/
cljs.tools.reader.impl.commons.read_past = (function cljs$tools$reader$impl$commons$read_past(pred,rdr){
var ch = rdr.cljs$tools$reader$reader_types$Reader$read_char$arity$1(null);
while(true){
if((pred.cljs$core$IFn$_invoke$arity$1 ? pred.cljs$core$IFn$_invoke$arity$1(ch) : pred.call(null,ch))){
var G__5357 = rdr.cljs$tools$reader$reader_types$Reader$read_char$arity$1(null);
ch = G__5357;
continue;
} else {
return ch;
}
break;
}
});
/**
* Advances the reader to the end of a line. Returns the reader
*/
cljs.tools.reader.impl.commons.skip_line = (function cljs$tools$reader$impl$commons$skip_line(reader){
while(true){
if(cljs.tools.reader.impl.utils.newline_QMARK_(reader.cljs$tools$reader$reader_types$Reader$read_char$arity$1(null))){
} else {
continue;
}
break;
}
return reader;
});
cljs.tools.reader.impl.commons.int_pattern = /^([-+]?)(?:(0)|([1-9][0-9]*)|0[xX]([0-9A-Fa-f]+)|0([0-7]+)|([1-9][0-9]?)[rR]([0-9A-Za-z]+)|0[0-9]+)(N)?$/;
cljs.tools.reader.impl.commons.ratio_pattern = /([-+]?[0-9]+)\/([0-9]+)/;
cljs.tools.reader.impl.commons.float_pattern = /([-+]?[0-9]+(\.[0-9]*)?([eE][-+]?[0-9]+)?)(M)?/;
cljs.tools.reader.impl.commons.match_int = (function cljs$tools$reader$impl$commons$match_int(s){
var m = cljs.core.vec(cljs.core.re_find(cljs.tools.reader.impl.commons.int_pattern,s));
if((!(((m.cljs$core$IFn$_invoke$arity$1 ? m.cljs$core$IFn$_invoke$arity$1((2)) : m.call(null,(2))) == null)))){
return (0);
} else {
var negate_QMARK_ = ("-" === (m.cljs$core$IFn$_invoke$arity$1 ? m.cljs$core$IFn$_invoke$arity$1((1)) : m.call(null,(1))));
var a = (((!(((m.cljs$core$IFn$_invoke$arity$1 ? m.cljs$core$IFn$_invoke$arity$1((3)) : m.call(null,(3))) == null))))?new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [(m.cljs$core$IFn$_invoke$arity$1 ? m.cljs$core$IFn$_invoke$arity$1((3)) : m.call(null,(3))),(10)], null):(((!(((m.cljs$core$IFn$_invoke$arity$1 ? m.cljs$core$IFn$_invoke$arity$1((4)) : m.call(null,(4))) == null))))?new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [(m.cljs$core$IFn$_invoke$arity$1 ? m.cljs$core$IFn$_invoke$arity$1((4)) : m.call(null,(4))),(16)], null):(((!(((m.cljs$core$IFn$_invoke$arity$1 ? m.cljs$core$IFn$_invoke$arity$1((5)) : m.call(null,(5))) == null))))?new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [(m.cljs$core$IFn$_invoke$arity$1 ? m.cljs$core$IFn$_invoke$arity$1((5)) : m.call(null,(5))),(8)], null):(((!(((m.cljs$core$IFn$_invoke$arity$1 ? m.cljs$core$IFn$_invoke$arity$1((7)) : m.call(null,(7))) == null))))?new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [(m.cljs$core$IFn$_invoke$arity$1 ? m.cljs$core$IFn$_invoke$arity$1((7)) : m.call(null,(7))),parseInt((m.cljs$core$IFn$_invoke$arity$1 ? m.cljs$core$IFn$_invoke$arity$1((6)) : m.call(null,(6))))], null):new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [null,null], null)
))));
var n = (a.cljs$core$IFn$_invoke$arity$1 ? a.cljs$core$IFn$_invoke$arity$1((0)) : a.call(null,(0)));
if((n == null)){
return null;
} else {
var bn = parseInt(n,(a.cljs$core$IFn$_invoke$arity$1 ? a.cljs$core$IFn$_invoke$arity$1((1)) : a.call(null,(1))));
var bn__$1 = ((negate_QMARK_)?((-1) * bn):bn);
if(cljs.core.truth_(isNaN(bn__$1))){
return null;
} else {
return bn__$1;
}
}
}
});
cljs.tools.reader.impl.commons.match_ratio = (function cljs$tools$reader$impl$commons$match_ratio(s){
var m = cljs.core.vec(cljs.core.re_find(cljs.tools.reader.impl.commons.ratio_pattern,s));
var numerator = (m.cljs$core$IFn$_invoke$arity$1 ? m.cljs$core$IFn$_invoke$arity$1((1)) : m.call(null,(1)));
var denominator = (m.cljs$core$IFn$_invoke$arity$1 ? m.cljs$core$IFn$_invoke$arity$1((2)) : m.call(null,(2)));
var numerator__$1 = (cljs.core.truth_(cljs.core.re_find(/^\+/,numerator))?cljs.core.subs.cljs$core$IFn$_invoke$arity$2(numerator,(1)):numerator);
return (parseInt(numerator__$1) / parseInt(denominator));
});
cljs.tools.reader.impl.commons.match_float = (function cljs$tools$reader$impl$commons$match_float(s){
var m = cljs.core.vec(cljs.core.re_find(cljs.tools.reader.impl.commons.float_pattern,s));
if((!(((m.cljs$core$IFn$_invoke$arity$1 ? m.cljs$core$IFn$_invoke$arity$1((4)) : m.call(null,(4))) == null)))){
return parseFloat((m.cljs$core$IFn$_invoke$arity$1 ? m.cljs$core$IFn$_invoke$arity$1((1)) : m.call(null,(1))));
} else {
return parseFloat(s);
}
});
cljs.tools.reader.impl.commons.matches_QMARK_ = (function cljs$tools$reader$impl$commons$matches_QMARK_(pattern,s){
var vec__5358 = cljs.core.re_find(pattern,s);
var match = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__5358,(0),null);
return (match === s);
});
cljs.tools.reader.impl.commons.match_number = (function cljs$tools$reader$impl$commons$match_number(s){
if(cljs.tools.reader.impl.commons.matches_QMARK_(cljs.tools.reader.impl.commons.int_pattern,s)){
return cljs.tools.reader.impl.commons.match_int(s);
} else {
if(cljs.tools.reader.impl.commons.matches_QMARK_(cljs.tools.reader.impl.commons.float_pattern,s)){
return cljs.tools.reader.impl.commons.match_float(s);
} else {
if(cljs.tools.reader.impl.commons.matches_QMARK_(cljs.tools.reader.impl.commons.ratio_pattern,s)){
return cljs.tools.reader.impl.commons.match_ratio(s);
} else {
return null;
}
}
}
});
/**
* Parses a string into a vector of the namespace and symbol
*/
cljs.tools.reader.impl.commons.parse_symbol = (function cljs$tools$reader$impl$commons$parse_symbol(token){
if(((("" === token)) || (((/:$/.test(token) === true) || (/^::/.test(token) === true))))){
return null;
} else {
var ns_idx = token.indexOf("/");
var ns = (((ns_idx > (0)))?cljs.core.subs.cljs$core$IFn$_invoke$arity$3(token,(0),ns_idx):null);
if((!((ns == null)))){
var ns_idx__$1 = (ns_idx + (1));
if((ns_idx__$1 === cljs.core.count(token))){
return null;
} else {
var sym = cljs.core.subs.cljs$core$IFn$_invoke$arity$2(token,ns_idx__$1);
if((((!(cljs.tools.reader.impl.utils.numeric_QMARK_(cljs.core.nth.cljs$core$IFn$_invoke$arity$2(sym,(0)))))) && ((((!(("" === sym)))) && (((/:$/.test(ns) === false) && ((((sym === "/")) || (((-1) === sym.indexOf("/"))))))))))){
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [ns,sym], null);
} else {
return null;
}
}
} else {
if((((token === "/")) || (((-1) === token.indexOf("/"))))){
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [null,token], null);
} else {
return null;
}
}
}
});
cljs.tools.reader.impl.commons.read_comment = (function cljs$tools$reader$impl$commons$read_comment(var_args){
var args__5775__auto__ = [];
var len__5769__auto___5363 = arguments.length;
var i__5770__auto___5364 = (0);
while(true){
if((i__5770__auto___5364 < len__5769__auto___5363)){
args__5775__auto__.push((arguments[i__5770__auto___5364]));
var G__5365 = (i__5770__auto___5364 + (1));
i__5770__auto___5364 = G__5365;
continue;
} else {
}
break;
}
var argseq__5776__auto__ = ((((1) < args__5775__auto__.length))?(new cljs.core.IndexedSeq(args__5775__auto__.slice((1)),(0),null)):null);
return cljs.tools.reader.impl.commons.read_comment.cljs$core$IFn$_invoke$arity$variadic((arguments[(0)]),argseq__5776__auto__);
});
(cljs.tools.reader.impl.commons.read_comment.cljs$core$IFn$_invoke$arity$variadic = (function (rdr,_){
return cljs.tools.reader.impl.commons.skip_line(rdr);
}));
(cljs.tools.reader.impl.commons.read_comment.cljs$lang$maxFixedArity = (1));
/** @this {Function} */
(cljs.tools.reader.impl.commons.read_comment.cljs$lang$applyTo = (function (seq5361){
var G__5362 = cljs.core.first(seq5361);
var seq5361__$1 = cljs.core.next(seq5361);
var self__5754__auto__ = this;
return self__5754__auto__.cljs$core$IFn$_invoke$arity$variadic(G__5362,seq5361__$1);
}));
cljs.tools.reader.impl.commons.throwing_reader = (function cljs$tools$reader$impl$commons$throwing_reader(msg){
return (function() {
var G__5366__delegate = function (rdr,_){
return cljs.tools.reader.impl.errors.reader_error.cljs$core$IFn$_invoke$arity$variadic(rdr,cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([msg], 0));
};
var G__5366 = function (rdr,var_args){
var _ = null;
if (arguments.length > 1) {
var G__5367__i = 0, G__5367__a = new Array(arguments.length - 1);
while (G__5367__i < G__5367__a.length) {G__5367__a[G__5367__i] = arguments[G__5367__i + 1]; ++G__5367__i;}
_ = new cljs.core.IndexedSeq(G__5367__a,0,null);
}
return G__5366__delegate.call(this,rdr,_);};
G__5366.cljs$lang$maxFixedArity = 1;
G__5366.cljs$lang$applyTo = (function (arglist__5368){
var rdr = cljs.core.first(arglist__5368);
var _ = cljs.core.rest(arglist__5368);
return G__5366__delegate(rdr,_);
});
G__5366.cljs$core$IFn$_invoke$arity$variadic = G__5366__delegate;
return G__5366;
})()
;
});
+247
View File
@@ -0,0 +1,247 @@
;; Copyright (c) Russ Olsen, Nicola Mometto, Rich Hickey & contributors.
;; The use and distribution terms for this software are covered by the
;; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
;; which can be found in the file epl-v10.html at the root of this distribution.
;; By using this software in any fashion, you are agreeing to be bound by
;; the terms of this license.
;; You must not remove this notice, or any other, from this software.
(ns cljs.tools.reader.impl.errors
(:require [cljs.tools.reader.reader-types :as types]
[clojure.string :as s]
[cljs.tools.reader.impl.inspect :as i]))
(defn- ex-details
[rdr ex-type]
(let [details {:type :reader-exception
:ex-kind ex-type}]
(if (types/indexing-reader? rdr)
(assoc
details
:file (types/get-file-name rdr)
:line (types/get-line-number rdr)
:col (types/get-column-number rdr))
details)))
(defn- throw-ex
"Throw an ex-info error."
[rdr ex-type & msg]
(let [details (ex-details rdr ex-type)
file (:file details)
line (:line details)
col (:col details)
msg1 (if file (str file " "))
msg2 (if line (str "[line " line ", col " col "]"))
msg3 (if (or msg1 msg2) " ")
full-msg (apply str msg1 msg2 msg3 msg)]
(throw (ex-info full-msg details))))
(defn reader-error
"Throws an ExceptionInfo with the given message.
If rdr is an IndexingReader, additional information about column and line number is provided"
[rdr & msgs]
(throw-ex rdr :reader-error (apply str msgs)))
(defn illegal-arg-error
"Throws an ExceptionInfo with the given message.
If rdr is an IndexingReader, additional information about column and line number is provided"
[rdr & msgs]
(throw-ex rdr :illegal-argument (apply str msgs)))
(defn eof-error
"Throws an ExceptionInfo with the given message.
If rdr is an IndexingReader, additional information about column and line number is provided"
[rdr & msgs]
(throw-ex rdr :eof (apply str msgs)))
(defn throw-eof-delimited
([rdr kind column line] (throw-eof-delimited rdr kind line column nil))
([rdr kind line column n]
(eof-error
rdr
"Unexpected EOF while reading "
(if n
(str "item " n " of "))
(name kind)
(if line
(str ", starting at line " line " and column " column))
".")))
(defn throw-odd-map [rdr line col elements]
(reader-error
rdr
"The map literal starting with "
(i/inspect (first elements))
(if line (str " on line " line " column " col))
" contains "
(count elements)
" form(s). Map literals must contain an even number of forms."))
(defn throw-invalid-number [rdr token]
(reader-error
rdr
"Invalid number: "
token
"."))
(defn throw-invalid-unicode-literal [rdr token]
(throw
(illegal-arg-error
rdr
"Invalid unicode literal: \\"
token
".")))
(defn throw-invalid-unicode-escape [rdr ch]
(reader-error
rdr
"Invalid unicode escape: \\u"
ch
"."))
(defn throw-invalid [rdr kind token]
(reader-error rdr "Invalid " (name kind) ": " token "."))
(defn throw-eof-at-start [rdr kind]
(eof-error rdr "Unexpected EOF while reading start of " (name kind) "."))
(defn throw-bad-char [rdr kind ch]
(reader-error rdr "Invalid character: " ch " found while reading " (name kind) "."))
(defn throw-eof-at-dispatch [rdr]
(eof-error rdr "Unexpected EOF while reading dispatch character."))
(defn throw-unmatch-delimiter [rdr ch]
(reader-error rdr "Unmatched delimiter " ch "."))
(defn throw-eof-reading [rdr kind & start]
(let [init (case kind :regex "#\"" :string \")]
(eof-error rdr "Unexpected EOF reading " (name kind) " starting " (apply str init start) ".")))
(defn throw-invalid-unicode-char[rdr token]
(reader-error
rdr
"Invalid unicode character \\"
token
"."))
(defn throw-invalid-unicode-digit-in-token[rdr ch token]
(illegal-arg-error
rdr
"Invalid digit "
ch
" in unicode character \\"
token
"."))
(defn throw-invalid-unicode-digit[rdr ch]
(illegal-arg-error
rdr
"Invalid digit "
ch
" in unicode character."))
(defn throw-invalid-unicode-len[rdr actual expected]
(illegal-arg-error
rdr
"Invalid unicode literal. Unicode literals should be "
expected
"characters long. "
"Value supplied is "
actual
" characters long."))
(defn throw-invalid-character-literal[rdr token]
(reader-error rdr "Invalid character literal \\u" token "."))
(defn throw-invalid-octal-len[rdr token]
(reader-error
rdr
"Invalid octal escape sequence in a character literal: "
token
". Octal escape sequences must be 3 or fewer digits."))
(defn throw-bad-octal-number [rdr]
(reader-error rdr "Octal escape sequence must be in range [0, 377]."))
(defn throw-unsupported-character[rdr token]
(reader-error
rdr
"Unsupported character: "
token
"."))
(defn throw-eof-in-character [rdr]
(eof-error
rdr
"Unexpected EOF while reading character."))
(defn throw-bad-escape-char [rdr ch]
(reader-error rdr "Unsupported escape character: \\" ch "."))
(defn throw-single-colon [rdr]
(reader-error rdr "A single colon is not a valid keyword."))
(defn throw-bad-metadata [rdr x]
(reader-error
rdr
"Metadata cannot be "
(i/inspect x)
". Metadata must be a Symbol, Keyword, String or Map."))
(defn throw-bad-metadata-target [rdr target]
(reader-error
rdr
"Metadata can not be applied to "
(i/inspect target)
". "
"Metadata can only be applied to IMetas."))
(defn throw-feature-not-keyword [rdr feature]
(reader-error
rdr
"Feature cannot be "
(i/inspect feature)
". Features must be keywords."))
(defn throw-ns-map-no-map [rdr ns-name]
(reader-error rdr "Namespaced map with namespace " ns-name " does not specify a map."))
(defn throw-bad-ns [rdr ns-name]
(reader-error rdr "Invalid value used as namespace in namespaced map: " ns-name "."))
(defn throw-bad-reader-tag [rdr tag]
(reader-error
rdr
"Invalid reader tag: "
(i/inspect tag)
". Reader tags must be symbols."))
(defn throw-unknown-reader-tag [rdr tag]
(reader-error
rdr
"No reader function for tag "
(i/inspect tag)
"."))
(defn- duplicate-keys-error [msg coll]
(letfn [(duplicates [seq]
(for [[id freq] (frequencies seq)
:when (> freq 1)]
id))]
(let [dups (duplicates coll)]
(apply str msg
(when (> (count dups) 1) "s")
": " (interpose ", " dups)))))
(defn throw-dup-keys [rdr kind ks]
(reader-error
rdr
(duplicate-keys-error
(str (s/capitalize (name kind)) " literal contains duplicate key")
ks)))
(defn throw-eof-error [rdr line]
(if line
(eof-error rdr "EOF while reading, starting at line " line ".")
(eof-error rdr "EOF while reading.")))
+416
View File
@@ -0,0 +1,416 @@
// Compiled by ClojureScript 1.11.60 {:static-fns true, :optimize-constants true, :optimizations :advanced}
goog.provide('cljs.tools.reader.impl.errors');
goog.require('cljs.core');
goog.require('cljs.core.constants');
goog.require('cljs.tools.reader.reader_types');
goog.require('clojure.string');
goog.require('cljs.tools.reader.impl.inspect');
cljs.tools.reader.impl.errors.ex_details = (function cljs$tools$reader$impl$errors$ex_details(rdr,ex_type){
var details = new cljs.core.PersistentArrayMap(null, 2, [cljs.core.cst$kw$type,cljs.core.cst$kw$reader_DASH_exception,cljs.core.cst$kw$ex_DASH_kind,ex_type], null);
if(cljs.tools.reader.reader_types.indexing_reader_QMARK_(rdr)){
return cljs.core.assoc.cljs$core$IFn$_invoke$arity$variadic(details,cljs.core.cst$kw$file,cljs.tools.reader.reader_types.get_file_name(rdr),cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([cljs.core.cst$kw$line,cljs.tools.reader.reader_types.get_line_number(rdr),cljs.core.cst$kw$col,cljs.tools.reader.reader_types.get_column_number(rdr)], 0));
} else {
return details;
}
});
/**
* Throw an ex-info error.
*/
cljs.tools.reader.impl.errors.throw_ex = (function cljs$tools$reader$impl$errors$throw_ex(var_args){
var args__5775__auto__ = [];
var len__5769__auto___5303 = arguments.length;
var i__5770__auto___5304 = (0);
while(true){
if((i__5770__auto___5304 < len__5769__auto___5303)){
args__5775__auto__.push((arguments[i__5770__auto___5304]));
var G__5305 = (i__5770__auto___5304 + (1));
i__5770__auto___5304 = G__5305;
continue;
} else {
}
break;
}
var argseq__5776__auto__ = ((((2) < args__5775__auto__.length))?(new cljs.core.IndexedSeq(args__5775__auto__.slice((2)),(0),null)):null);
return cljs.tools.reader.impl.errors.throw_ex.cljs$core$IFn$_invoke$arity$variadic((arguments[(0)]),(arguments[(1)]),argseq__5776__auto__);
});
(cljs.tools.reader.impl.errors.throw_ex.cljs$core$IFn$_invoke$arity$variadic = (function (rdr,ex_type,msg){
var details = cljs.tools.reader.impl.errors.ex_details(rdr,ex_type);
var file = cljs.core.cst$kw$file.cljs$core$IFn$_invoke$arity$1(details);
var line = cljs.core.cst$kw$line.cljs$core$IFn$_invoke$arity$1(details);
var col = cljs.core.cst$kw$col.cljs$core$IFn$_invoke$arity$1(details);
var msg1 = (cljs.core.truth_(file)?[cljs.core.str.cljs$core$IFn$_invoke$arity$1(file)," "].join(''):null);
var msg2 = (cljs.core.truth_(line)?["[line ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(line),", col ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(col),"]"].join(''):null);
var msg3 = (cljs.core.truth_((function (){var or__5045__auto__ = msg1;
if(cljs.core.truth_(or__5045__auto__)){
return or__5045__auto__;
} else {
return msg2;
}
})())?" ":null);
var full_msg = cljs.core.apply.cljs$core$IFn$_invoke$arity$5(cljs.core.str,msg1,msg2,msg3,msg);
throw cljs.core.ex_info.cljs$core$IFn$_invoke$arity$2(full_msg,details);
}));
(cljs.tools.reader.impl.errors.throw_ex.cljs$lang$maxFixedArity = (2));
/** @this {Function} */
(cljs.tools.reader.impl.errors.throw_ex.cljs$lang$applyTo = (function (seq5300){
var G__5301 = cljs.core.first(seq5300);
var seq5300__$1 = cljs.core.next(seq5300);
var G__5302 = cljs.core.first(seq5300__$1);
var seq5300__$2 = cljs.core.next(seq5300__$1);
var self__5754__auto__ = this;
return self__5754__auto__.cljs$core$IFn$_invoke$arity$variadic(G__5301,G__5302,seq5300__$2);
}));
/**
* Throws an ExceptionInfo with the given message.
* If rdr is an IndexingReader, additional information about column and line number is provided
*/
cljs.tools.reader.impl.errors.reader_error = (function cljs$tools$reader$impl$errors$reader_error(var_args){
var args__5775__auto__ = [];
var len__5769__auto___5308 = arguments.length;
var i__5770__auto___5309 = (0);
while(true){
if((i__5770__auto___5309 < len__5769__auto___5308)){
args__5775__auto__.push((arguments[i__5770__auto___5309]));
var G__5310 = (i__5770__auto___5309 + (1));
i__5770__auto___5309 = G__5310;
continue;
} else {
}
break;
}
var argseq__5776__auto__ = ((((1) < args__5775__auto__.length))?(new cljs.core.IndexedSeq(args__5775__auto__.slice((1)),(0),null)):null);
return cljs.tools.reader.impl.errors.reader_error.cljs$core$IFn$_invoke$arity$variadic((arguments[(0)]),argseq__5776__auto__);
});
(cljs.tools.reader.impl.errors.reader_error.cljs$core$IFn$_invoke$arity$variadic = (function (rdr,msgs){
return cljs.tools.reader.impl.errors.throw_ex.cljs$core$IFn$_invoke$arity$variadic(rdr,cljs.core.cst$kw$reader_DASH_error,cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([cljs.core.apply.cljs$core$IFn$_invoke$arity$2(cljs.core.str,msgs)], 0));
}));
(cljs.tools.reader.impl.errors.reader_error.cljs$lang$maxFixedArity = (1));
/** @this {Function} */
(cljs.tools.reader.impl.errors.reader_error.cljs$lang$applyTo = (function (seq5306){
var G__5307 = cljs.core.first(seq5306);
var seq5306__$1 = cljs.core.next(seq5306);
var self__5754__auto__ = this;
return self__5754__auto__.cljs$core$IFn$_invoke$arity$variadic(G__5307,seq5306__$1);
}));
/**
* Throws an ExceptionInfo with the given message.
* If rdr is an IndexingReader, additional information about column and line number is provided
*/
cljs.tools.reader.impl.errors.illegal_arg_error = (function cljs$tools$reader$impl$errors$illegal_arg_error(var_args){
var args__5775__auto__ = [];
var len__5769__auto___5313 = arguments.length;
var i__5770__auto___5314 = (0);
while(true){
if((i__5770__auto___5314 < len__5769__auto___5313)){
args__5775__auto__.push((arguments[i__5770__auto___5314]));
var G__5315 = (i__5770__auto___5314 + (1));
i__5770__auto___5314 = G__5315;
continue;
} else {
}
break;
}
var argseq__5776__auto__ = ((((1) < args__5775__auto__.length))?(new cljs.core.IndexedSeq(args__5775__auto__.slice((1)),(0),null)):null);
return cljs.tools.reader.impl.errors.illegal_arg_error.cljs$core$IFn$_invoke$arity$variadic((arguments[(0)]),argseq__5776__auto__);
});
(cljs.tools.reader.impl.errors.illegal_arg_error.cljs$core$IFn$_invoke$arity$variadic = (function (rdr,msgs){
return cljs.tools.reader.impl.errors.throw_ex.cljs$core$IFn$_invoke$arity$variadic(rdr,cljs.core.cst$kw$illegal_DASH_argument,cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([cljs.core.apply.cljs$core$IFn$_invoke$arity$2(cljs.core.str,msgs)], 0));
}));
(cljs.tools.reader.impl.errors.illegal_arg_error.cljs$lang$maxFixedArity = (1));
/** @this {Function} */
(cljs.tools.reader.impl.errors.illegal_arg_error.cljs$lang$applyTo = (function (seq5311){
var G__5312 = cljs.core.first(seq5311);
var seq5311__$1 = cljs.core.next(seq5311);
var self__5754__auto__ = this;
return self__5754__auto__.cljs$core$IFn$_invoke$arity$variadic(G__5312,seq5311__$1);
}));
/**
* Throws an ExceptionInfo with the given message.
* If rdr is an IndexingReader, additional information about column and line number is provided
*/
cljs.tools.reader.impl.errors.eof_error = (function cljs$tools$reader$impl$errors$eof_error(var_args){
var args__5775__auto__ = [];
var len__5769__auto___5318 = arguments.length;
var i__5770__auto___5319 = (0);
while(true){
if((i__5770__auto___5319 < len__5769__auto___5318)){
args__5775__auto__.push((arguments[i__5770__auto___5319]));
var G__5320 = (i__5770__auto___5319 + (1));
i__5770__auto___5319 = G__5320;
continue;
} else {
}
break;
}
var argseq__5776__auto__ = ((((1) < args__5775__auto__.length))?(new cljs.core.IndexedSeq(args__5775__auto__.slice((1)),(0),null)):null);
return cljs.tools.reader.impl.errors.eof_error.cljs$core$IFn$_invoke$arity$variadic((arguments[(0)]),argseq__5776__auto__);
});
(cljs.tools.reader.impl.errors.eof_error.cljs$core$IFn$_invoke$arity$variadic = (function (rdr,msgs){
return cljs.tools.reader.impl.errors.throw_ex.cljs$core$IFn$_invoke$arity$variadic(rdr,cljs.core.cst$kw$eof,cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([cljs.core.apply.cljs$core$IFn$_invoke$arity$2(cljs.core.str,msgs)], 0));
}));
(cljs.tools.reader.impl.errors.eof_error.cljs$lang$maxFixedArity = (1));
/** @this {Function} */
(cljs.tools.reader.impl.errors.eof_error.cljs$lang$applyTo = (function (seq5316){
var G__5317 = cljs.core.first(seq5316);
var seq5316__$1 = cljs.core.next(seq5316);
var self__5754__auto__ = this;
return self__5754__auto__.cljs$core$IFn$_invoke$arity$variadic(G__5317,seq5316__$1);
}));
cljs.tools.reader.impl.errors.throw_eof_delimited = (function cljs$tools$reader$impl$errors$throw_eof_delimited(var_args){
var G__5322 = arguments.length;
switch (G__5322) {
case 4:
return cljs.tools.reader.impl.errors.throw_eof_delimited.cljs$core$IFn$_invoke$arity$4((arguments[(0)]),(arguments[(1)]),(arguments[(2)]),(arguments[(3)]));
break;
case 5:
return cljs.tools.reader.impl.errors.throw_eof_delimited.cljs$core$IFn$_invoke$arity$5((arguments[(0)]),(arguments[(1)]),(arguments[(2)]),(arguments[(3)]),(arguments[(4)]));
break;
default:
throw (new Error(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));
}
});
(cljs.tools.reader.impl.errors.throw_eof_delimited.cljs$core$IFn$_invoke$arity$4 = (function (rdr,kind,column,line){
return cljs.tools.reader.impl.errors.throw_eof_delimited.cljs$core$IFn$_invoke$arity$5(rdr,kind,line,column,null);
}));
(cljs.tools.reader.impl.errors.throw_eof_delimited.cljs$core$IFn$_invoke$arity$5 = (function (rdr,kind,line,column,n){
return cljs.tools.reader.impl.errors.eof_error.cljs$core$IFn$_invoke$arity$variadic(rdr,cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2(["Unexpected EOF while reading ",(cljs.core.truth_(n)?["item ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(n)," of "].join(''):null),cljs.core.name(kind),(cljs.core.truth_(line)?[", starting at line ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(line)," and column ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(column)].join(''):null),"."], 0));
}));
(cljs.tools.reader.impl.errors.throw_eof_delimited.cljs$lang$maxFixedArity = 5);
cljs.tools.reader.impl.errors.throw_odd_map = (function cljs$tools$reader$impl$errors$throw_odd_map(rdr,line,col,elements){
return cljs.tools.reader.impl.errors.reader_error.cljs$core$IFn$_invoke$arity$variadic(rdr,cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2(["The map literal starting with ",cljs.tools.reader.impl.inspect.inspect.cljs$core$IFn$_invoke$arity$1(cljs.core.first(elements)),(cljs.core.truth_(line)?[" on line ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(line)," column ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(col)].join(''):null)," contains ",cljs.core.count(elements)," form(s). Map literals must contain an even number of forms."], 0));
});
cljs.tools.reader.impl.errors.throw_invalid_number = (function cljs$tools$reader$impl$errors$throw_invalid_number(rdr,token){
return cljs.tools.reader.impl.errors.reader_error.cljs$core$IFn$_invoke$arity$variadic(rdr,cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2(["Invalid number: ",token,"."], 0));
});
cljs.tools.reader.impl.errors.throw_invalid_unicode_literal = (function cljs$tools$reader$impl$errors$throw_invalid_unicode_literal(rdr,token){
throw cljs.tools.reader.impl.errors.illegal_arg_error.cljs$core$IFn$_invoke$arity$variadic(rdr,cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2(["Invalid unicode literal: \\",token,"."], 0));
});
cljs.tools.reader.impl.errors.throw_invalid_unicode_escape = (function cljs$tools$reader$impl$errors$throw_invalid_unicode_escape(rdr,ch){
return cljs.tools.reader.impl.errors.reader_error.cljs$core$IFn$_invoke$arity$variadic(rdr,cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2(["Invalid unicode escape: \\u",ch,"."], 0));
});
cljs.tools.reader.impl.errors.throw_invalid = (function cljs$tools$reader$impl$errors$throw_invalid(rdr,kind,token){
return cljs.tools.reader.impl.errors.reader_error.cljs$core$IFn$_invoke$arity$variadic(rdr,cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2(["Invalid ",cljs.core.name(kind),": ",token,"."], 0));
});
cljs.tools.reader.impl.errors.throw_eof_at_start = (function cljs$tools$reader$impl$errors$throw_eof_at_start(rdr,kind){
return cljs.tools.reader.impl.errors.eof_error.cljs$core$IFn$_invoke$arity$variadic(rdr,cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2(["Unexpected EOF while reading start of ",cljs.core.name(kind),"."], 0));
});
cljs.tools.reader.impl.errors.throw_bad_char = (function cljs$tools$reader$impl$errors$throw_bad_char(rdr,kind,ch){
return cljs.tools.reader.impl.errors.reader_error.cljs$core$IFn$_invoke$arity$variadic(rdr,cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2(["Invalid character: ",ch," found while reading ",cljs.core.name(kind),"."], 0));
});
cljs.tools.reader.impl.errors.throw_eof_at_dispatch = (function cljs$tools$reader$impl$errors$throw_eof_at_dispatch(rdr){
return cljs.tools.reader.impl.errors.eof_error.cljs$core$IFn$_invoke$arity$variadic(rdr,cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2(["Unexpected EOF while reading dispatch character."], 0));
});
cljs.tools.reader.impl.errors.throw_unmatch_delimiter = (function cljs$tools$reader$impl$errors$throw_unmatch_delimiter(rdr,ch){
return cljs.tools.reader.impl.errors.reader_error.cljs$core$IFn$_invoke$arity$variadic(rdr,cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2(["Unmatched delimiter ",ch,"."], 0));
});
cljs.tools.reader.impl.errors.throw_eof_reading = (function cljs$tools$reader$impl$errors$throw_eof_reading(var_args){
var args__5775__auto__ = [];
var len__5769__auto___5328 = arguments.length;
var i__5770__auto___5329 = (0);
while(true){
if((i__5770__auto___5329 < len__5769__auto___5328)){
args__5775__auto__.push((arguments[i__5770__auto___5329]));
var G__5330 = (i__5770__auto___5329 + (1));
i__5770__auto___5329 = G__5330;
continue;
} else {
}
break;
}
var argseq__5776__auto__ = ((((2) < args__5775__auto__.length))?(new cljs.core.IndexedSeq(args__5775__auto__.slice((2)),(0),null)):null);
return cljs.tools.reader.impl.errors.throw_eof_reading.cljs$core$IFn$_invoke$arity$variadic((arguments[(0)]),(arguments[(1)]),argseq__5776__auto__);
});
(cljs.tools.reader.impl.errors.throw_eof_reading.cljs$core$IFn$_invoke$arity$variadic = (function (rdr,kind,start){
var init = (function (){var G__5327 = kind;
var G__5327__$1 = (((G__5327 instanceof cljs.core.Keyword))?G__5327.fqn:null);
switch (G__5327__$1) {
case "regex":
return "#\"";
break;
case "string":
return "\"";
break;
default:
throw (new Error(["No matching clause: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(G__5327__$1)].join('')));
}
})();
return cljs.tools.reader.impl.errors.eof_error.cljs$core$IFn$_invoke$arity$variadic(rdr,cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2(["Unexpected EOF reading ",cljs.core.name(kind)," starting ",cljs.core.apply.cljs$core$IFn$_invoke$arity$3(cljs.core.str,init,start),"."], 0));
}));
(cljs.tools.reader.impl.errors.throw_eof_reading.cljs$lang$maxFixedArity = (2));
/** @this {Function} */
(cljs.tools.reader.impl.errors.throw_eof_reading.cljs$lang$applyTo = (function (seq5324){
var G__5325 = cljs.core.first(seq5324);
var seq5324__$1 = cljs.core.next(seq5324);
var G__5326 = cljs.core.first(seq5324__$1);
var seq5324__$2 = cljs.core.next(seq5324__$1);
var self__5754__auto__ = this;
return self__5754__auto__.cljs$core$IFn$_invoke$arity$variadic(G__5325,G__5326,seq5324__$2);
}));
cljs.tools.reader.impl.errors.throw_invalid_unicode_char = (function cljs$tools$reader$impl$errors$throw_invalid_unicode_char(rdr,token){
return cljs.tools.reader.impl.errors.reader_error.cljs$core$IFn$_invoke$arity$variadic(rdr,cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2(["Invalid unicode character \\",token,"."], 0));
});
cljs.tools.reader.impl.errors.throw_invalid_unicode_digit_in_token = (function cljs$tools$reader$impl$errors$throw_invalid_unicode_digit_in_token(rdr,ch,token){
return cljs.tools.reader.impl.errors.illegal_arg_error.cljs$core$IFn$_invoke$arity$variadic(rdr,cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2(["Invalid digit ",ch," in unicode character \\",token,"."], 0));
});
cljs.tools.reader.impl.errors.throw_invalid_unicode_digit = (function cljs$tools$reader$impl$errors$throw_invalid_unicode_digit(rdr,ch){
return cljs.tools.reader.impl.errors.illegal_arg_error.cljs$core$IFn$_invoke$arity$variadic(rdr,cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2(["Invalid digit ",ch," in unicode character."], 0));
});
cljs.tools.reader.impl.errors.throw_invalid_unicode_len = (function cljs$tools$reader$impl$errors$throw_invalid_unicode_len(rdr,actual,expected){
return cljs.tools.reader.impl.errors.illegal_arg_error.cljs$core$IFn$_invoke$arity$variadic(rdr,cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2(["Invalid unicode literal. Unicode literals should be ",expected,"characters long. ","Value supplied is ",actual," characters long."], 0));
});
cljs.tools.reader.impl.errors.throw_invalid_character_literal = (function cljs$tools$reader$impl$errors$throw_invalid_character_literal(rdr,token){
return cljs.tools.reader.impl.errors.reader_error.cljs$core$IFn$_invoke$arity$variadic(rdr,cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2(["Invalid character literal \\u",token,"."], 0));
});
cljs.tools.reader.impl.errors.throw_invalid_octal_len = (function cljs$tools$reader$impl$errors$throw_invalid_octal_len(rdr,token){
return cljs.tools.reader.impl.errors.reader_error.cljs$core$IFn$_invoke$arity$variadic(rdr,cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2(["Invalid octal escape sequence in a character literal: ",token,". Octal escape sequences must be 3 or fewer digits."], 0));
});
cljs.tools.reader.impl.errors.throw_bad_octal_number = (function cljs$tools$reader$impl$errors$throw_bad_octal_number(rdr){
return cljs.tools.reader.impl.errors.reader_error.cljs$core$IFn$_invoke$arity$variadic(rdr,cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2(["Octal escape sequence must be in range [0, 377]."], 0));
});
cljs.tools.reader.impl.errors.throw_unsupported_character = (function cljs$tools$reader$impl$errors$throw_unsupported_character(rdr,token){
return cljs.tools.reader.impl.errors.reader_error.cljs$core$IFn$_invoke$arity$variadic(rdr,cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2(["Unsupported character: ",token,"."], 0));
});
cljs.tools.reader.impl.errors.throw_eof_in_character = (function cljs$tools$reader$impl$errors$throw_eof_in_character(rdr){
return cljs.tools.reader.impl.errors.eof_error.cljs$core$IFn$_invoke$arity$variadic(rdr,cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2(["Unexpected EOF while reading character."], 0));
});
cljs.tools.reader.impl.errors.throw_bad_escape_char = (function cljs$tools$reader$impl$errors$throw_bad_escape_char(rdr,ch){
return cljs.tools.reader.impl.errors.reader_error.cljs$core$IFn$_invoke$arity$variadic(rdr,cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2(["Unsupported escape character: \\",ch,"."], 0));
});
cljs.tools.reader.impl.errors.throw_single_colon = (function cljs$tools$reader$impl$errors$throw_single_colon(rdr){
return cljs.tools.reader.impl.errors.reader_error.cljs$core$IFn$_invoke$arity$variadic(rdr,cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2(["A single colon is not a valid keyword."], 0));
});
cljs.tools.reader.impl.errors.throw_bad_metadata = (function cljs$tools$reader$impl$errors$throw_bad_metadata(rdr,x){
return cljs.tools.reader.impl.errors.reader_error.cljs$core$IFn$_invoke$arity$variadic(rdr,cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2(["Metadata cannot be ",cljs.tools.reader.impl.inspect.inspect.cljs$core$IFn$_invoke$arity$1(x),". Metadata must be a Symbol, Keyword, String or Map."], 0));
});
cljs.tools.reader.impl.errors.throw_bad_metadata_target = (function cljs$tools$reader$impl$errors$throw_bad_metadata_target(rdr,target){
return cljs.tools.reader.impl.errors.reader_error.cljs$core$IFn$_invoke$arity$variadic(rdr,cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2(["Metadata can not be applied to ",cljs.tools.reader.impl.inspect.inspect.cljs$core$IFn$_invoke$arity$1(target),". ","Metadata can only be applied to IMetas."], 0));
});
cljs.tools.reader.impl.errors.throw_feature_not_keyword = (function cljs$tools$reader$impl$errors$throw_feature_not_keyword(rdr,feature){
return cljs.tools.reader.impl.errors.reader_error.cljs$core$IFn$_invoke$arity$variadic(rdr,cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2(["Feature cannot be ",cljs.tools.reader.impl.inspect.inspect.cljs$core$IFn$_invoke$arity$1(feature),". Features must be keywords."], 0));
});
cljs.tools.reader.impl.errors.throw_ns_map_no_map = (function cljs$tools$reader$impl$errors$throw_ns_map_no_map(rdr,ns_name){
return cljs.tools.reader.impl.errors.reader_error.cljs$core$IFn$_invoke$arity$variadic(rdr,cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2(["Namespaced map with namespace ",ns_name," does not specify a map."], 0));
});
cljs.tools.reader.impl.errors.throw_bad_ns = (function cljs$tools$reader$impl$errors$throw_bad_ns(rdr,ns_name){
return cljs.tools.reader.impl.errors.reader_error.cljs$core$IFn$_invoke$arity$variadic(rdr,cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2(["Invalid value used as namespace in namespaced map: ",ns_name,"."], 0));
});
cljs.tools.reader.impl.errors.throw_bad_reader_tag = (function cljs$tools$reader$impl$errors$throw_bad_reader_tag(rdr,tag){
return cljs.tools.reader.impl.errors.reader_error.cljs$core$IFn$_invoke$arity$variadic(rdr,cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2(["Invalid reader tag: ",cljs.tools.reader.impl.inspect.inspect.cljs$core$IFn$_invoke$arity$1(tag),". Reader tags must be symbols."], 0));
});
cljs.tools.reader.impl.errors.throw_unknown_reader_tag = (function cljs$tools$reader$impl$errors$throw_unknown_reader_tag(rdr,tag){
return cljs.tools.reader.impl.errors.reader_error.cljs$core$IFn$_invoke$arity$variadic(rdr,cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2(["No reader function for tag ",cljs.tools.reader.impl.inspect.inspect.cljs$core$IFn$_invoke$arity$1(tag),"."], 0));
});
cljs.tools.reader.impl.errors.duplicate_keys_error = (function cljs$tools$reader$impl$errors$duplicate_keys_error(msg,coll){
var duplicates = (function cljs$tools$reader$impl$errors$duplicate_keys_error_$_duplicates(seq){
var iter__5523__auto__ = (function cljs$tools$reader$impl$errors$duplicate_keys_error_$_duplicates_$_iter__5342(s__5343){
return (new cljs.core.LazySeq(null,(function (){
var s__5343__$1 = s__5343;
while(true){
var temp__4657__auto__ = cljs.core.seq(s__5343__$1);
if(temp__4657__auto__){
var s__5343__$2 = temp__4657__auto__;
if(cljs.core.chunked_seq_QMARK_(s__5343__$2)){
var c__5521__auto__ = cljs.core.chunk_first(s__5343__$2);
var size__5522__auto__ = cljs.core.count(c__5521__auto__);
var b__5345 = cljs.core.chunk_buffer(size__5522__auto__);
if((function (){var i__5344 = (0);
while(true){
if((i__5344 < size__5522__auto__)){
var vec__5346 = cljs.core._nth.cljs$core$IFn$_invoke$arity$2(c__5521__auto__,i__5344);
var id = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__5346,(0),null);
var freq = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__5346,(1),null);
if((freq > (1))){
cljs.core.chunk_append(b__5345,id);
var G__5352 = (i__5344 + (1));
i__5344 = G__5352;
continue;
} else {
var G__5353 = (i__5344 + (1));
i__5344 = G__5353;
continue;
}
} else {
return true;
}
break;
}
})()){
return cljs.core.chunk_cons(cljs.core.chunk(b__5345),cljs$tools$reader$impl$errors$duplicate_keys_error_$_duplicates_$_iter__5342(cljs.core.chunk_rest(s__5343__$2)));
} else {
return cljs.core.chunk_cons(cljs.core.chunk(b__5345),null);
}
} else {
var vec__5349 = cljs.core.first(s__5343__$2);
var id = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__5349,(0),null);
var freq = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__5349,(1),null);
if((freq > (1))){
return cljs.core.cons(id,cljs$tools$reader$impl$errors$duplicate_keys_error_$_duplicates_$_iter__5342(cljs.core.rest(s__5343__$2)));
} else {
var G__5354 = cljs.core.rest(s__5343__$2);
s__5343__$1 = G__5354;
continue;
}
}
} else {
return null;
}
break;
}
}),null,null));
});
return iter__5523__auto__(cljs.core.frequencies(seq));
});
var dups = duplicates(coll);
return cljs.core.apply.cljs$core$IFn$_invoke$arity$5(cljs.core.str,msg,(((cljs.core.count(dups) > (1)))?"s":null),": ",cljs.core.interpose.cljs$core$IFn$_invoke$arity$2(", ",dups));
});
cljs.tools.reader.impl.errors.throw_dup_keys = (function cljs$tools$reader$impl$errors$throw_dup_keys(rdr,kind,ks){
return cljs.tools.reader.impl.errors.reader_error.cljs$core$IFn$_invoke$arity$variadic(rdr,cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([cljs.tools.reader.impl.errors.duplicate_keys_error([clojure.string.capitalize(cljs.core.name(kind))," literal contains duplicate key"].join(''),ks)], 0));
});
cljs.tools.reader.impl.errors.throw_eof_error = (function cljs$tools$reader$impl$errors$throw_eof_error(rdr,line){
if(cljs.core.truth_(line)){
return cljs.tools.reader.impl.errors.eof_error.cljs$core$IFn$_invoke$arity$variadic(rdr,cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2(["EOF while reading, starting at line ",line,"."], 0));
} else {
return cljs.tools.reader.impl.errors.eof_error.cljs$core$IFn$_invoke$arity$variadic(rdr,cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2(["EOF while reading."], 0));
}
});
+90
View File
@@ -0,0 +1,90 @@
;; Copyright (c) Russ Olsen, Nicola Mometto, Rich Hickey & contributors.
;; The use and distribution terms for this software are covered by the
;; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
;; which can be found in the file epl-v10.html at the root of this distribution.
;; By using this software in any fashion, you are agreeing to be bound by
;; the terms of this license.
;; You must not remove this notice, or any other, from this software.
(ns cljs.tools.reader.impl.inspect)
(declare inspect*)
(defn- inspect*-col [truncate col start end]
(let [n (count col)
l (if truncate 0 (min 10 n))
elements (map (partial inspect* true) (take l col))
content (apply str (interpose " " elements))
suffix (if (< l n) "...")]
(str start content suffix end)))
(defn- dispatch-inspect
[_ x]
(cond
(nil? x) :nil
(string? x) :string
(keyword? x) :strable
(number? x) :strable
(symbol? x) :strable
(vector? x) :vector
(list? x) :list
(map? x) :map
(set? x) :set
(= x true) :strable
(= x false) :strable
:default (type x)))
(defmulti inspect* dispatch-inspect)
(defmethod inspect* :string [truncate ^String x]
(let [n (if truncate 5 20)
suffix (if (> (.-length x) n) "...\"" "\"")]
(str
\"
(.substring ^String x 0 (min n (.-length x)))
suffix)))
(defmethod inspect* :strable [truncate x] (str x))
(defmethod inspect* cljs.core/IndexedSeq [truncate x]
"<indexed seq>")
(defmethod inspect* cljs.core/PersistentArrayMapSeq [truncate x]
"<map seq>")
(defmethod inspect* cljs.core/NodeSeq [truncate x]
"<map seq>")
(defmethod inspect* cljs.core/Cons [truncate x] "<cons>")
(defmethod inspect* cljs.core/LazySeq [truncate x] "<lazy seq>")
(defmethod inspect* :nil [_ _] "nil")
(defmethod inspect* :list [truncate col]
(inspect*-col truncate col \( \)))
(defmethod inspect* :map [truncate m]
(let [len (count m)
n-shown (if truncate 0 len)
contents (apply concat (take n-shown m))
suffix (if (> len n-shown) "...}" \})]
(inspect*-col truncate contents \{ suffix)))
(defmethod inspect* :set [truncate col]
(inspect*-col truncate col "#{" \}))
(defmethod inspect* :vector [truncate col]
(inspect*-col truncate col \[ \]))
(defmethod inspect* :default [truncate x]
(pr-str (type x)))
(defn inspect
"Return a string description of the value supplied.
May be the a string version of the value itself (e.g. \"true\")
or it may be a description (e.g. \"an instance of Foo\").
If truncate is true then return a very terse version of
the inspection."
([x] (inspect* false x))
([truncate x] (inspect* truncate x)))
+157
View File
@@ -0,0 +1,157 @@
// Compiled by ClojureScript 1.11.60 {:static-fns true, :optimize-constants true, :optimizations :advanced}
goog.provide('cljs.tools.reader.impl.inspect');
goog.require('cljs.core');
goog.require('cljs.core.constants');
cljs.tools.reader.impl.inspect.inspect_STAR__col = (function cljs$tools$reader$impl$inspect$inspect_STAR__col(truncate,col,start,end){
var n = cljs.core.count(col);
var l = (cljs.core.truth_(truncate)?(0):(function (){var x__5133__auto__ = (10);
var y__5134__auto__ = n;
return ((x__5133__auto__ < y__5134__auto__) ? x__5133__auto__ : y__5134__auto__);
})());
var elements = cljs.core.map.cljs$core$IFn$_invoke$arity$2(cljs.core.partial.cljs$core$IFn$_invoke$arity$2(cljs.tools.reader.impl.inspect.inspect_STAR_,true),cljs.core.take.cljs$core$IFn$_invoke$arity$2(l,col));
var content = cljs.core.apply.cljs$core$IFn$_invoke$arity$2(cljs.core.str,cljs.core.interpose.cljs$core$IFn$_invoke$arity$2(" ",elements));
var suffix = (((l < n))?"...":null);
return [cljs.core.str.cljs$core$IFn$_invoke$arity$1(start),cljs.core.str.cljs$core$IFn$_invoke$arity$1(content),suffix,cljs.core.str.cljs$core$IFn$_invoke$arity$1(end)].join('');
});
cljs.tools.reader.impl.inspect.dispatch_inspect = (function cljs$tools$reader$impl$inspect$dispatch_inspect(_,x){
if((x == null)){
return cljs.core.cst$kw$nil;
} else {
if(typeof x === 'string'){
return cljs.core.cst$kw$string;
} else {
if((x instanceof cljs.core.Keyword)){
return cljs.core.cst$kw$strable;
} else {
if(typeof x === 'number'){
return cljs.core.cst$kw$strable;
} else {
if((x instanceof cljs.core.Symbol)){
return cljs.core.cst$kw$strable;
} else {
if(cljs.core.vector_QMARK_(x)){
return cljs.core.cst$kw$vector;
} else {
if(cljs.core.list_QMARK_(x)){
return cljs.core.cst$kw$list;
} else {
if(cljs.core.map_QMARK_(x)){
return cljs.core.cst$kw$map;
} else {
if(cljs.core.set_QMARK_(x)){
return cljs.core.cst$kw$set;
} else {
if(cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(x,true)){
return cljs.core.cst$kw$strable;
} else {
if(cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(x,false)){
return cljs.core.cst$kw$strable;
} else {
return cljs.core.type(x);
}
}
}
}
}
}
}
}
}
}
}
});
if((typeof cljs !== 'undefined') && (typeof cljs.tools !== 'undefined') && (typeof cljs.tools.reader !== 'undefined') && (typeof cljs.tools.reader.impl !== 'undefined') && (typeof cljs.tools.reader.impl.inspect !== 'undefined') && (typeof cljs.tools.reader.impl.inspect.inspect_STAR_ !== 'undefined')){
} else {
cljs.tools.reader.impl.inspect.inspect_STAR_ = (function (){var method_table__5642__auto__ = cljs.core.atom.cljs$core$IFn$_invoke$arity$1(cljs.core.PersistentArrayMap.EMPTY);
var prefer_table__5643__auto__ = cljs.core.atom.cljs$core$IFn$_invoke$arity$1(cljs.core.PersistentArrayMap.EMPTY);
var method_cache__5644__auto__ = cljs.core.atom.cljs$core$IFn$_invoke$arity$1(cljs.core.PersistentArrayMap.EMPTY);
var cached_hierarchy__5645__auto__ = cljs.core.atom.cljs$core$IFn$_invoke$arity$1(cljs.core.PersistentArrayMap.EMPTY);
var hierarchy__5646__auto__ = cljs.core.get.cljs$core$IFn$_invoke$arity$3(cljs.core.PersistentArrayMap.EMPTY,cljs.core.cst$kw$hierarchy,(function (){var fexpr__5294 = cljs.core.get_global_hierarchy;
return (fexpr__5294.cljs$core$IFn$_invoke$arity$0 ? fexpr__5294.cljs$core$IFn$_invoke$arity$0() : fexpr__5294.call(null));
})());
return (new cljs.core.MultiFn(cljs.core.symbol.cljs$core$IFn$_invoke$arity$2("cljs.tools.reader.impl.inspect","inspect*"),cljs.tools.reader.impl.inspect.dispatch_inspect,cljs.core.cst$kw$default,hierarchy__5646__auto__,method_table__5642__auto__,prefer_table__5643__auto__,method_cache__5644__auto__,cached_hierarchy__5645__auto__));
})();
}
cljs.tools.reader.impl.inspect.inspect_STAR_.cljs$core$IMultiFn$_add_method$arity$3(null,cljs.core.cst$kw$string,(function (truncate,x){
var n = (cljs.core.truth_(truncate)?(5):(20));
var suffix = (((x.length > n))?"...\"":"\"");
return ["\"",cljs.core.str.cljs$core$IFn$_invoke$arity$1(x.substring((0),(function (){var x__5133__auto__ = n;
var y__5134__auto__ = x.length;
return ((x__5133__auto__ < y__5134__auto__) ? x__5133__auto__ : y__5134__auto__);
})())),suffix].join('');
}));
cljs.tools.reader.impl.inspect.inspect_STAR_.cljs$core$IMultiFn$_add_method$arity$3(null,cljs.core.cst$kw$strable,(function (truncate,x){
return cljs.core.str.cljs$core$IFn$_invoke$arity$1(x);
}));
cljs.tools.reader.impl.inspect.inspect_STAR_.cljs$core$IMultiFn$_add_method$arity$3(null,cljs.core.IndexedSeq,(function (truncate,x){
return "<indexed seq>";
}));
cljs.tools.reader.impl.inspect.inspect_STAR_.cljs$core$IMultiFn$_add_method$arity$3(null,cljs.core.PersistentArrayMapSeq,(function (truncate,x){
return "<map seq>";
}));
cljs.tools.reader.impl.inspect.inspect_STAR_.cljs$core$IMultiFn$_add_method$arity$3(null,cljs.core.NodeSeq,(function (truncate,x){
return "<map seq>";
}));
cljs.tools.reader.impl.inspect.inspect_STAR_.cljs$core$IMultiFn$_add_method$arity$3(null,cljs.core.Cons,(function (truncate,x){
return "<cons>";
}));
cljs.tools.reader.impl.inspect.inspect_STAR_.cljs$core$IMultiFn$_add_method$arity$3(null,cljs.core.LazySeq,(function (truncate,x){
return "<lazy seq>";
}));
cljs.tools.reader.impl.inspect.inspect_STAR_.cljs$core$IMultiFn$_add_method$arity$3(null,cljs.core.cst$kw$nil,(function (_,___$1){
return "nil";
}));
cljs.tools.reader.impl.inspect.inspect_STAR_.cljs$core$IMultiFn$_add_method$arity$3(null,cljs.core.cst$kw$list,(function (truncate,col){
return cljs.tools.reader.impl.inspect.inspect_STAR__col(truncate,col,"(",")");
}));
cljs.tools.reader.impl.inspect.inspect_STAR_.cljs$core$IMultiFn$_add_method$arity$3(null,cljs.core.cst$kw$map,(function (truncate,m){
var len = cljs.core.count(m);
var n_shown = (cljs.core.truth_(truncate)?(0):len);
var contents = cljs.core.apply.cljs$core$IFn$_invoke$arity$2(cljs.core.concat,cljs.core.take.cljs$core$IFn$_invoke$arity$2(n_shown,m));
var suffix = (((len > n_shown))?"...}":"}");
return cljs.tools.reader.impl.inspect.inspect_STAR__col(truncate,contents,"{",suffix);
}));
cljs.tools.reader.impl.inspect.inspect_STAR_.cljs$core$IMultiFn$_add_method$arity$3(null,cljs.core.cst$kw$set,(function (truncate,col){
return cljs.tools.reader.impl.inspect.inspect_STAR__col(truncate,col,"#{","}");
}));
cljs.tools.reader.impl.inspect.inspect_STAR_.cljs$core$IMultiFn$_add_method$arity$3(null,cljs.core.cst$kw$vector,(function (truncate,col){
return cljs.tools.reader.impl.inspect.inspect_STAR__col(truncate,col,"[","]");
}));
cljs.tools.reader.impl.inspect.inspect_STAR_.cljs$core$IMultiFn$_add_method$arity$3(null,cljs.core.cst$kw$default,(function (truncate,x){
return cljs.core.pr_str.cljs$core$IFn$_invoke$arity$variadic(cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([cljs.core.type(x)], 0));
}));
/**
* Return a string description of the value supplied.
* May be the a string version of the value itself (e.g. "true")
* or it may be a description (e.g. "an instance of Foo").
* If truncate is true then return a very terse version of
* the inspection.
*/
cljs.tools.reader.impl.inspect.inspect = (function cljs$tools$reader$impl$inspect$inspect(var_args){
var G__5296 = arguments.length;
switch (G__5296) {
case 1:
return cljs.tools.reader.impl.inspect.inspect.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));
break;
case 2:
return cljs.tools.reader.impl.inspect.inspect.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));
break;
default:
throw (new Error(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));
}
});
(cljs.tools.reader.impl.inspect.inspect.cljs$core$IFn$_invoke$arity$1 = (function (x){
return (cljs.tools.reader.impl.inspect.inspect_STAR_.cljs$core$IFn$_invoke$arity$2 ? cljs.tools.reader.impl.inspect.inspect_STAR_.cljs$core$IFn$_invoke$arity$2(false,x) : cljs.tools.reader.impl.inspect.inspect_STAR_.call(null,false,x));
}));
(cljs.tools.reader.impl.inspect.inspect.cljs$core$IFn$_invoke$arity$2 = (function (truncate,x){
return (cljs.tools.reader.impl.inspect.inspect_STAR_.cljs$core$IFn$_invoke$arity$2 ? cljs.tools.reader.impl.inspect.inspect_STAR_.cljs$core$IFn$_invoke$arity$2(truncate,x) : cljs.tools.reader.impl.inspect.inspect_STAR_.call(null,truncate,x));
}));
(cljs.tools.reader.impl.inspect.inspect.cljs$lang$maxFixedArity = 2);
+103
View File
@@ -0,0 +1,103 @@
;; Copyright (c) Nicola Mometto, Rich Hickey & contributors.
;; The use and distribution terms for this software are covered by the
;; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
;; which can be found in the file epl-v10.html at the root of this distribution.
;; By using this software in any fashion, you are agreeing to be bound by
;; the terms of this license.
;; You must not remove this notice, or any other, from this software.
(ns cljs.tools.reader.impl.utils
(:refer-clojure :exclude [char])
(:require
[clojure.string :as string]
[goog.string :as gstring]))
(defn char [x]
(when-not (nil? x)
(cljs.core/char x)))
(defn ^boolean ex-info? [ex]
(instance? cljs.core.ExceptionInfo ex))
(defrecord ReaderConditional [splicing? form])
(defn ^boolean reader-conditional?
"Return true if the value is the data representation of a reader conditional"
[value]
(instance? ReaderConditional value))
(defn reader-conditional
"Construct a data representation of a reader conditional.
If true, splicing? indicates read-cond-splicing."
[form splicing?]
(ReaderConditional. splicing? form))
(extend-protocol IPrintWithWriter
ReaderConditional
(-pr-writer [coll writer opts]
(-write writer (str "#?" (when (:splicing? coll) "@")))
(pr-writer (:form coll) writer opts)))
(def ws-rx #"[\s]")
(defn ^boolean whitespace?
"Checks whether a given character is whitespace"
[ch]
(when-not (nil? ch)
(if (identical? ch \,)
true
(.test ws-rx ch))))
(defn ^boolean numeric?
"Checks whether a given character is numeric"
[ch]
(when-not (nil? ch)
(gstring/isNumeric ch)))
(defn ^boolean newline?
"Checks whether the character is a newline"
[c]
(or (identical? \newline c)
(identical? "\n" c)
(nil? c)))
(defn desugar-meta
"Resolves syntactical sugar in metadata" ;; could be combined with some other desugar?
[f]
(cond
(keyword? f) {f true}
(symbol? f) {:tag f}
(string? f) {:tag f}
:else f))
(def last-id (atom 0))
(defn next-id
[]
(swap! last-id inc))
(defn namespace-keys [ns keys]
(for [key keys]
(if (or (symbol? key)
(keyword? key))
(let [[key-ns key-name] ((juxt namespace name) key)
->key (if (symbol? key) symbol keyword)]
(cond
(nil? key-ns)
(->key ns key-name)
(= "_" key-ns)
(->key key-name)
:else
key))
key)))
(defn second' [[a b]]
(when-not a b))
(defn char-code [ch base]
(let [code (js/parseInt ch base)]
(if (js/isNaN code)
-1
code)))
+413
View File
@@ -0,0 +1,413 @@
// Compiled by ClojureScript 1.11.60 {:static-fns true, :optimize-constants true, :optimizations :advanced}
goog.provide('cljs.tools.reader.impl.utils');
goog.require('cljs.core');
goog.require('cljs.core.constants');
goog.require('clojure.string');
goog.require('goog.string');
cljs.tools.reader.impl.utils.char$ = (function cljs$tools$reader$impl$utils$char(x){
if((x == null)){
return null;
} else {
return cljs.core.char$(x);
}
});
cljs.tools.reader.impl.utils.ex_info_QMARK_ = (function cljs$tools$reader$impl$utils$ex_info_QMARK_(ex){
return (ex instanceof cljs.core.ExceptionInfo);
});
/**
* @constructor
* @implements {cljs.core.IRecord}
* @implements {cljs.core.IKVReduce}
* @implements {cljs.core.IEquiv}
* @implements {cljs.core.IHash}
* @implements {cljs.core.ICollection}
* @implements {cljs.core.ICounted}
* @implements {cljs.core.ISeqable}
* @implements {cljs.core.IMeta}
* @implements {cljs.core.ICloneable}
* @implements {cljs.core.IPrintWithWriter}
* @implements {cljs.core.IIterable}
* @implements {cljs.core.IWithMeta}
* @implements {cljs.core.IAssociative}
* @implements {cljs.core.IMap}
* @implements {cljs.core.ILookup}
*/
cljs.tools.reader.impl.utils.ReaderConditional = (function (splicing_QMARK_,form,__meta,__extmap,__hash){
this.splicing_QMARK_ = splicing_QMARK_;
this.form = form;
this.__meta = __meta;
this.__extmap = __extmap;
this.__hash = __hash;
this.cljs$lang$protocol_mask$partition0$ = 2230716170;
this.cljs$lang$protocol_mask$partition1$ = 139264;
});
(cljs.tools.reader.impl.utils.ReaderConditional.prototype.cljs$core$ILookup$_lookup$arity$2 = (function (this__5343__auto__,k__5344__auto__){
var self__ = this;
var this__5343__auto____$1 = this;
return this__5343__auto____$1.cljs$core$ILookup$_lookup$arity$3(null,k__5344__auto__,null);
}));
(cljs.tools.reader.impl.utils.ReaderConditional.prototype.cljs$core$ILookup$_lookup$arity$3 = (function (this__5345__auto__,k5233,else__5346__auto__){
var self__ = this;
var this__5345__auto____$1 = this;
var G__5237 = k5233;
var G__5237__$1 = (((G__5237 instanceof cljs.core.Keyword))?G__5237.fqn:null);
switch (G__5237__$1) {
case "splicing?":
return self__.splicing_QMARK_;
break;
case "form":
return self__.form;
break;
default:
return cljs.core.get.cljs$core$IFn$_invoke$arity$3(self__.__extmap,k5233,else__5346__auto__);
}
}));
(cljs.tools.reader.impl.utils.ReaderConditional.prototype.cljs$core$IKVReduce$_kv_reduce$arity$3 = (function (this__5363__auto__,f__5364__auto__,init__5365__auto__){
var self__ = this;
var this__5363__auto____$1 = this;
return cljs.core.reduce.cljs$core$IFn$_invoke$arity$3((function (ret__5366__auto__,p__5238){
var vec__5239 = p__5238;
var k__5367__auto__ = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__5239,(0),null);
var v__5368__auto__ = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__5239,(1),null);
return (f__5364__auto__.cljs$core$IFn$_invoke$arity$3 ? f__5364__auto__.cljs$core$IFn$_invoke$arity$3(ret__5366__auto__,k__5367__auto__,v__5368__auto__) : f__5364__auto__.call(null,ret__5366__auto__,k__5367__auto__,v__5368__auto__));
}),init__5365__auto__,this__5363__auto____$1);
}));
(cljs.tools.reader.impl.utils.ReaderConditional.prototype.cljs$core$IPrintWithWriter$_pr_writer$arity$3 = (function (this__5358__auto__,writer__5359__auto__,opts__5360__auto__){
var self__ = this;
var this__5358__auto____$1 = this;
var pr_pair__5361__auto__ = (function (keyval__5362__auto__){
return cljs.core.pr_sequential_writer(writer__5359__auto__,cljs.core.pr_writer,""," ","",opts__5360__auto__,keyval__5362__auto__);
});
return cljs.core.pr_sequential_writer(writer__5359__auto__,pr_pair__5361__auto__,"#cljs.tools.reader.impl.utils.ReaderConditional{",", ","}",opts__5360__auto__,cljs.core.concat.cljs$core$IFn$_invoke$arity$2(new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [(new cljs.core.PersistentVector(null,2,(5),cljs.core.PersistentVector.EMPTY_NODE,[cljs.core.cst$kw$splicing_QMARK_,self__.splicing_QMARK_],null)),(new cljs.core.PersistentVector(null,2,(5),cljs.core.PersistentVector.EMPTY_NODE,[cljs.core.cst$kw$form,self__.form],null))], null),self__.__extmap));
}));
(cljs.tools.reader.impl.utils.ReaderConditional.prototype.cljs$core$IIterable$_iterator$arity$1 = (function (G__5232){
var self__ = this;
var G__5232__$1 = this;
return (new cljs.core.RecordIter((0),G__5232__$1,2,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.cst$kw$splicing_QMARK_,cljs.core.cst$kw$form], null),(cljs.core.truth_(self__.__extmap)?cljs.core._iterator(self__.__extmap):cljs.core.nil_iter())));
}));
(cljs.tools.reader.impl.utils.ReaderConditional.prototype.cljs$core$IMeta$_meta$arity$1 = (function (this__5341__auto__){
var self__ = this;
var this__5341__auto____$1 = this;
return self__.__meta;
}));
(cljs.tools.reader.impl.utils.ReaderConditional.prototype.cljs$core$ICloneable$_clone$arity$1 = (function (this__5338__auto__){
var self__ = this;
var this__5338__auto____$1 = this;
return (new cljs.tools.reader.impl.utils.ReaderConditional(self__.splicing_QMARK_,self__.form,self__.__meta,self__.__extmap,self__.__hash));
}));
(cljs.tools.reader.impl.utils.ReaderConditional.prototype.cljs$core$ICounted$_count$arity$1 = (function (this__5347__auto__){
var self__ = this;
var this__5347__auto____$1 = this;
return (2 + cljs.core.count(self__.__extmap));
}));
(cljs.tools.reader.impl.utils.ReaderConditional.prototype.cljs$core$IHash$_hash$arity$1 = (function (this__5339__auto__){
var self__ = this;
var this__5339__auto____$1 = this;
var h__5154__auto__ = self__.__hash;
if((!((h__5154__auto__ == null)))){
return h__5154__auto__;
} else {
var h__5154__auto____$1 = (function (){var fexpr__5242 = (function (coll__5340__auto__){
return (-209062840 ^ cljs.core.hash_unordered_coll(coll__5340__auto__));
});
return fexpr__5242(this__5339__auto____$1);
})();
(self__.__hash = h__5154__auto____$1);
return h__5154__auto____$1;
}
}));
(cljs.tools.reader.impl.utils.ReaderConditional.prototype.cljs$core$IEquiv$_equiv$arity$2 = (function (this5234,other5235){
var self__ = this;
var this5234__$1 = this;
return (((!((other5235 == null)))) && ((((this5234__$1.constructor === other5235.constructor)) && (((cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(this5234__$1.splicing_QMARK_,other5235.splicing_QMARK_)) && (((cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(this5234__$1.form,other5235.form)) && (cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(this5234__$1.__extmap,other5235.__extmap)))))))));
}));
(cljs.tools.reader.impl.utils.ReaderConditional.prototype.cljs$core$IMap$_dissoc$arity$2 = (function (this__5353__auto__,k__5354__auto__){
var self__ = this;
var this__5353__auto____$1 = this;
if(cljs.core.contains_QMARK_(new cljs.core.PersistentHashSet(null, new cljs.core.PersistentArrayMap(null, 2, [cljs.core.cst$kw$splicing_QMARK_,null,cljs.core.cst$kw$form,null], null), null),k__5354__auto__)){
return cljs.core.dissoc.cljs$core$IFn$_invoke$arity$2(cljs.core._with_meta(cljs.core.into.cljs$core$IFn$_invoke$arity$2(cljs.core.PersistentArrayMap.EMPTY,this__5353__auto____$1),self__.__meta),k__5354__auto__);
} else {
return (new cljs.tools.reader.impl.utils.ReaderConditional(self__.splicing_QMARK_,self__.form,self__.__meta,cljs.core.not_empty(cljs.core.dissoc.cljs$core$IFn$_invoke$arity$2(self__.__extmap,k__5354__auto__)),null));
}
}));
(cljs.tools.reader.impl.utils.ReaderConditional.prototype.cljs$core$IAssociative$_contains_key_QMARK_$arity$2 = (function (this__5350__auto__,k5233){
var self__ = this;
var this__5350__auto____$1 = this;
var G__5243 = k5233;
var G__5243__$1 = (((G__5243 instanceof cljs.core.Keyword))?G__5243.fqn:null);
switch (G__5243__$1) {
case "splicing?":
case "form":
return true;
break;
default:
return cljs.core.contains_QMARK_(self__.__extmap,k5233);
}
}));
(cljs.tools.reader.impl.utils.ReaderConditional.prototype.cljs$core$IAssociative$_assoc$arity$3 = (function (this__5351__auto__,k__5352__auto__,G__5232){
var self__ = this;
var this__5351__auto____$1 = this;
var pred__5244 = cljs.core.keyword_identical_QMARK_;
var expr__5245 = k__5352__auto__;
if(cljs.core.truth_((function (){var G__5247 = cljs.core.cst$kw$splicing_QMARK_;
var G__5248 = expr__5245;
return (pred__5244.cljs$core$IFn$_invoke$arity$2 ? pred__5244.cljs$core$IFn$_invoke$arity$2(G__5247,G__5248) : pred__5244.call(null,G__5247,G__5248));
})())){
return (new cljs.tools.reader.impl.utils.ReaderConditional(G__5232,self__.form,self__.__meta,self__.__extmap,null));
} else {
if(cljs.core.truth_((function (){var G__5249 = cljs.core.cst$kw$form;
var G__5250 = expr__5245;
return (pred__5244.cljs$core$IFn$_invoke$arity$2 ? pred__5244.cljs$core$IFn$_invoke$arity$2(G__5249,G__5250) : pred__5244.call(null,G__5249,G__5250));
})())){
return (new cljs.tools.reader.impl.utils.ReaderConditional(self__.splicing_QMARK_,G__5232,self__.__meta,self__.__extmap,null));
} else {
return (new cljs.tools.reader.impl.utils.ReaderConditional(self__.splicing_QMARK_,self__.form,self__.__meta,cljs.core.assoc.cljs$core$IFn$_invoke$arity$3(self__.__extmap,k__5352__auto__,G__5232),null));
}
}
}));
(cljs.tools.reader.impl.utils.ReaderConditional.prototype.cljs$core$ISeqable$_seq$arity$1 = (function (this__5356__auto__){
var self__ = this;
var this__5356__auto____$1 = this;
return cljs.core.seq(cljs.core.concat.cljs$core$IFn$_invoke$arity$2(new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [(new cljs.core.MapEntry(cljs.core.cst$kw$splicing_QMARK_,self__.splicing_QMARK_,null)),(new cljs.core.MapEntry(cljs.core.cst$kw$form,self__.form,null))], null),self__.__extmap));
}));
(cljs.tools.reader.impl.utils.ReaderConditional.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (this__5342__auto__,G__5232){
var self__ = this;
var this__5342__auto____$1 = this;
return (new cljs.tools.reader.impl.utils.ReaderConditional(self__.splicing_QMARK_,self__.form,G__5232,self__.__extmap,self__.__hash));
}));
(cljs.tools.reader.impl.utils.ReaderConditional.prototype.cljs$core$ICollection$_conj$arity$2 = (function (this__5348__auto__,entry__5349__auto__){
var self__ = this;
var this__5348__auto____$1 = this;
if(cljs.core.vector_QMARK_(entry__5349__auto__)){
return this__5348__auto____$1.cljs$core$IAssociative$_assoc$arity$3(null,cljs.core._nth.cljs$core$IFn$_invoke$arity$2(entry__5349__auto__,(0)),cljs.core._nth.cljs$core$IFn$_invoke$arity$2(entry__5349__auto__,(1)));
} else {
return cljs.core.reduce.cljs$core$IFn$_invoke$arity$3(cljs.core._conj,this__5348__auto____$1,entry__5349__auto__);
}
}));
(cljs.tools.reader.impl.utils.ReaderConditional.getBasis = (function (){
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.cst$sym$splicing_QMARK_,cljs.core.cst$sym$form], null);
}));
(cljs.tools.reader.impl.utils.ReaderConditional.cljs$lang$type = true);
(cljs.tools.reader.impl.utils.ReaderConditional.cljs$lang$ctorPrSeq = (function (this__5389__auto__){
return (new cljs.core.List(null,"cljs.tools.reader.impl.utils/ReaderConditional",null,(1),null));
}));
(cljs.tools.reader.impl.utils.ReaderConditional.cljs$lang$ctorPrWriter = (function (this__5389__auto__,writer__5390__auto__){
return cljs.core._write(writer__5390__auto__,"cljs.tools.reader.impl.utils/ReaderConditional");
}));
/**
* Positional factory function for cljs.tools.reader.impl.utils/ReaderConditional.
*/
cljs.tools.reader.impl.utils.__GT_ReaderConditional = (function cljs$tools$reader$impl$utils$__GT_ReaderConditional(splicing_QMARK_,form){
return (new cljs.tools.reader.impl.utils.ReaderConditional(splicing_QMARK_,form,null,null,null));
});
/**
* Factory function for cljs.tools.reader.impl.utils/ReaderConditional, taking a map of keywords to field values.
*/
cljs.tools.reader.impl.utils.map__GT_ReaderConditional = (function cljs$tools$reader$impl$utils$map__GT_ReaderConditional(G__5236){
var extmap__5385__auto__ = (function (){var G__5251 = cljs.core.dissoc.cljs$core$IFn$_invoke$arity$variadic(G__5236,cljs.core.cst$kw$splicing_QMARK_,cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([cljs.core.cst$kw$form], 0));
if(cljs.core.record_QMARK_(G__5236)){
return cljs.core.into.cljs$core$IFn$_invoke$arity$2(cljs.core.PersistentArrayMap.EMPTY,G__5251);
} else {
return G__5251;
}
})();
return (new cljs.tools.reader.impl.utils.ReaderConditional(cljs.core.cst$kw$splicing_QMARK_.cljs$core$IFn$_invoke$arity$1(G__5236),cljs.core.cst$kw$form.cljs$core$IFn$_invoke$arity$1(G__5236),null,cljs.core.not_empty(extmap__5385__auto__),null));
});
/**
* Return true if the value is the data representation of a reader conditional
*/
cljs.tools.reader.impl.utils.reader_conditional_QMARK_ = (function cljs$tools$reader$impl$utils$reader_conditional_QMARK_(value){
return (value instanceof cljs.tools.reader.impl.utils.ReaderConditional);
});
/**
* Construct a data representation of a reader conditional.
* If true, splicing? indicates read-cond-splicing.
*/
cljs.tools.reader.impl.utils.reader_conditional = (function cljs$tools$reader$impl$utils$reader_conditional(form,splicing_QMARK_){
return (new cljs.tools.reader.impl.utils.ReaderConditional(splicing_QMARK_,form,null,null,null));
});
(cljs.tools.reader.impl.utils.ReaderConditional.prototype.cljs$core$IPrintWithWriter$ = cljs.core.PROTOCOL_SENTINEL);
(cljs.tools.reader.impl.utils.ReaderConditional.prototype.cljs$core$IPrintWithWriter$_pr_writer$arity$3 = (function (coll,writer,opts){
var coll__$1 = this;
cljs.core._write(writer,["#?",(cljs.core.truth_(coll__$1.splicing_QMARK_)?"@":null)].join(''));
return cljs.core.pr_writer(coll__$1.form,writer,opts);
}));
cljs.tools.reader.impl.utils.ws_rx = /[\s]/;
/**
* Checks whether a given character is whitespace
*/
cljs.tools.reader.impl.utils.whitespace_QMARK_ = (function cljs$tools$reader$impl$utils$whitespace_QMARK_(ch){
if((ch == null)){
return null;
} else {
if((ch === ",")){
return true;
} else {
return cljs.tools.reader.impl.utils.ws_rx.test(ch);
}
}
});
/**
* Checks whether a given character is numeric
*/
cljs.tools.reader.impl.utils.numeric_QMARK_ = (function cljs$tools$reader$impl$utils$numeric_QMARK_(ch){
if((ch == null)){
return null;
} else {
return goog.string.isNumeric(ch);
}
});
/**
* Checks whether the character is a newline
*/
cljs.tools.reader.impl.utils.newline_QMARK_ = (function cljs$tools$reader$impl$utils$newline_QMARK_(c){
return ((("\n" === c)) || (((("\n" === c)) || ((c == null)))));
});
/**
* Resolves syntactical sugar in metadata
*/
cljs.tools.reader.impl.utils.desugar_meta = (function cljs$tools$reader$impl$utils$desugar_meta(f){
if((f instanceof cljs.core.Keyword)){
return cljs.core.PersistentArrayMap.createAsIfByAssoc([f,true]);
} else {
if((f instanceof cljs.core.Symbol)){
return new cljs.core.PersistentArrayMap(null, 1, [cljs.core.cst$kw$tag,f], null);
} else {
if(typeof f === 'string'){
return new cljs.core.PersistentArrayMap(null, 1, [cljs.core.cst$kw$tag,f], null);
} else {
return f;
}
}
}
});
cljs.tools.reader.impl.utils.last_id = cljs.core.atom.cljs$core$IFn$_invoke$arity$1((0));
cljs.tools.reader.impl.utils.next_id = (function cljs$tools$reader$impl$utils$next_id(){
return cljs.core.swap_BANG_.cljs$core$IFn$_invoke$arity$2(cljs.tools.reader.impl.utils.last_id,cljs.core.inc);
});
cljs.tools.reader.impl.utils.namespace_keys = (function cljs$tools$reader$impl$utils$namespace_keys(ns,keys){
var iter__5523__auto__ = (function cljs$tools$reader$impl$utils$namespace_keys_$_iter__5254(s__5255){
return (new cljs.core.LazySeq(null,(function (){
var s__5255__$1 = s__5255;
while(true){
var temp__4657__auto__ = cljs.core.seq(s__5255__$1);
if(temp__4657__auto__){
var s__5255__$2 = temp__4657__auto__;
if(cljs.core.chunked_seq_QMARK_(s__5255__$2)){
var c__5521__auto__ = cljs.core.chunk_first(s__5255__$2);
var size__5522__auto__ = cljs.core.count(c__5521__auto__);
var b__5257 = cljs.core.chunk_buffer(size__5522__auto__);
if((function (){var i__5256 = (0);
while(true){
if((i__5256 < size__5522__auto__)){
var key = cljs.core._nth.cljs$core$IFn$_invoke$arity$2(c__5521__auto__,i__5256);
cljs.core.chunk_append(b__5257,(((((key instanceof cljs.core.Symbol)) || ((key instanceof cljs.core.Keyword))))?(function (){var vec__5258 = (function (){var fexpr__5261 = cljs.core.juxt.cljs$core$IFn$_invoke$arity$2(cljs.core.namespace,cljs.core.name);
return (fexpr__5261.cljs$core$IFn$_invoke$arity$1 ? fexpr__5261.cljs$core$IFn$_invoke$arity$1(key) : fexpr__5261.call(null,key));
})();
var key_ns = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__5258,(0),null);
var key_name = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__5258,(1),null);
var __GT_key = (((key instanceof cljs.core.Symbol))?cljs.core.symbol:cljs.core.keyword);
if((key_ns == null)){
return (__GT_key.cljs$core$IFn$_invoke$arity$2 ? __GT_key.cljs$core$IFn$_invoke$arity$2(ns,key_name) : __GT_key.call(null,ns,key_name));
} else {
if(cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2("_",key_ns)){
return (__GT_key.cljs$core$IFn$_invoke$arity$1 ? __GT_key.cljs$core$IFn$_invoke$arity$1(key_name) : __GT_key.call(null,key_name));
} else {
return key;
}
}
})():key));
var G__5266 = (i__5256 + (1));
i__5256 = G__5266;
continue;
} else {
return true;
}
break;
}
})()){
return cljs.core.chunk_cons(cljs.core.chunk(b__5257),cljs$tools$reader$impl$utils$namespace_keys_$_iter__5254(cljs.core.chunk_rest(s__5255__$2)));
} else {
return cljs.core.chunk_cons(cljs.core.chunk(b__5257),null);
}
} else {
var key = cljs.core.first(s__5255__$2);
return cljs.core.cons((((((key instanceof cljs.core.Symbol)) || ((key instanceof cljs.core.Keyword))))?(function (){var vec__5262 = (function (){var fexpr__5265 = cljs.core.juxt.cljs$core$IFn$_invoke$arity$2(cljs.core.namespace,cljs.core.name);
return (fexpr__5265.cljs$core$IFn$_invoke$arity$1 ? fexpr__5265.cljs$core$IFn$_invoke$arity$1(key) : fexpr__5265.call(null,key));
})();
var key_ns = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__5262,(0),null);
var key_name = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__5262,(1),null);
var __GT_key = (((key instanceof cljs.core.Symbol))?cljs.core.symbol:cljs.core.keyword);
if((key_ns == null)){
return (__GT_key.cljs$core$IFn$_invoke$arity$2 ? __GT_key.cljs$core$IFn$_invoke$arity$2(ns,key_name) : __GT_key.call(null,ns,key_name));
} else {
if(cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2("_",key_ns)){
return (__GT_key.cljs$core$IFn$_invoke$arity$1 ? __GT_key.cljs$core$IFn$_invoke$arity$1(key_name) : __GT_key.call(null,key_name));
} else {
return key;
}
}
})():key),cljs$tools$reader$impl$utils$namespace_keys_$_iter__5254(cljs.core.rest(s__5255__$2)));
}
} else {
return null;
}
break;
}
}),null,null));
});
return iter__5523__auto__(keys);
});
cljs.tools.reader.impl.utils.second_SINGLEQUOTE_ = (function cljs$tools$reader$impl$utils$second_SINGLEQUOTE_(p__5267){
var vec__5268 = p__5267;
var a = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__5268,(0),null);
var b = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__5268,(1),null);
if(cljs.core.truth_(a)){
return null;
} else {
return b;
}
});
cljs.tools.reader.impl.utils.char_code = (function cljs$tools$reader$impl$utils$char_code(ch,base){
var code = parseInt(ch,base);
if(cljs.core.truth_(isNaN(code))){
return (-1);
} else {
return code;
}
});