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

Side by Side Diff: pkg/dartdoc/lib/src/markdown/inline_parser.dart

Issue 11266050: Rename regexp methods to getters. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebase and update status files with co19 issue number. Created 8 years, 1 month 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 | « pkg/dartdoc/lib/mirrors.dart ('k') | pkg/intl/lib/bidi_utils.dart » ('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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 /// Maintains the internal state needed to parse inline span elements in 5 /// Maintains the internal state needed to parse inline span elements in
6 /// markdown. 6 /// markdown.
7 class InlineParser { 7 class InlineParser {
8 static List<InlineSyntax> get syntaxes { 8 static List<InlineSyntax> get syntaxes {
9 // Lazy initialize. 9 // Lazy initialize.
10 if (_syntaxes == null) { 10 if (_syntaxes == null) {
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 149
150 /// Represents one kind of markdown tag that can be parsed. 150 /// Represents one kind of markdown tag that can be parsed.
151 class InlineSyntax { 151 class InlineSyntax {
152 final RegExp pattern; 152 final RegExp pattern;
153 153
154 InlineSyntax(String pattern) 154 InlineSyntax(String pattern)
155 : pattern = new RegExp(pattern, multiLine: true); 155 : pattern = new RegExp(pattern, multiLine: true);
156 156
157 bool tryMatch(InlineParser parser) { 157 bool tryMatch(InlineParser parser) {
158 final startMatch = pattern.firstMatch(parser.currentSource); 158 final startMatch = pattern.firstMatch(parser.currentSource);
159 if ((startMatch != null) && (startMatch.start() == 0)) { 159 if ((startMatch != null) && (startMatch.start == 0)) {
160 // Write any existing plain text up to this point. 160 // Write any existing plain text up to this point.
161 parser.writeText(); 161 parser.writeText();
162 162
163 if (onMatch(parser, startMatch)) { 163 if (onMatch(parser, startMatch)) {
164 parser.consume(startMatch[0].length); 164 parser.consume(startMatch[0].length);
165 } 165 }
166 return true; 166 return true;
167 } 167 }
168 return false; 168 return false;
169 } 169 }
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 /// The children of this node. Will be `null` for text nodes. 347 /// The children of this node. Will be `null` for text nodes.
348 final List<Node> children; 348 final List<Node> children;
349 349
350 TagState(this.startPos, this.endPos, this.syntax) 350 TagState(this.startPos, this.endPos, this.syntax)
351 : children = <Node>[]; 351 : children = <Node>[];
352 352
353 /// Attempts to close this tag by matching the current text against its end 353 /// Attempts to close this tag by matching the current text against its end
354 /// pattern. 354 /// pattern.
355 bool tryMatch(InlineParser parser) { 355 bool tryMatch(InlineParser parser) {
356 Match endMatch = syntax.endPattern.firstMatch(parser.currentSource); 356 Match endMatch = syntax.endPattern.firstMatch(parser.currentSource);
357 if ((endMatch != null) && (endMatch.start() == 0)) { 357 if ((endMatch != null) && (endMatch.start == 0)) {
358 // Close the tag. 358 // Close the tag.
359 close(parser, endMatch); 359 close(parser, endMatch);
360 return true; 360 return true;
361 } 361 }
362 362
363 return false; 363 return false;
364 } 364 }
365 365
366 /// Pops this tag off the stack, completes it, and adds it to the output. 366 /// Pops this tag off the stack, completes it, and adds it to the output.
367 /// Will discard any unmatched tags that happen to be above it on the stack. 367 /// Will discard any unmatched tags that happen to be above it on the stack.
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 parser.consume(endMatch[0].length); 399 parser.consume(endMatch[0].length);
400 } else { 400 } else {
401 // Didn't close correctly so revert to text. 401 // Didn't close correctly so revert to text.
402 parser.start = startPos; 402 parser.start = startPos;
403 parser.advanceBy(endMatch[0].length); 403 parser.advanceBy(endMatch[0].length);
404 } 404 }
405 405
406 return null; 406 return null;
407 } 407 }
408 } 408 }
OLDNEW
« no previous file with comments | « pkg/dartdoc/lib/mirrors.dart ('k') | pkg/intl/lib/bidi_utils.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698