Libraryless. Click here for Pure Java version (5173L/30K).
1 | // TODO: cyclic structures involving certain lists & sets |
2 | |
3 | sO unstructure(S text) { |
4 | ret unstructure(text, false); |
5 | } |
6 | |
7 | sO unstructure(S text, unstructure_Data data) { |
8 | ret unstructure_tok(javaTokC_noMLS_iterator(text), false, null, data); |
9 | } |
10 | |
11 | sO unstructure(String text, final boolean allDynamic) { |
12 | ret unstructure(text, allDynamic, null); |
13 | } |
14 | |
15 | static int structure_internStringsLongerThan = 50; |
16 | static int unstructure_unquoteBufSize = 100; |
17 | |
18 | static int unstructure_tokrefs; // stats |
19 | |
20 | abstract sclass unstructure_Receiver { |
21 | abstract void set(O o); |
22 | } |
23 | |
24 | // classFinder: func(name) -> class (optional) |
25 | static Object unstructure(S text, bool allDynamic, |
26 | O classFinder) { |
27 | if (text == null) ret null; |
28 | ret unstructure_tok(javaTokC_noMLS_iterator(text), allDynamic, classFinder); |
29 | } |
30 | |
31 | static O unstructure_reader(BufferedReader reader) { |
32 | ret unstructure_tok(javaTokC_noMLS_onReader(reader), false, null); |
33 | } |
34 | |
35 | sclass unstructure_Data { |
36 | Producer<S> tok; |
37 | bool allDynamic; |
38 | O classFinder; |
39 | int i = -1; |
40 | new HashMap<Integer, O> refs; |
41 | new HashMap<Integer, O> tokrefs; |
42 | new HashSet<S> concepts; |
43 | new HashMap<S, Class> classesMap; |
44 | new L<Runnable> stack; |
45 | S curT; |
46 | char[] unquoteBuf = new char[unstructure_unquoteBufSize]; |
47 | |
48 | void out_set(unstructure_Receiver out, O value) { |
49 | out.set(postProcessValue(value)); |
50 | } |
51 | |
52 | // overridable |
53 | O postProcessValue(O value) { ret value; } |
54 | |
55 | Class findAClass(S fullClassName) { |
56 | ret classFinder != null ? (Class) callF(classFinder, fullClassName) : findClass_fullName(fullClassName); |
57 | } |
58 | |
59 | S unquote(S s) { |
60 | ret unquoteUsingCharArray(s, unquoteBuf); |
61 | } |
62 | |
63 | // look at current token |
64 | S t() { |
65 | ret curT; |
66 | } |
67 | |
68 | // get current token, move to next |
69 | S tpp() { |
70 | S t = curT; |
71 | consume(); |
72 | ret t; |
73 | } |
74 | |
75 | void parse(final unstructure_Receiver out) { |
76 | S t = t(); |
77 | |
78 | int refID; |
79 | if (structure_isMarker(t, 0, l(t))) { |
80 | refID = parseInt(t.substring(1)); |
81 | consume(); |
82 | } else refID = -1; |
83 | |
84 | // if (debug) print("parse: " + quote(t)); |
85 | |
86 | final int tokIndex = i; |
87 | parse_inner(refID, tokIndex, new unstructure_Receiver { |
88 | void set(O o) { |
89 | if (refID >= 0) |
90 | refs.put(refID, o); |
91 | if (o != null) |
92 | tokrefs.put(tokIndex, o); |
93 | out_set(out, o); |
94 | } |
95 | }); |
96 | } |
97 | |
98 | void parse_inner(int refID, int tokIndex, final unstructure_Receiver out) { |
99 | S t = t(); |
100 | |
101 | // if (debug) print("parse_inner: " + quote(t)); |
102 | |
103 | Class c = classesMap.get(t); |
104 | if (c == null) { |
105 | if (t.startsWith("\"")) { |
106 | S s = internIfLongerThan(unquote(tpp()), structure_internStringsLongerThan); |
107 | out_set(out, s); ret; |
108 | } |
109 | |
110 | if (t.startsWith("'")) { |
111 | out_set(out, unquoteCharacter(tpp())); ret; |
112 | } |
113 | if (t.equals("bigint")) { |
114 | out_set(out, parseBigInt()); ret; |
115 | } |
116 | if (t.equals("d")) { |
117 | out_set(out, parseDouble()); ret; |
118 | } |
119 | if (t.equals("fl")) { |
120 | out_set(out, parseFloat()); ret; |
121 | } |
122 | if (t.equals("sh")) { |
123 | consume(); |
124 | t = tpp(); |
125 | if (t.equals("-")) { |
126 | t = tpp(); |
127 | out_set(out, (short) (-parseInt(t)); ret; |
128 | } |
129 | out_set(out, (short) parseInt(t)); ret; |
130 | } |
131 | if (t.equals("-")) { |
132 | consume(); |
133 | t = tpp(); |
134 | out_set(out, isLongConstant(t) ? (O) (-parseLong(t)) : (O) (-parseInt(t))); ret; |
135 | } |
136 | if (isInteger(t) || isLongConstant(t)) { |
137 | consume(); |
138 | //if (debug) print("isLongConstant " + quote(t) + " => " + isLongConstant(t)); |
139 | if (isLongConstant(t)) { |
140 | out_set(out, parseLong(t)); ret; |
141 | } |
142 | long l = parseLong(t); |
143 | bool isInt = l == (int) l; |
144 | ifdef unstructure_debug |
145 | print("l=" + l + ", isInt: " + isInt); |
146 | endifdef |
147 | out_set(out, isInt ? (O) Integer.valueOf((int) l) : (O) Long.valueOf(l)); ret; |
148 | } |
149 | if (t.equals("false") || t.equals("f")) { |
150 | consume(); out_set(out, false); ret; |
151 | } |
152 | if (t.equals("true") || t.equals("t")) { |
153 | consume(); out_set(out, true); ret; |
154 | } |
155 | if (t.equals("-")) { |
156 | consume(); |
157 | t = tpp(); |
158 | out_set(out, isLongConstant(t) ? (O) (-parseLong(t)) : (O) (-parseInt(t))); ret; |
159 | } |
160 | if (isInteger(t) || isLongConstant(t)) { |
161 | consume(); |
162 | //if (debug) print("isLongConstant " + quote(t) + " => " + isLongConstant(t)); |
163 | if (isLongConstant(t)) { |
164 | out_set(out, parseLong(t)); ret; |
165 | } |
166 | long l = parseLong(t); |
167 | bool isInt = l == (int) l; |
168 | ifdef unstructure_debug |
169 | print("l=" + l + ", isInt: " + isInt); |
170 | endifdef |
171 | out_set(out, isInt ? (O) Integer.valueOf((int) l) : (O) Long.valueOf(l)); ret; |
172 | } |
173 | |
174 | if (t.equals("File")) { |
175 | consume(); |
176 | File f = new File(unquote(tpp())); |
177 | out_set(out, f); ret; |
178 | } |
179 | |
180 | if (t.startsWith("r") && isInteger(t.substring(1))) { |
181 | consume(); |
182 | int ref = Integer.parseInt(t.substring(1)); |
183 | O o = refs.get(ref); |
184 | if (o == null) |
185 | fail("unsatisfied back reference " + ref); |
186 | out_set(out, o); ret; |
187 | } |
188 | |
189 | if (t.startsWith("t") && isInteger(t.substring(1))) { |
190 | consume(); |
191 | int ref = Integer.parseInt(t.substring(1)); |
192 | O o = tokrefs.get(ref); |
193 | if (o == null) |
194 | fail("unsatisfied token reference " + ref + " at " + tokIndex); |
195 | out_set(out, o); ret; |
196 | } |
197 | |
198 | if (t.equals("hashset")) ret with parseHashSet(out); |
199 | if (t.equals("lhs")) ret with parseLinkedHashSet(out); |
200 | if (t.equals("treeset")) ret with parseTreeSet(out); |
201 | if (t.equals("ciset")) ret with parseCISet(out); |
202 | |
203 | if (eqOneOf(t, "hashmap", "hm")) { |
204 | consume(); |
205 | parseMap(new HashMap, out); |
206 | ret; |
207 | } |
208 | if (t.equals("lhm")) { |
209 | consume(); |
210 | parseMap(new LinkedHashMap, out); |
211 | ret; |
212 | } |
213 | if (t.equals("tm")) { |
214 | consume(); |
215 | parseMap(new TreeMap, out); |
216 | ret; |
217 | } |
218 | if (t.equals("cimap")) { |
219 | consume(); |
220 | parseMap(ciMap(), out); |
221 | ret; |
222 | } |
223 | |
224 | if (t.equals("ll")) { |
225 | consume(); |
226 | new LinkedList l; |
227 | if (refID >= 0) refs.put(refID, l); |
228 | ret with parseList(l, out); |
229 | } |
230 | |
231 | if (t.equals("syncLL")) { // legacy |
232 | consume(); |
233 | ret with parseList(synchroLinkedList(), out); |
234 | } |
235 | |
236 | if (t.equals("sync")) { |
237 | consume(); |
238 | ret with parse(new unstructure_Receiver { |
239 | void set(O value) { |
240 | if (value instanceof Map) { |
241 | ifndef Android // Java 7 |
242 | if (value instanceof NavigableMap) |
243 | ret with out_set(out, Collections.synchronizedNavigableMap((NavigableMap) value)); |
244 | endifndef |
245 | if (value instanceof SortedMap) |
246 | ret with out_set(out, Collections.synchronizedSortedMap((SortedMap) value)); |
247 | ret with out_set(out, Collections.synchronizedMap((Map) value)); |
248 | } else |
249 | ret with out_set(out, Collections.synchronizedList((L) value); |
250 | } |
251 | }); |
252 | } |
253 | |
254 | if (t.equals("{")) { |
255 | parseMap(out); ret; |
256 | } |
257 | if (t.equals("[")) { |
258 | new ArrayList l; |
259 | if (refID >= 0) refs.put(refID, l); |
260 | this.parseList(l, out); ret; |
261 | } |
262 | if (t.equals("bitset")) { |
263 | parseBitSet(out); ret; |
264 | } |
265 | if (t.equals("array") || t.equals("intarray") || t.equals("dblarray")) { |
266 | parseArray(out); ret; |
267 | } |
268 | if (t.equals("ba")) { |
269 | consume(); |
270 | S hex = unquote(tpp()); |
271 | out_set(out, hexToBytes(hex)); ret; |
272 | } |
273 | if (t.equals("boolarray")) { |
274 | consume(); |
275 | int n = parseInt(tpp()); |
276 | S hex = unquote(tpp()); |
277 | out_set(out, boolArrayFromBytes(hexToBytes(hex), n)); ret; |
278 | } |
279 | if (t.equals("class")) { |
280 | out_set(out, parseClass()); ret; |
281 | } |
282 | if (t.equals("l")) { |
283 | parseLisp(out); ret; |
284 | } |
285 | if (t.equals("null")) { |
286 | consume(); out_set(out, null); ret; |
287 | } |
288 | |
289 | if (eq(t, "c")) { |
290 | consume(); |
291 | t = t(); |
292 | assertTrue(isJavaIdentifier(t)); |
293 | concepts.add(t); |
294 | } |
295 | |
296 | // custom deserialization (new static method method) |
297 | if (eq(t, "cu")) { |
298 | consume(); |
299 | t = tpp(); |
300 | assertTrue(isJavaIdentifier(t)); |
301 | S fullClassName = "main$" + t; |
302 | Class _c = allDynamic ? null : findAClass(fullClassName); |
303 | if (_c == null) fail("Class not found: " + fullClassName); |
304 | parse(new unstructure_Receiver { |
305 | void set(O value) { |
306 | ifdef unstructure_debug |
307 | print("Consumed custom object, next token: " + t()); |
308 | endifdef |
309 | out_set(out, call(_c, "_deserialize", value); |
310 | } |
311 | }); |
312 | ret; |
313 | } |
314 | } |
315 | |
316 | if (eq(t, "j")) { |
317 | consume("j"); |
318 | out_set(out, parseJava()); ret; |
319 | } |
320 | |
321 | if (c == null && !isJavaIdentifier(t)) |
322 | throw new RuntimeException("Unknown token " + (i+1) + ": " + quote(t)); |
323 | |
324 | // any other class name (or package name) |
325 | consume(); |
326 | S className, fullClassName; |
327 | |
328 | // Is it a package name? |
329 | if (eq(t(), ".")) { |
330 | consume(); |
331 | className = fullClassName = t + "." + assertIdentifier(tpp()); |
332 | } else { |
333 | className = t; |
334 | fullClassName = "main$" + t; |
335 | } |
336 | |
337 | if (c == null) { |
338 | // First, find class |
339 | ifdef unstructure_debug |
340 | print("Finding class " + fullClassName + " (allDynamic=" + allDynamic + ")"); |
341 | endifdef |
342 | if (allDynamic) c = null; |
343 | else c = findAClass(fullClassName); |
344 | if (c != null) |
345 | classesMap.put(className, c); |
346 | } |
347 | |
348 | // Check if it has an outer reference |
349 | bool hasBracket = eq(t(), "("); |
350 | if (hasBracket) consume(); |
351 | bool hasOuter = hasBracket && eq(t(), "this$1"); |
352 | |
353 | DynamicObject dO = null; |
354 | O o = null; |
355 | fS thingName = t; |
356 | if (c != null) { |
357 | o = hasOuter ? nuStubInnerObject(c, classFinder) : nuEmptyObject(c); |
358 | if (o instanceof DynamicObject) dO = (DynamicObject) o; |
359 | } else { |
360 | if (concepts.contains(t) && (c = findAClass("main$Concept")) != null) |
361 | o = dO = (DynamicObject) nuEmptyObject(c); |
362 | else |
363 | dO = new DynamicObject; |
364 | dO.className = className; |
365 | ifdef unstructure_debug |
366 | print("Made dynamic object " + t + " " + shortClassName(dO)); |
367 | endifdef |
368 | } |
369 | |
370 | // Save in references list early because contents of object |
371 | // might link back to main object |
372 | |
373 | if (refID >= 0) |
374 | refs.put(refID, o != null ? o : dO); |
375 | tokrefs.put(tokIndex, o != null ? o : dO); |
376 | |
377 | // NOW parse the fields! |
378 | |
379 | new /*Linked*/HashMap<S, O> fields; // no longer preserving order (why did we do this?) |
380 | O _o = o; |
381 | DynamicObject _dO = dO; |
382 | if (hasBracket) { |
383 | stack.add(r { |
384 | ifdef unstructure_debug |
385 | print("in object values, token: " + t()); |
386 | endifdef |
387 | if (eq(t(), ",")) consume(); |
388 | if (eq(t(), ")")) { |
389 | consume(")"); |
390 | objRead(_o, _dO, fields, hasOuter); |
391 | out_set(out, _o != null ? _o : _dO); |
392 | } else { |
393 | final S key = unquote(tpp()); |
394 | S t = tpp(); |
395 | if (!eq(t, "=")) |
396 | fail("= expected, got " + t + " after " + quote(key) + " in object " + thingName /*+ " " + sfu(fields)*/); |
397 | stack.add(this); |
398 | parse(new unstructure_Receiver { |
399 | void set(O value) { |
400 | fields.put(key, value); |
401 | /*ifdef unstructure_debug |
402 | print("Got field value " + value + ", next token: " + t()); |
403 | endifdef*/ |
404 | //if (eq(t(), ",")) consume(); |
405 | } |
406 | }); |
407 | } |
408 | }); |
409 | } else { |
410 | objRead(o, dO, fields, hasOuter); |
411 | out_set(out, o != null ? o : dO); |
412 | } |
413 | } |
414 | |
415 | void objRead(O o, DynamicObject dO, Map<S, O> fields, bool hasOuter) { |
416 | ifdef unstructure_debug |
417 | print("objRead " + className(o) + " " + className(dO) + " " + struct(fields)); |
418 | endifdef |
419 | if (o != null) { |
420 | if (dO != null) { |
421 | ifdef unstructure_debug |
422 | printStructure("setOptAllDyn", fields); |
423 | endifdef |
424 | setOptAllDyn_pcall(dO, fields); |
425 | } else { |
426 | setOptAll_pcall(o, fields); |
427 | ifdef unstructure_debug |
428 | print("objRead now: " + struct(o)); |
429 | endifdef |
430 | } |
431 | if (hasOuter) |
432 | fixOuterRefs(o); |
433 | } else for (Map.Entry<S, O> e : fields.entrySet()) |
434 | setDynObjectValue(dO, intern(e.getKey()), e.getValue()); |
435 | |
436 | if (o != null) |
437 | pcallOpt_noArgs(o, "_doneLoading"); |
438 | } |
439 | |
440 | void parseSet(final Set set, final unstructure_Receiver out) { |
441 | this.parseList(new ArrayList, new unstructure_Receiver { |
442 | void set(O o) { |
443 | set.addAll((L) o); |
444 | out_set(out, set); |
445 | } |
446 | }); |
447 | } |
448 | |
449 | void parseLisp(final unstructure_Receiver out) { |
450 | ifclass Lisp |
451 | consume("l"); |
452 | consume("("); |
453 | final new ArrayList list; |
454 | stack.add(r { |
455 | if (eq(t(), ")")) { |
456 | consume(")"); |
457 | out_set(out, Lisp((S) list.get(0), subList(list, 1))); |
458 | } else { |
459 | stack.add(this); |
460 | parse(new unstructure_Receiver { |
461 | void set(O o) { |
462 | list.add(o); |
463 | if (eq(t(), ",")) consume(); |
464 | } |
465 | }); |
466 | } |
467 | }); |
468 | if (false) // skip fail line |
469 | endif |
470 | |
471 | fail("class Lisp not included"); |
472 | } |
473 | |
474 | void parseBitSet(final unstructure_Receiver out) { |
475 | consume("bitset"); |
476 | consume("{"); |
477 | final new BitSet bs; |
478 | stack.add(r { |
479 | if (eq(t(), "}")) { |
480 | consume("}"); |
481 | out_set(out, bs); |
482 | } else { |
483 | stack.add(this); |
484 | parse(new unstructure_Receiver { |
485 | void set(O o) { |
486 | bs.set((Integer) o); |
487 | if (eq(t(), ",")) consume(); |
488 | } |
489 | }); |
490 | } |
491 | }); |
492 | } |
493 | |
494 | void parseList(final L list, final unstructure_Receiver out) { |
495 | tokrefs.put(i, list); |
496 | consume("["); |
497 | stack.add(r { |
498 | if (eq(t(), "]")) { |
499 | consume(); |
500 | ifdef unstructure_debug |
501 | print("Consumed list, next token: " + t()); |
502 | endifdef |
503 | out_set(out, list); |
504 | } else { |
505 | stack.add(this); |
506 | parse(new unstructure_Receiver { |
507 | void set(O o) { |
508 | //if (debug) print("List element type: " + getClassName(o)); |
509 | list.add(o); |
510 | if (eq(t(), ",")) consume(); |
511 | } |
512 | }); |
513 | } |
514 | }); |
515 | } |
516 | |
517 | void parseArray(final unstructure_Receiver out) { |
518 | final S type = tpp(); |
519 | consume("{"); |
520 | final List list = new ArrayList; |
521 | |
522 | stack.add(r { |
523 | if (eq(t(), "}")) { |
524 | consume("}"); |
525 | out_set(out, |
526 | type.equals("intarray") ? toIntArray(list) |
527 | : type.equals("dblarray") ? toDoubleArray(list) |
528 | : list.toArray()); |
529 | } else { |
530 | stack.add(this); |
531 | parse(new unstructure_Receiver { |
532 | void set(O o) { |
533 | list.add(o); |
534 | if (eq(t(), ",")) consume(); |
535 | } |
536 | }); |
537 | } |
538 | }); |
539 | } |
540 | |
541 | Object parseClass() { |
542 | consume("class"); |
543 | consume("("); |
544 | S name = unquote(tpp()); |
545 | consume(")"); |
546 | Class c = allDynamic ? null : findAClass(name); |
547 | if (c != null) ret c; |
548 | new DynamicObject dO; |
549 | dO.className = "java.lang.Class"; |
550 | name = dropPrefix("main$", name); |
551 | dO.fieldValues.put("name", name); |
552 | ret dO; |
553 | } |
554 | |
555 | Object parseBigInt() { |
556 | consume("bigint"); |
557 | consume("("); |
558 | S val = tpp(); |
559 | if (eq(val, "-")) |
560 | val = "-" + tpp(); |
561 | consume(")"); |
562 | ret new BigInteger(val); |
563 | } |
564 | |
565 | Object parseDouble() { |
566 | consume("d"); |
567 | consume("("); |
568 | S val = unquote(tpp()); |
569 | consume(")"); |
570 | ret Double.parseDouble(val); |
571 | } |
572 | |
573 | Object parseFloat() { |
574 | consume("fl"); |
575 | S val; |
576 | if (eq(t(), "(")) { |
577 | consume("("); |
578 | val = unquote(tpp()); |
579 | consume(")"); |
580 | } else { |
581 | val = unquote(tpp()); |
582 | } |
583 | ret Float.parseFloat(val); |
584 | } |
585 | |
586 | void parseHashSet(unstructure_Receiver out) { |
587 | consume("hashset"); |
588 | parseSet(new HashSet, out); |
589 | } |
590 | |
591 | void parseLinkedHashSet(unstructure_Receiver out) { |
592 | consume("lhs"); |
593 | parseSet(new LinkedHashSet, out); |
594 | } |
595 | |
596 | void parseTreeSet(unstructure_Receiver out) { |
597 | consume("treeset"); |
598 | parseSet(new TreeSet, out); |
599 | } |
600 | |
601 | void parseCISet(unstructure_Receiver out) { |
602 | consume("ciset"); |
603 | parseSet(ciSet(), out); |
604 | } |
605 | |
606 | void parseMap(unstructure_Receiver out) { |
607 | parseMap(new TreeMap, out); |
608 | } |
609 | |
610 | O parseJava() { |
611 | S j = unquote(tpp()); |
612 | new Matches m; |
613 | if (jmatch("java.awt.Color[r=*,g=*,b=*]", j, m)) |
614 | ret nuObject("java.awt.Color", parseInt($1), parseInt($2), parseInt($3)); |
615 | else { |
616 | warn("Unknown Java object: " + j); |
617 | null; |
618 | } |
619 | } |
620 | |
621 | void parseMap(final Map map, final unstructure_Receiver out) { |
622 | consume("{"); |
623 | stack.add(new Runnable { |
624 | bool v; |
625 | O key; |
626 | |
627 | public void run() { |
628 | if (v) { |
629 | v = false; |
630 | stack.add(this); |
631 | if (!eq(tpp(), "=")) |
632 | fail("= expected, got " + t() + " in map of size " + l(map)); |
633 | |
634 | parse(new unstructure_Receiver { |
635 | void set(O value) { |
636 | map.put(key, value); |
637 | ifdef unstructure_debug |
638 | print("parseMap: Got value " + getClassName(value) + ", next token: " + quote(t())); |
639 | endifdef |
640 | if (eq(t(), ",")) consume(); |
641 | } |
642 | }); |
643 | } else { |
644 | if (eq(t(), "}")) { |
645 | consume("}"); |
646 | out_set(out, map); |
647 | } else { |
648 | v = true; |
649 | stack.add(this); |
650 | parse(new unstructure_Receiver { |
651 | void set(O o) { |
652 | key = o; |
653 | } |
654 | }); |
655 | } |
656 | } // if v else |
657 | } // run() |
658 | }); |
659 | } |
660 | |
661 | /*void parseSub(unstructure_Receiver out) { |
662 | int n = l(stack); |
663 | parse(out); |
664 | while (l(stack) > n) |
665 | stack |
666 | }*/ |
667 | |
668 | void consume() { curT = tok.next(); ++i; } |
669 | |
670 | void consume(S s) { |
671 | if (!eq(t(), s)) { |
672 | /*S prevToken = i-1 >= 0 ? tok.get(i-1) : ""; |
673 | S nextTokens = join(tok.subList(i, Math.min(i+2, tok.size()))); |
674 | fail(quote(s) + " expected: " + prevToken + " " + nextTokens + " (" + i + "/" + tok.size() + ")");*/ |
675 | fail(quote(s) + " expected, got " + quote(t())); |
676 | } |
677 | consume(); |
678 | } |
679 | |
680 | // outer wrapper function getting first token and unwinding the stack |
681 | void parse_initial(unstructure_Receiver out) { |
682 | consume(); // get first token |
683 | parse(out); |
684 | while (nempty(stack)) |
685 | popLast(stack).run(); |
686 | } |
687 | } |
688 | |
689 | |
690 | sO unstructure_tok(Producer<S> tok, bool allDynamic, O _classFinder, unstructure_Data data default new unstructure_Data) { |
691 | final boolean debug = unstructure_debug; |
692 | |
693 | ThreadLocal<Bool> tlLoading = dynamicObjectIsLoading_threadLocal(); |
694 | Bool b = tlLoading!; |
695 | tlLoading.set(true); |
696 | try { |
697 | new Var v; |
698 | data.tok = tok; |
699 | data.allDynamic = allDynamic; |
700 | if (data.classFinder == null) |
701 | data.classFinder = _classFinder != null ? _classFinder : _defaultClassFinder(); |
702 | data.parse_initial(new unstructure_Receiver { |
703 | void set(O o) { v.set(o); } |
704 | }); |
705 | unstructure_tokrefs = data.tokrefs.size(); |
706 | ret v.get(); |
707 | } finally { |
708 | tlLoading.set(b); |
709 | } |
710 | } |
711 | |
712 | static boolean unstructure_debug; |
Began life as a copy of #1025231
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt
No comments. add comment
Snippet ID: | #1030718 |
Snippet name: | unstructure (v17, more customizability, dev.) |
Eternal ID of this version: | #1030718/11 |
Text MD5: | a9cd2f909bbe27bf30658ddb1ec88425 |
Transpilation MD5: | cb29ec1839b1cc17da36ee49091d6dcc |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-04-14 15:10:11 |
Source code size: | 20119 bytes / 712 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 179 / 315 |
Version history: | 10 change(s) |
Referenced in: | [show references] |