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

Unified Diff: pkg/analysis_server/tool/spec/text_formatter.dart

Issue 725143004: Format and sort analyzer and analysis_server packages. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analysis_server/tool/spec/implied_types.dart ('k') | pkg/analysis_server/tool/spec/to_html.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/tool/spec/text_formatter.dart
diff --git a/pkg/analysis_server/tool/spec/text_formatter.dart b/pkg/analysis_server/tool/spec/text_formatter.dart
index e5f33a2a6c38dd04edf7f775c13ec15d8b842693..a811d68c7c095198e0a49054592dcc87d98bfa40 100644
--- a/pkg/analysis_server/tool/spec/text_formatter.dart
+++ b/pkg/analysis_server/tool/spec/text_formatter.dart
@@ -11,6 +11,8 @@ import 'package:html5lib/dom.dart' as dom;
import 'codegen_tools.dart';
+final RegExp whitespace = new RegExp(r'\s');
+
/**
* Convert the HTML in [desc] into text, word wrapping at width [width].
*
@@ -25,8 +27,6 @@ String nodesToText(List<dom.Node> desc, int width, bool javadocStyle) {
});
}
-final RegExp whitespace = new RegExp(r'\s');
-
/**
* Engine that transforms HTML to text. The input HTML is processed one
* character at a time, gathering characters into words and words into lines.
@@ -71,23 +71,6 @@ class _TextFormatter extends CodeGenerator {
_TextFormatter(this.width, this.javadocStyle);
/**
- * Escape the given character for HTML.
- */
- String escape(String char) {
- if (javadocStyle) {
- switch (char) {
- case '<':
- return '&lt;';
- case '>':
- return '&gt;';
- case '&':
- return '&amp;';
- }
- }
- return char;
- }
-
- /**
* Process an HTML node.
*/
void add(dom.Node node) {
@@ -191,34 +174,29 @@ class _TextFormatter extends CodeGenerator {
}
/**
- * Insert vertical space if necessary.
+ * Process a list of HTML nodes.
*/
- void resolveVerticalSpace() {
- if (verticalSpaceNeeded) {
- writeln();
- verticalSpaceNeeded = false;
+ void addAll(List<dom.Node> nodes) {
+ for (dom.Node node in nodes) {
+ add(node);
}
}
/**
- * Terminate the current word, if a word is in progress.
+ * Escape the given character for HTML.
*/
- void wordBreak() {
- if (word.isNotEmpty) {
- atStart = false;
- if (line.isNotEmpty) {
- if (indentWidth + line.length + 1 + word.length <= width)
- {
- line += ' $word';
- } else {
- writeln(line);
- line = word;
- }
- } else {
- line = word;
+ String escape(String char) {
+ if (javadocStyle) {
+ switch (char) {
+ case '<':
+ return '&lt;';
+ case '>':
+ return '&gt;';
+ case '&':
+ return '&amp;';
}
- word = '';
}
+ return char;
}
/**
@@ -236,11 +214,32 @@ class _TextFormatter extends CodeGenerator {
}
/**
- * Process a list of HTML nodes.
+ * Insert vertical space if necessary.
*/
- void addAll(List<dom.Node> nodes) {
- for (dom.Node node in nodes) {
- add(node);
+ void resolveVerticalSpace() {
+ if (verticalSpaceNeeded) {
+ writeln();
+ verticalSpaceNeeded = false;
+ }
+ }
+
+ /**
+ * Terminate the current word, if a word is in progress.
+ */
+ void wordBreak() {
+ if (word.isNotEmpty) {
+ atStart = false;
+ if (line.isNotEmpty) {
+ if (indentWidth + line.length + 1 + word.length <= width) {
+ line += ' $word';
+ } else {
+ writeln(line);
+ line = word;
+ }
+ } else {
+ line = word;
+ }
+ word = '';
}
}
}
« no previous file with comments | « pkg/analysis_server/tool/spec/implied_types.dart ('k') | pkg/analysis_server/tool/spec/to_html.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698