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

Side by Side Diff: utils/peg/pegparser.dart

Issue 10991031: Update peg parser tests to r'' strings (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | utils/tests/peg/peg.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #library('Peg Parser'); 5 #library('Peg Parser');
6 6
7 /* 7 /*
8 * The following functions are combinators for building Rules. 8 * The following functions are combinators for building Rules.
9 * 9 *
10 * A rule is one of the following 10 * A rule is one of the following
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 : "'${state._text[state.max_pos]}'"; 280 : "'${state._text[state.max_pos]}'";
281 message = 'Expected $expected but found $found'; 281 message = 'Expected $expected but found $found';
282 } 282 }
283 int start = state.max_pos; 283 int start = state.max_pos;
284 int end = start; 284 int end = start;
285 while (start >= 1 && state._text[start - 1] != '\n') --start; 285 while (start >= 1 && state._text[start - 1] != '\n') --start;
286 while (end < state._text.length && state._text[end] != '\n') ++end; 286 while (end < state._text.length && state._text[end] != '\n') ++end;
287 var line = state._text.substring(start, end); 287 var line = state._text.substring(start, end);
288 var indicator = ''; 288 var indicator = '';
289 for (var i = 0; i < line.length && start + i < state.max_pos; i++) 289 for (var i = 0; i < line.length && start + i < state.max_pos; i++)
290 indicator = indicator + ' '; 290 indicator = ' $indicator';
291 indicator = indicator + '^'; 291 indicator = '$indicator^';
292 // TODO: Convert to an exception. 292 // TODO: Convert to an exception.
293 print(message); 293 print(message);
294 print(line); 294 print(line);
295 print(indicator); 295 print(indicator);
296 return null; 296 return null;
297 } 297 }
298 } 298 }
299 299
300 class Symbol { 300 class Symbol {
301 final String name; 301 final String name;
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 sb.add(rule); 607 sb.add(rule);
608 separator = ','; 608 separator = ',';
609 } 609 }
610 sb.add(')'); 610 sb.add(')');
611 return sb.toString(); 611 return sb.toString();
612 } 612 }
613 613
614 class _SequenceRule extends _Rule { 614 class _SequenceRule extends _Rule {
615 // This rule matches the component rules in order. 615 // This rule matches the component rules in order.
616 final List<_Rule> _rules; 616 final List<_Rule> _rules;
617 final int _generatingSubRules = 0; 617 final int _generatingSubRules;
618 final Function _reducer; 618 final Function _reducer;
619 bool _generatesValue; 619 bool _generatesValue;
620 _SequenceRule(List<_Rule> this._rules, 620 _SequenceRule(List<_Rule> this._rules,
621 int this._generatingSubRules, 621 int this._generatingSubRules,
622 Function this._reducer) { 622 Function this._reducer) {
623 _generatesValue = _generatingSubRules > 0 || _reducer != null; 623 _generatesValue = _generatingSubRules > 0 || _reducer != null;
624 } 624 }
625 625
626 _match(state, pos) { 626 _match(state, pos) {
627 var sequence = []; 627 var sequence = [];
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
849 add(s); 849 add(s);
850 add(t); 850 add(t);
851 add(u); 851 add(u);
852 add(v); 852 add(v);
853 add(w); 853 add(w);
854 add(x); 854 add(x);
855 add(y); 855 add(y);
856 add(z); 856 add(z);
857 return list; 857 return list;
858 } 858 }
OLDNEW
« no previous file with comments | « no previous file | utils/tests/peg/peg.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698