OLD | NEW |
1 part of lisp; | 1 part of petitparser.lisp; |
2 | 2 |
3 /** | 3 /// An unique symbolic name. |
4 * An unique symbolic name. | |
5 */ | |
6 class Name { | 4 class Name { |
7 | 5 |
8 /** The interned symbols. */ | 6 /// The interned symbols. |
9 static final Map<String, Name> _interned = new HashMap(); | 7 static final Map<String, Name> _interned = new HashMap(); |
10 | 8 |
11 /** Factory for new symbol cells. */ | 9 /// Factory for new symbol cells. |
12 factory Name(String name) { | 10 factory Name(String name) { |
13 return _interned.putIfAbsent(name, () => new Name._internal(name)); | 11 return _interned.putIfAbsent(name, () => new Name._internal(name)); |
14 } | 12 } |
15 | 13 |
16 /** The name of the symbol. */ | 14 /// The name of the symbol. |
17 final String _name; | 15 final String _name; |
18 | 16 |
19 /** Internal constructor for symbol. */ | 17 /// Internal constructor for symbol. |
20 Name._internal(this._name); | 18 Name._internal(this._name); |
21 | 19 |
22 /** Returns the string representation of the symbolic name. */ | 20 /// Returns the string representation of the symbolic name. |
23 String toString() => _name; | 21 String toString() => _name; |
24 } | 22 } |
OLD | NEW |