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

Side by Side Diff: pkg/dartdoc/block_parser.dart

Issue 10919024: - Change "static final" to "static const" in the (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 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 | « pkg/args/args.dart ('k') | pkg/dartdoc/classify.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 /// The line contains only whitespace or is empty. 5 /// The line contains only whitespace or is empty.
6 final _RE_EMPTY = const RegExp(@'^([ \t]*)$'); 6 const _RE_EMPTY = const RegExp(@'^([ \t]*)$');
7 7
8 /// A series of `=` or `-` (on the next line) define setext-style headers. 8 /// A series of `=` or `-` (on the next line) define setext-style headers.
9 final _RE_SETEXT = const RegExp(@'^((=+)|(-+))$'); 9 const _RE_SETEXT = const RegExp(@'^((=+)|(-+))$');
10 10
11 /// Leading (and trailing) `#` define atx-style headers. 11 /// Leading (and trailing) `#` define atx-style headers.
12 final _RE_HEADER = const RegExp(@'^(#{1,6})(.*?)#*$'); 12 const _RE_HEADER = const RegExp(@'^(#{1,6})(.*?)#*$');
13 13
14 /// The line starts with `>` with one optional space after. 14 /// The line starts with `>` with one optional space after.
15 final _RE_BLOCKQUOTE = const RegExp(@'^[ ]{0,3}>[ ]?(.*)$'); 15 const _RE_BLOCKQUOTE = const RegExp(@'^[ ]{0,3}>[ ]?(.*)$');
16 16
17 /// A line indented four spaces. Used for code blocks and lists. 17 /// A line indented four spaces. Used for code blocks and lists.
18 final _RE_INDENT = const RegExp(@'^(?: |\t)(.*)$'); 18 const _RE_INDENT = const RegExp(@'^(?: |\t)(.*)$');
19 19
20 /// Three or more hyphens, asterisks or underscores by themselves. Note that 20 /// Three or more hyphens, asterisks or underscores by themselves. Note that
21 /// a line like `----` is valid as both HR and SETEXT. In case of a tie, 21 /// a line like `----` is valid as both HR and SETEXT. In case of a tie,
22 /// SETEXT should win. 22 /// SETEXT should win.
23 final _RE_HR = const RegExp(@'^[ ]{0,3}((-+[ ]{0,2}){3,}|' 23 const _RE_HR = const RegExp(@'^[ ]{0,3}((-+[ ]{0,2}){3,}|'
24 @'(_+[ ]{0,2}){3,}|' 24 @'(_+[ ]{0,2}){3,}|'
25 @'(\*+[ ]{0,2}){3,})$'); 25 @'(\*+[ ]{0,2}){3,})$');
26 26
27 /// Really hacky way to detect block-level embedded HTML. Just looks for 27 /// Really hacky way to detect block-level embedded HTML. Just looks for
28 /// "<somename". 28 /// "<somename".
29 final _RE_HTML = const RegExp(@'^<[ ]*\w+[ >]'); 29 const _RE_HTML = const RegExp(@'^<[ ]*\w+[ >]');
30 30
31 /// A line starting with one of these markers: `-`, `*`, `+`. May have up to 31 /// A line starting with one of these markers: `-`, `*`, `+`. May have up to
32 /// three leading spaces before the marker and any number of spaces or tabs 32 /// three leading spaces before the marker and any number of spaces or tabs
33 /// after. 33 /// after.
34 final _RE_UL = const RegExp(@'^[ ]{0,3}[*+-][ \t]+(.*)$'); 34 const _RE_UL = const RegExp(@'^[ ]{0,3}[*+-][ \t]+(.*)$');
35 35
36 /// A line starting with a number like `123.`. May have up to three leading 36 /// A line starting with a number like `123.`. May have up to three leading
37 /// spaces before the marker and any number of spaces or tabs after. 37 /// spaces before the marker and any number of spaces or tabs after.
38 final _RE_OL = const RegExp(@'^[ ]{0,3}\d+\.[ \t]+(.*)$'); 38 const _RE_OL = const RegExp(@'^[ ]{0,3}\d+\.[ \t]+(.*)$');
39 39
40 /// Maintains the internal state needed to parse a series of lines into blocks 40 /// Maintains the internal state needed to parse a series of lines into blocks
41 /// of markdown suitable for further inline parsing. 41 /// of markdown suitable for further inline parsing.
42 class BlockParser { 42 class BlockParser {
43 final List<String> lines; 43 final List<String> lines;
44 44
45 /// The markdown document this parser is parsing. 45 /// The markdown document this parser is parsing.
46 final Document document; 46 final Document document;
47 47
48 /// Index of the current line. 48 /// Index of the current line.
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 while (!BlockSyntax.isAtBlockEnd(parser)) { 427 while (!BlockSyntax.isAtBlockEnd(parser)) {
428 childLines.add(parser.current); 428 childLines.add(parser.current);
429 parser.advance(); 429 parser.advance();
430 } 430 }
431 431
432 final contents = parser.document.parseInline( 432 final contents = parser.document.parseInline(
433 Strings.join(childLines, '\n')); 433 Strings.join(childLines, '\n'));
434 return new Element('p', contents); 434 return new Element('p', contents);
435 } 435 }
436 } 436 }
OLDNEW
« no previous file with comments | « pkg/args/args.dart ('k') | pkg/dartdoc/classify.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698