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

Unified Diff: petitparser/lib/src/json/grammar.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « petitparser/lib/src/debug/trace.dart ('k') | petitparser/lib/src/json/parser.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: petitparser/lib/src/json/grammar.dart
diff --git a/petitparser/lib/src/json/grammar.dart b/petitparser/lib/src/json/grammar.dart
deleted file mode 100644
index 60b4de24e4c5ba747bbb6630ee324e00ebd593c5..0000000000000000000000000000000000000000
--- a/petitparser/lib/src/json/grammar.dart
+++ /dev/null
@@ -1,70 +0,0 @@
-part of json;
-
-/**
- * JSON grammar.
- */
-class JsonGrammar extends GrammarParser {
- JsonGrammar() : super(const JsonGrammarDefinition());
-}
-
-/**
- * JSON grammar definition.
- */
-class JsonGrammarDefinition extends GrammarDefinition {
- const JsonGrammarDefinition();
-
- start() => ref(value).end();
- token(p) => p.flatten().trim();
-
- array() => ref(token, char('['))
- & ref(elements).optional()
- & ref(token, char(']'));
- elements() => ref(value).separatedBy(ref(token, char(',')), includeSeparators: false);
- members() => ref(pair).separatedBy(ref(token, char(',')), includeSeparators: false);
- object() => ref(token, char('{'))
- & ref(members).optional()
- & ref(token, char('}'));
- pair() => ref(stringToken)
- & ref(token, char(':'))
- & ref(value);
- value() => ref(stringToken)
- | ref(numberToken)
- | ref(object)
- | ref(array)
- | ref(trueToken)
- | ref(falseToken)
- | ref(nullToken);
-
- trueToken() => ref(token, string('true'));
- falseToken() => ref(token, string('false'));
- nullToken() => ref(token, string('null'));
- stringToken() => ref(token, ref(stringPrimitive));
- numberToken() => ref(token, ref(numberPrimitive));
-
- characterPrimitive() => ref(characterNormal)
- | ref(characterEscape)
- | ref(characterOctal);
- characterNormal() => pattern('^"\\');
- characterEscape() => char('\\')
- & pattern(new List.from(JSON_ESCAPE_CHARS.keys).join());
- characterOctal() => string('\\u').seq(pattern("0-9A-Fa-f").times(4).flatten());
- numberPrimitive() => char('-').optional()
- & char('0').or(digit().plus())
- & char('.').seq(digit().plus()).optional()
- & pattern('eE').seq(pattern('-+').optional()).seq(digit().plus()).optional();
- stringPrimitive() => char('"')
- & ref(characterPrimitive).star()
- & char('"');
-
-}
-
-const JSON_ESCAPE_CHARS = const {
- '\\': '\\',
- '/': '/',
- '"': '"',
- 'b': '\b',
- 'f': '\f',
- 'n': '\n',
- 'r': '\r',
- 't': '\t'
-};
« no previous file with comments | « petitparser/lib/src/debug/trace.dart ('k') | petitparser/lib/src/json/parser.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698