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