| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 trydart.editor; | 5 library trydart.editor; |
| 6 | 6 |
| 7 import 'dart:html'; | 7 import 'dart:html'; |
| 8 | 8 |
| 9 import 'package:compiler/implementation/scanner/scannerlib.dart' show | 9 import 'package:compiler/implementation/scanner/scannerlib.dart' show |
| 10 EOF_TOKEN, | 10 EOF_TOKEN, |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 | 225 |
| 226 if (!foundNode) { | 226 if (!foundNode) { |
| 227 outputDiv.appendText('$message\n'); | 227 outputDiv.appendText('$message\n'); |
| 228 } | 228 } |
| 229 | 229 |
| 230 observer.takeRecords(); | 230 observer.takeRecords(); |
| 231 observer.observe( | 231 observer.observe( |
| 232 mainEditorPane, childList: true, characterData: true, subtree: true); | 232 mainEditorPane, childList: true, characterData: true, subtree: true); |
| 233 } | 233 } |
| 234 | 234 |
| 235 void inlineChildren(Element element) { | |
| 236 if (element == null) return; | |
| 237 var parent = element.parentNode; | |
| 238 if (parent == null) return; | |
| 239 for (Node child in new List.from(element.nodes)) { | |
| 240 child.remove(); | |
| 241 parent.insertBefore(child, element); | |
| 242 } | |
| 243 element.remove(); | |
| 244 } | |
| 245 | |
| 246 Decoration getDecoration(Token token) { | 235 Decoration getDecoration(Token token) { |
| 247 if (token is ErrorToken) { | 236 if (token is ErrorToken) { |
| 248 isMalformedInput = true; | 237 isMalformedInput = true; |
| 249 return new DiagnosticDecoration('error', token.assertionMessage); | 238 return new DiagnosticDecoration('error', token.assertionMessage); |
| 250 } | 239 } |
| 251 String tokenValue = token.value; | 240 String tokenValue = token.value; |
| 252 String tokenInfo = token.info.value; | 241 String tokenInfo = token.info.value; |
| 253 if (tokenInfo == 'string') return currentTheme.string; | 242 if (tokenInfo == 'string') return currentTheme.string; |
| 254 if (tokenInfo == 'identifier') { | 243 if (tokenInfo == 'identifier') { |
| 255 seenIdentifiers.add(tokenValue); | 244 seenIdentifiers.add(tokenValue); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 270 | 259 |
| 271 diagnostic(text, tip) { | 260 diagnostic(text, tip) { |
| 272 if (text is String) { | 261 if (text is String) { |
| 273 text = new Text(text); | 262 text = new Text(text); |
| 274 } | 263 } |
| 275 return new AnchorElement() | 264 return new AnchorElement() |
| 276 ..classes.add('diagnostic') | 265 ..classes.add('diagnostic') |
| 277 ..append(text) | 266 ..append(text) |
| 278 ..append(tip); | 267 ..append(tip); |
| 279 } | 268 } |
| OLD | NEW |