| 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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 (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 |
| 159 if (printHandler == null) { | 159 if (printHandler == null) { |
| 160 world.fatal(message, location); // syntax errors are fatal for now | 160 world.fatal(message, location); // syntax errors are fatal for now |
| 161 } else { | 161 } else { |
| 162 // TODO(terry): Need common World view for css and template parser. | 162 // TODO(terry): Need common World view for css and template parser. |
| 163 // For now this is how we return errors from CSS - ugh. | 163 // For now this is how we return errors from CSS - ugh. |
| 164 printHandler(message); | 164 printHandler(message); |
| 165 } | 165 } |
| 166 } | 166 } |
| 167 | 167 |
| 168 void _warning(String message, [SourceSpan location=null]) { | 168 void _warning(String message, [SourceSpan location=null]) { |
| 169 if (location === null) { | 169 if (location == null) { |
| 170 location = _peekToken.span; | 170 location = _peekToken.span; |
| 171 } | 171 } |
| 172 | 172 |
| 173 if (printHandler == null) { | 173 if (printHandler == null) { |
| 174 world.warning(message, location); | 174 world.warning(message, location); |
| 175 } else { | 175 } else { |
| 176 // TODO(terry): Need common World view for css and template parser. | 176 // TODO(terry): Need common World view for css and template parser. |
| 177 // For now this is how we return errors from CSS - ugh. | 177 // For now this is how we return errors from CSS - ugh. |
| 178 printHandler(message); | 178 printHandler(message); |
| 179 } | 179 } |
| (...skipping 531 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 |