OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 dart_style.src.whitespace; | 5 library dart_style.src.whitespace; |
6 | 6 |
7 /// The kind of pending whitespace that has been "written", but not actually | 7 /// The kind of pending whitespace that has been "written", but not actually |
8 /// physically output yet. | 8 /// physically output yet. |
9 /// | 9 /// |
10 /// We defer actually writing whitespace until a non-whitespace token is | 10 /// We defer actually writing whitespace until a non-whitespace token is |
11 /// encountered to avoid trailing whitespace. | 11 /// encountered to avoid trailing whitespace. |
12 class Whitespace { | 12 class Whitespace { |
13 /// A single non-breaking space. | 13 /// A single non-breaking space. |
14 static const SPACE = const Whitespace._("SPACE"); | 14 static const space = const Whitespace._("space"); |
15 | 15 |
16 /// A single newline. | 16 /// A single newline. |
17 static const NEWLINE = const Whitespace._("NEWLINE"); | 17 static const newline = const Whitespace._("newline"); |
18 | 18 |
19 /// A single newline that takes into account the current expression nesting | 19 /// A single newline that takes into account the current expression nesting |
20 /// for the next line. | 20 /// for the next line. |
21 static const NESTED_NEWLINE = const Whitespace._("NESTED_NEWLINE"); | 21 static const nestedNewline = const Whitespace._("nestedNewline"); |
22 | 22 |
23 /// A single newline with all indentation eliminated at the beginning of the | 23 /// A single newline with all indentation eliminated at the beginning of the |
24 /// next line. | 24 /// next line. |
25 /// | 25 /// |
26 /// Used for subsequent lines in a multiline string. | 26 /// Used for subsequent lines in a multiline string. |
27 static const NEWLINE_FLUSH_LEFT = const Whitespace._("NEWLINE_FLUSH_LEFT"); | 27 static const newlineFlushLeft = const Whitespace._("newlineFlushLeft"); |
28 | 28 |
29 /// Two newlines, a single blank line of separation. | 29 /// Two newlines, a single blank line of separation. |
30 static const TWO_NEWLINES = const Whitespace._("TWO_NEWLINES"); | 30 static const twoNewlines = const Whitespace._("twoNewlines"); |
31 | 31 |
32 /// A space or newline should be output based on whether the current token is | 32 /// A space or newline should be output based on whether the current token is |
33 /// on the same line as the previous one or not. | 33 /// on the same line as the previous one or not. |
34 /// | 34 /// |
35 /// In general, we like to avoid using this because it makes the formatter | 35 /// In general, we like to avoid using this because it makes the formatter |
36 /// less prescriptive over the user's whitespace. | 36 /// less prescriptive over the user's whitespace. |
37 static const SPACE_OR_NEWLINE = const Whitespace._("SPACE_OR_NEWLINE"); | 37 static const spaceOrNewline = const Whitespace._("spaceOrNewline"); |
38 | 38 |
39 /// One or two newlines should be output based on how many newlines are | 39 /// One or two newlines should be output based on how many newlines are |
40 /// present between the next token and the previous one. | 40 /// present between the next token and the previous one. |
41 /// | 41 /// |
42 /// In general, we like to avoid using this because it makes the formatter | 42 /// In general, we like to avoid using this because it makes the formatter |
43 /// less prescriptive over the user's whitespace. | 43 /// less prescriptive over the user's whitespace. |
44 static const ONE_OR_TWO_NEWLINES = const Whitespace._("ONE_OR_TWO_NEWLINES"); | 44 static const oneOrTwoNewlines = const Whitespace._("oneOrTwoNewlines"); |
45 | 45 |
46 final String name; | 46 final String name; |
47 | 47 |
48 const Whitespace._(this.name); | 48 const Whitespace._(this.name); |
49 | 49 |
50 String toString() => name; | 50 String toString() => name; |
51 } | 51 } |
OLD | NEW |