Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(617)

Side by Side Diff: petitparser/lib/src/json/parser.dart

Issue 1400473008: Roll Observatory packages and add a roll script (Closed) Base URL: git@github.com:dart-lang/observatory_pub_packages.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « petitparser/lib/src/json/grammar.dart ('k') | petitparser/lib/src/lisp/cons.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 part of json;
2
3 /**
4 * JSON parser.
5 */
6 class JsonParser extends GrammarParser {
7 JsonParser() : super(const JsonParserDefinition());
8 }
9
10 /**
11 * JSON parser definition.
12 */
13 class JsonParserDefinition extends JsonGrammarDefinition {
14 const JsonParserDefinition();
15
16 array() => super.array().map((each) => each[1] != null ? each[1] : new List()) ;
17 object() => super.object().map((each) {
18 var result = new LinkedHashMap();
19 if (each[1] != null) {
20 for (var element in each[1]) {
21 result[element[0]] = element[2];
22 }
23 }
24 return result;
25 });
26
27 trueToken() => super.trueToken().map((each) => true);
28 falseToken() => super.falseToken().map((each) => false);
29 nullToken() => super.nullToken().map((each) => null);
30 stringToken() => ref(stringPrimitive).trim();
31 numberToken() => super.numberToken().map((each) {
32 var floating = double.parse(each);
33 var integral = floating.toInt();
34 if (floating == integral && each.indexOf('.') == -1) {
35 return integral;
36 } else {
37 return floating;
38 }
39 });
40
41 stringPrimitive() => super.stringPrimitive().map((each) => each[1].join());
42 characterEscape() => super.characterEscape().map((each) => JSON_ESCAPE_CHARS[e ach[1]]);
43 characterOctal() => super.characterOctal().map((each) {
44 throw new UnsupportedError('Octal characters not supported yet');
45 });
46
47 }
OLDNEW
« no previous file with comments | « petitparser/lib/src/json/grammar.dart ('k') | petitparser/lib/src/lisp/cons.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698