| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 | 3 |
| 4 class TagStack { | 4 class TagStack { |
| 5 List<ASTNode> _stack; | 5 List<ASTNode> _stack; |
| 6 | 6 |
| 7 TagStack(var elem) : _stack = [] { | 7 TagStack(var elem) : _stack = [] { |
| 8 _stack.add(elem); | 8 _stack.add(elem); |
| 9 } | 9 } |
| 10 | 10 |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 | 138 |
| 139 void _eatSemicolon() { | 139 void _eatSemicolon() { |
| 140 _eat(TokenKind.SEMICOLON); | 140 _eat(TokenKind.SEMICOLON); |
| 141 } | 141 } |
| 142 | 142 |
| 143 void _errorExpected(String expected) { | 143 void _errorExpected(String expected) { |
| 144 var tok = _next(); | 144 var tok = _next(); |
| 145 var message; | 145 var message; |
| 146 try { | 146 try { |
| 147 message = 'expected $expected, but found $tok'; | 147 message = 'expected $expected, but found $tok'; |
| 148 } catch (final e) { | 148 } catch (e) { |
| 149 message = 'parsing error expected $expected'; | 149 message = 'parsing error expected $expected'; |
| 150 } | 150 } |
| 151 _error(message, tok.span); | 151 _error(message, tok.span); |
| 152 } | 152 } |
| 153 | 153 |
| 154 void _error(String message, [SourceSpan location=null]) { | 154 void _error(String message, [SourceSpan location=null]) { |
| 155 if (location === null) { | 155 if (location === null) { |
| 156 location = _peekToken.span; | 156 location = _peekToken.span; |
| 157 } | 157 } |
| 158 | 158 |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 css.Parser parser = new css.Parser(new SourceFile( | 405 css.Parser parser = new css.Parser(new SourceFile( |
| 406 SourceFile.IN_MEMORY_FILE, cssSource.text), start); | 406 SourceFile.IN_MEMORY_FILE, cssSource.text), start); |
| 407 | 407 |
| 408 css.Stylesheet stylesheet = parser.parse(false, new ErrorMsgRedirector()); | 408 css.Stylesheet stylesheet = parser.parse(false, new ErrorMsgRedirector()); |
| 409 | 409 |
| 410 var lastParsedChar = parser.tokenizer.startIndex; | 410 var lastParsedChar = parser.tokenizer.startIndex; |
| 411 | 411 |
| 412 lastCSSIndexParsed = lastParsedChar; | 412 lastCSSIndexParsed = lastParsedChar; |
| 413 | 413 |
| 414 return stylesheet; | 414 return stylesheet; |
| 415 } catch (final cssParseException) { | 415 } catch (cssParseException) { |
| 416 // TODO(terry): Need SourceSpan from CSS parser to pass onto _error. | 416 // TODO(terry): Need SourceSpan from CSS parser to pass onto _error. |
| 417 _error("Unexcepted CSS error: ${cssParseException.toString()}"); | 417 _error("Unexcepted CSS error: ${cssParseException.toString()}"); |
| 418 } | 418 } |
| 419 } | 419 } |
| 420 | 420 |
| 421 /* TODO(terry): Assume template { }, single close curley as a text node | 421 /* TODO(terry): Assume template { }, single close curley as a text node |
| 422 * inside of the template would need to be escaped maybe \} | 422 * inside of the template would need to be escaped maybe \} |
| 423 */ | 423 */ |
| 424 processHTML(TemplateElement root) { | 424 processHTML(TemplateElement root) { |
| 425 assert(root.isFragment); | 425 assert(root.isFragment); |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 711 } | 711 } |
| 712 | 712 |
| 713 if (stringValue.length > 0) { | 713 if (stringValue.length > 0) { |
| 714 nodes.add(new TemplateText(stringValue.toString(), _makeSpan(start))); | 714 nodes.add(new TemplateText(stringValue.toString(), _makeSpan(start))); |
| 715 } | 715 } |
| 716 | 716 |
| 717 return nodes; | 717 return nodes; |
| 718 } | 718 } |
| 719 | 719 |
| 720 } | 720 } |
| OLD | NEW |