OLD | NEW |
---|---|
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 part of js; | 5 part of js; |
6 | 6 |
7 abstract class NodeVisitor<T> { | 7 abstract class NodeVisitor<T> { |
8 T visitProgram(Program node); | 8 T visitProgram(Program node); |
9 | 9 |
10 T visitBlock(Block node); | 10 T visitBlock(Block node); |
(...skipping 1063 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1074 | 1074 |
1075 LiteralString string(String value) => js.string(value); | 1075 LiteralString string(String value) => js.string(value); |
1076 | 1076 |
1077 class MiniJsParserError { | 1077 class MiniJsParserError { |
1078 MiniJsParserError(this.parser, this.message) { } | 1078 MiniJsParserError(this.parser, this.message) { } |
1079 | 1079 |
1080 MiniJsParser parser; | 1080 MiniJsParser parser; |
1081 String message; | 1081 String message; |
1082 | 1082 |
1083 String toString() { | 1083 String toString() { |
1084 var codes = | 1084 var codes = |
floitsch
2013/02/26 13:54:19
put on same line.
Lasse Reichstein Nielsen
2013/02/26 15:26:00
Done, and changed to be .filled.
| |
1085 new List.fixedLength(parser.lastPosition, fill: charCodes.$SPACE); | 1085 new List(parser.lastPosition, fill: charCodes.$SPACE); |
1086 var spaces = new String.fromCharCodes(codes); | 1086 var spaces = new String.fromCharCodes(codes); |
1087 return "Error in MiniJsParser:\n${parser.src}\n$spaces^\n$spaces$message\n"; | 1087 return "Error in MiniJsParser:\n${parser.src}\n$spaces^\n$spaces$message\n"; |
1088 } | 1088 } |
1089 } | 1089 } |
1090 | 1090 |
1091 /// Mini JavaScript parser for tiny snippets of code that we want to make into | 1091 /// Mini JavaScript parser for tiny snippets of code that we want to make into |
1092 /// AST nodes. Handles: | 1092 /// AST nodes. Handles: |
1093 /// * identifiers. | 1093 /// * identifiers. |
1094 /// * dot access. | 1094 /// * dot access. |
1095 /// * method calls. | 1095 /// * method calls. |
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1484 | 1484 |
1485 Expression expression() { | 1485 Expression expression() { |
1486 Expression expression = parseVarDeclarationOrExpression(); | 1486 Expression expression = parseVarDeclarationOrExpression(); |
1487 if (lastCategory != NONE || position != src.length) { | 1487 if (lastCategory != NONE || position != src.length) { |
1488 throw new MiniJsParserError( | 1488 throw new MiniJsParserError( |
1489 this, "Unparsed junk: ${categoryToString(lastCategory)}"); | 1489 this, "Unparsed junk: ${categoryToString(lastCategory)}"); |
1490 } | 1490 } |
1491 return expression; | 1491 return expression; |
1492 } | 1492 } |
1493 } | 1493 } |
OLD | NEW |