OLD | NEW |
| (Empty) |
1 part of lisp; | |
2 | |
3 /** | |
4 * LISP parser. | |
5 */ | |
6 class LispParser extends GrammarParser { | |
7 LispParser() : super(new LispParserDefinition()); | |
8 } | |
9 | |
10 /** | |
11 * LISP parser definition. | |
12 */ | |
13 class LispParserDefinition extends LispGrammarDefinition { | |
14 | |
15 list() => super.list().map((each) => each[1]); | |
16 | |
17 cell() => super.cell().map((each) => new Cons(each[0], each[1])); | |
18 empty() => super.empty().map((each) => null); | |
19 | |
20 string() => super.string().map((each) => new String.fromCharCodes(each[1])); | |
21 characterEscape() => super.characterEscape().map((each) => each[1].codeUnitAt(
0)); | |
22 characterRaw() => super.characterRaw().map((each) => each.codeUnitAt(0)); | |
23 | |
24 symbol() => super.symbol().map((each) => new Name(each)); | |
25 number() => super.number().map((each) { | |
26 var floating = double.parse(each); | |
27 var integral = floating.toInt(); | |
28 if (floating == integral && each.indexOf('.') == -1) { | |
29 return integral; | |
30 } else { | |
31 return floating; | |
32 } | |
33 }); | |
34 | |
35 quote() => super.quote().map((each) => new Cons(Natives._quote, each[1])); | |
36 | |
37 } | |
OLD | NEW |