| 749 | |
| 750 | |
| 751 | public static class SymbolicValueReader extends AFn{ |
| 752 | |
| 753 | static IPersistentMap specials = PersistentHashMap.create(Symbol.intern("Inf"), Double.POSITIVE_INFINITY, |
| 754 | Symbol.intern("-Inf"), Double.NEGATIVE_INFINITY, |
| 755 | Symbol.intern("NaN"), Double.NaN); |
| 756 | |
| 757 | public Object invoke(Object reader, Object quote, Object opts, Object pendingForms) { |
| 758 | PushbackReader r = (PushbackReader) reader; |
| 759 | Object o = read(r, true, null, true, opts, ensurePending(pendingForms)); |
| 760 | |
| 761 | if (!(o instanceof Symbol)) |
| 762 | throw Util.runtimeException("Invalid token: ##" + o); |
| 763 | if (!(specials.containsKey(o))) |
| 764 | throw Util.runtimeException("Unknown symbolic value: ##" + o); |
| 765 | |
| 766 | return specials.valAt(o); |
| 767 | } |
| 768 | } |
| 769 | |
| 770 | public static class WrappingReader extends AFn{ |
| 771 | final Symbol sym; |