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

Unified Diff: editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/html/XmlParser.java

Issue 11673007: Improve our html editor; add syntax highlighting for script tags; hyperlink detection and navigatio… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 12 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 side-by-side diff with in-line comments
Download patch
Index: editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/html/XmlParser.java
===================================================================
--- editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/html/XmlParser.java (revision 16584)
+++ editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/html/XmlParser.java (working copy)
@@ -108,9 +108,9 @@
element.setStart(startToken);
- readAttributes(element);
+ Token lastReadToken = readAttributes(element);
- Token endToken = null;
+ Token endToken = (lastReadToken == null ? tagName : lastReadToken);
boolean autoClosed = false;
while (tokenizer.hasNext()) {
@@ -187,6 +187,16 @@
}
}
+ private boolean peekComments() {
+ Token token = tokenizer.peek();
+
+ if (token != null && token.getValue().startsWith("<!--")) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
private void popTag(XmlNode endNode) {
String label = endNode.getLabel();
@@ -217,18 +227,22 @@
stack.push(tag);
}
- private void readAttributes(XmlElement element) {
+ private Token readAttributes(XmlElement element) {
+ Token last = null;
+
while (true) {
- if (peek(">") || peek("/>") || peek("<")) {
- return;
+ if (peek(">") || peek("/>") || peek("<") || peekComments()) {
+ return last;
} else {
// foo=foo
Token token = tokenizer.next();
if (token == null) {
- return;
+ return last;
}
+ last = token;
+
XmlAttribute attribute = new XmlAttribute(token.getValue());
attribute.setStart(token);

Powered by Google App Engine
This is Rietveld 408576698