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

Side by Side Diff: pkg/mustache/lib/char_reader.dart

Issue 804973002: Add appengine/gcloud/mustache dependencies. (Closed) Base URL: git@github.com:dart-lang/pub-dartlang-dart.git@master
Patch Set: Added AUTHORS/LICENSE/PATENTS files Created 6 years 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 | « pkg/mustache/check.sh ('k') | pkg/mustache/lib/mustache.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 mustache;
2
3 class _CharReader {
4
5 String _source;
6 Iterator<int> _itr;
7 int _i, _c;
8 int _line = 1, _column = 1;
9
10 _CharReader(String source)
11 : _source = source,
12 _itr = source.runes.iterator { //FIXME runes etc. Not sure if this is t he right count.
13
14 if (source == null)
15 throw new ArgumentError('Source is null.');
16
17 _i = 0;
18
19 if (source == '') {
20 _c = _EOF;
21 } else {
22 _itr.moveNext();
23 _c = _itr.current;
24 }
25 }
26
27 int get line => _line;
28 int get column => _column;
29
30 int read() {
31 var c = _c;
32 if (_itr.moveNext()) {
33 _i++;
34 _c = _itr.current;
35 } else {
36 _c = _EOF;
37 }
38
39 if (c == _NEWLINE) {
40 _line++;
41 _column = 1;
42 } else {
43 _column++;
44 }
45
46 return c;
47 }
48
49 int peek() => _c;
50
51 String readWhile(bool test(int charCode)) {
52
53 if (peek() == _EOF)
54 throw new MustacheFormatException('Unexpected end of input.', line, column );
55
56 int start = _i;
57
58 while (peek() != _EOF && test(peek())) {
59 read();
60 }
61
62 int end = peek() == _EOF ? _source.length : _i;
63 return _source.substring(start, end);
64 }
65 }
OLDNEW
« no previous file with comments | « pkg/mustache/check.sh ('k') | pkg/mustache/lib/mustache.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698