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

Side by Side Diff: packages/petitparser/lib/src/lisp/grammar.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.lisp;
2
3 /// LISP grammar.
4 class LispGrammar extends GrammarParser {
5 LispGrammar() : super(new LispGrammarDefinition());
6 }
7
8 /// LISP grammar definition.
9 class LispGrammarDefinition extends GrammarDefinition {
10
11 start() => ref(atom).star().end();
12
13 atom() => ref(atom_).trim(ref(space));
14 atom_() => ref(list)
15 | ref(number)
16 | ref(string)
17 | ref(symbol)
18 | ref(quote)
19 | ref(quasiquote)
20 | ref(unquote)
21 | ref(splice);
22
23 list() => ref(bracket, '()', ref(cells))
24 | ref(bracket, '[]', ref(cells))
25 | ref(bracket, '{}', ref(cells));
26 cells() => ref(cell)
27 | ref(empty);
28 cell() => ref(atom) & ref(cells);
29 empty() => ref(space).star();
30
31 number() => ref(number_).flatten();
32 number_() => anyIn('-+').optional()
33 & char('0').or(digit().plus())
34 & char('.').seq(digit().plus()).optional()
35 & anyIn('eE').seq(anyIn('-+').optional()).seq(digit().plus()).optional();
36
37 string() => ref(bracket, '""', ref(character).star());
38 character() => ref(characterEscape) | ref(characterRaw);
39 characterEscape() => char('\\') & any();
40 characterRaw() => pattern('^"');
41
42 symbol() => ref(symbol_).flatten();
43 symbol_() => pattern('a-zA-Z!#\$%&*/:<=>?@\\^_|~+-')
44 & pattern('a-zA-Z0-9!#\$%&*/:<=>?@\\^_|~+-').star();
45
46 quote() => char('\'') & ref(list);
47 quasiquote() => char('`') & ref(list);
48 unquote() => char(',') & ref(list);
49 splice() => char('@') & ref(list);
50
51 space() => whitespace() | ref(comment);
52 comment() => char(';') & Token.newlineParser().neg().star();
53 bracket(String brackets, Parser parser) => char(brackets[0]) & parser & char(b rackets[1]);
54
55 }
OLDNEW
« no previous file with comments | « packages/petitparser/lib/src/lisp/environment.dart ('k') | packages/petitparser/lib/src/lisp/name.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698