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

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

Issue 2989763002: Update charted to 0.4.8 and roll (Closed)
Patch Set: Removed Cutch from list of reviewers Created 3 years, 4 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
OLDNEW
(Empty)
1 part of petitparser.json;
2
3 /// JSON parser.
4 class JsonParser extends GrammarParser {
5 JsonParser() : super(const JsonParserDefinition());
6 }
7
8 /// JSON parser definition.
9 class JsonParserDefinition extends JsonGrammarDefinition {
10 const JsonParserDefinition();
11
12 array() => super.array().map((each) => each[1] != null ? each[1] : new List()) ;
13 object() => super.object().map((each) {
14 var result = new LinkedHashMap();
15 if (each[1] != null) {
16 for (var element in each[1]) {
17 result[element[0]] = element[2];
18 }
19 }
20 return result;
21 });
22
23 trueToken() => super.trueToken().map((each) => true);
24 falseToken() => super.falseToken().map((each) => false);
25 nullToken() => super.nullToken().map((each) => null);
26 stringToken() => ref(stringPrimitive).trim();
27 numberToken() => super.numberToken().map((each) {
28 var floating = double.parse(each);
29 var integral = floating.toInt();
30 if (floating == integral && each.indexOf('.') == -1) {
31 return integral;
32 } else {
33 return floating;
34 }
35 });
36
37 stringPrimitive() => super.stringPrimitive().map((each) => each[1].join());
38 characterEscape() => super.characterEscape().map((each) => jsonEscapeChars[eac h[1]]);
39 characterUnicode() => super.characterUnicode().map((each) {
40 var charCode = int.parse(each[1].join(), radix: 16);
41 return new String.fromCharCode(charCode);
42 });
43 }
OLDNEW
« no previous file with comments | « packages/petitparser/lib/src/json/grammar.dart ('k') | packages/petitparser/lib/src/lisp/cons.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698