|
74 | 74 |
|
75 | 75 | (defn char-to-subscript |
76 | 76 | "Given a character with a single digit converts it into a subscript character. |
77 | | - Zero chracter maps to unicode 'SUBSCRIPT ZERO' (U+2080)." |
| 77 | + Zero character maps to unicode 'SUBSCRIPT ZERO' (U+2080)." |
78 | 78 | [char] |
79 | 79 | {:pre [(string? char) |
80 | 80 | (= (count char) 1)]} |
|
91 | 91 |
|
92 | 92 | (defn char-to-superscript |
93 | 93 | "Given a character with a single digit converts it into a superscript character. |
94 | | - Zero chracter maps to unicode 'SUPERSCRIPT ZERO' (U+2070)." |
| 94 | + Zero character maps to unicode 'SUPERSCRIPT ZERO' (U+2070)." |
95 | 95 | [char] |
96 | 96 | {:pre [(string? char) |
97 | 97 | (= (count char) 1)]} |
|
124 | 124 | "Given a function source code parses out [name args]. Note that both strings are still munged. |
125 | 125 | Suitable for further processing. |
126 | 126 |
|
127 | | - For exampe for input below the function will return [\"devtools_sample$core$hello\" \"name, unused_param\"]: |
| 127 | + For example for input below the function will return [\"devtools_sample$core$hello\" \"name, unused_param\"]: |
128 | 128 |
|
129 | 129 | function devtools_sample$core$hello(name, unused_param){ |
130 | 130 | return [cljs.core.str(\"hello, \"),cljs.core.str(name),cljs.core.str(\"!\")].join(''); |
|
162 | 162 | ; -- demunging -------------------------------------------------------------------------------------------------------------- |
163 | 163 |
|
164 | 164 | (defn dollar-preserving-demunge |
165 | | - "Standard cljs.core/demunge is too agresive in replacing dollars. |
| 165 | + "Standard cljs.core/demunge is too aggressive in replacing dollars. |
166 | 166 | This wrapper function works around it by leaving dollars intact." |
167 | 167 | [munged-name] |
168 | 168 | (-> munged-name |
|
202 | 202 | (defn detect-namespace-prefix |
203 | 203 | "Given a name broken into namespace parts returns [detected-ns remaining-parts], |
204 | 204 | where detected-ns is a string representing longest detected existing namespace and |
205 | | - remaining-parts is a vector of remaing input parts not included in the detected-ns concatenation. |
| 205 | + remaining-parts is a vector of remaining input parts not included in the detected-ns concatenation. |
206 | 206 |
|
207 | | - For given input [\"cljs\" \"core\" \"first\"] returns [\"cljs.core\" [\"first\"]] (asumming cljs.core exists)" |
| 207 | + For given input [\"cljs\" \"core\" \"first\"] returns [\"cljs.core\" [\"first\"]] (assuming cljs.core exists)" |
208 | 208 | [tokens & [ns-detector]] |
209 | 209 | (let [effective-detector (or ns-detector ns-exists?)] |
210 | 210 | (loop [name-tokens [] |
|
255 | 255 | tokens (vec (.split munged-name #"[$.]")) |
256 | 256 | [tokens arity] (strip-arity tokens) |
257 | 257 | [fn-ns tokens] (detect-namespace-prefix tokens effective-detector) |
258 | | - ; remianing parts contains function name, |
| 258 | + ; remaining parts contains function name, |
259 | 259 | ; but may be optionally followed by protocol namespace, protocol name and protocol method |
260 | 260 | [fn-name-tokens protocol-ns protocol-name protocol-method-tokens] (parse-protocol tokens effective-detector) |
261 | 261 | fn-name (string/join "$" fn-name-tokens) |
|
304 | 304 | "Given a Javascript function object tries to retrieve [ns name & args] as in parse-fn-info (on best effort basis). |
305 | 305 |
|
306 | 306 | The difference from parse-fn-info is that this function prefers to read args from arities if available. |
307 | | - It recurses arbitrary deep following IFn protocol leads. |
| 307 | + It recurse arbitrary deep following IFn protocol leads. |
308 | 308 |
|
309 | 309 | If we hit multi-arity situation in leaf, we don't attempt to list arguments and return ::multi-arity placeholder instead. |
310 | 310 |
|
|
337 | 337 |
|
338 | 338 | (defn humanize-name |
339 | 339 | "Given a name and intermediate state. Convert name to a human readable version by keeping human readable prefix with |
340 | | - optional subscribt postfix and store it in ::result. Subscript number is picked based on state. State keeps track of |
| 340 | + optional subscript postfix and store it in ::result. Subscript number is picked based on state. State keeps track of |
341 | 341 | previously assigned subscripts. Returns a new state." |
342 | 342 | [state name] |
343 | 343 | (let [index (find-index-of-human-prefix name) |
|
0 commit comments