OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 analyzer.test.generated.parser_test; | 5 library analyzer.test.generated.parser_test; |
6 | 6 |
7 import 'package:analyzer/dart/ast/ast.dart'; | 7 import 'package:analyzer/dart/ast/ast.dart'; |
8 import 'package:analyzer/dart/ast/token.dart'; | 8 import 'package:analyzer/dart/ast/token.dart'; |
9 import 'package:analyzer/dart/ast/visitor.dart'; | 9 import 'package:analyzer/dart/ast/visitor.dart'; |
10 import 'package:analyzer/src/dart/ast/token.dart'; | 10 import 'package:analyzer/src/dart/ast/token.dart'; |
(...skipping 6263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6274 parse("parseCommentReference", <Object>["new a", 5], ""); | 6274 parse("parseCommentReference", <Object>["new a", 5], ""); |
6275 SimpleIdentifier identifier = EngineTestCase.assertInstanceOf( | 6275 SimpleIdentifier identifier = EngineTestCase.assertInstanceOf( |
6276 (obj) => obj is SimpleIdentifier, | 6276 (obj) => obj is SimpleIdentifier, |
6277 SimpleIdentifier, | 6277 SimpleIdentifier, |
6278 reference.identifier); | 6278 reference.identifier); |
6279 expect(identifier.token, isNotNull); | 6279 expect(identifier.token, isNotNull); |
6280 expect(identifier.name, "a"); | 6280 expect(identifier.name, "a"); |
6281 expect(identifier.offset, 9); | 6281 expect(identifier.offset, 9); |
6282 } | 6282 } |
6283 | 6283 |
| 6284 void test_parseCommentReference_operator_withKeyword_notPrefixed() { |
| 6285 CommentReference reference = |
| 6286 parse("parseCommentReference", <Object>["operator ==", 5], ""); |
| 6287 SimpleIdentifier identifier = EngineTestCase.assertInstanceOf( |
| 6288 (obj) => obj is SimpleIdentifier, |
| 6289 SimpleIdentifier, |
| 6290 reference.identifier); |
| 6291 expect(identifier.token, isNotNull); |
| 6292 expect(identifier.name, "=="); |
| 6293 expect(identifier.offset, 14); |
| 6294 } |
| 6295 |
| 6296 void test_parseCommentReference_operator_withKeyword_prefixed() { |
| 6297 CommentReference reference = |
| 6298 parse("parseCommentReference", <Object>["Object.operator==", 7], ""); |
| 6299 PrefixedIdentifier prefixedIdentifier = EngineTestCase.assertInstanceOf( |
| 6300 (obj) => obj is PrefixedIdentifier, |
| 6301 PrefixedIdentifier, |
| 6302 reference.identifier); |
| 6303 SimpleIdentifier prefix = prefixedIdentifier.prefix; |
| 6304 expect(prefix.token, isNotNull); |
| 6305 expect(prefix.name, "Object"); |
| 6306 expect(prefix.offset, 7); |
| 6307 expect(prefixedIdentifier.period, isNotNull); |
| 6308 SimpleIdentifier identifier = prefixedIdentifier.identifier; |
| 6309 expect(identifier.token, isNotNull); |
| 6310 expect(identifier.name, "=="); |
| 6311 expect(identifier.offset, 22); |
| 6312 } |
| 6313 |
| 6314 void test_parseCommentReference_operator_withoutKeyword_notPrefixed() { |
| 6315 CommentReference reference = |
| 6316 parse("parseCommentReference", <Object>["==", 5], ""); |
| 6317 SimpleIdentifier identifier = EngineTestCase.assertInstanceOf( |
| 6318 (obj) => obj is SimpleIdentifier, |
| 6319 SimpleIdentifier, |
| 6320 reference.identifier); |
| 6321 expect(identifier.token, isNotNull); |
| 6322 expect(identifier.name, "=="); |
| 6323 expect(identifier.offset, 5); |
| 6324 } |
| 6325 |
| 6326 void test_parseCommentReference_operator_withoutKeyword_prefixed() { |
| 6327 CommentReference reference = |
| 6328 parse("parseCommentReference", <Object>["Object.==", 7], ""); |
| 6329 PrefixedIdentifier prefixedIdentifier = EngineTestCase.assertInstanceOf( |
| 6330 (obj) => obj is PrefixedIdentifier, |
| 6331 PrefixedIdentifier, |
| 6332 reference.identifier); |
| 6333 SimpleIdentifier prefix = prefixedIdentifier.prefix; |
| 6334 expect(prefix.token, isNotNull); |
| 6335 expect(prefix.name, "Object"); |
| 6336 expect(prefix.offset, 7); |
| 6337 expect(prefixedIdentifier.period, isNotNull); |
| 6338 SimpleIdentifier identifier = prefixedIdentifier.identifier; |
| 6339 expect(identifier.token, isNotNull); |
| 6340 expect(identifier.name, "=="); |
| 6341 expect(identifier.offset, 14); |
| 6342 } |
| 6343 |
6284 void test_parseCommentReference_prefixed() { | 6344 void test_parseCommentReference_prefixed() { |
6285 CommentReference reference = | 6345 CommentReference reference = |
6286 parse("parseCommentReference", <Object>["a.b", 7], ""); | 6346 parse("parseCommentReference", <Object>["a.b", 7], ""); |
6287 PrefixedIdentifier prefixedIdentifier = EngineTestCase.assertInstanceOf( | 6347 PrefixedIdentifier prefixedIdentifier = EngineTestCase.assertInstanceOf( |
6288 (obj) => obj is PrefixedIdentifier, | 6348 (obj) => obj is PrefixedIdentifier, |
6289 PrefixedIdentifier, | 6349 PrefixedIdentifier, |
6290 reference.identifier); | 6350 reference.identifier); |
6291 SimpleIdentifier prefix = prefixedIdentifier.prefix; | 6351 SimpleIdentifier prefix = prefixedIdentifier.prefix; |
6292 expect(prefix.token, isNotNull); | 6352 expect(prefix.token, isNotNull); |
6293 expect(prefix.name, "a"); | 6353 expect(prefix.name, "a"); |
(...skipping 4992 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11286 new Scanner(null, new CharSequenceReader(source), listener); | 11346 new Scanner(null, new CharSequenceReader(source), listener); |
11287 Token tokenStream = scanner.tokenize(); | 11347 Token tokenStream = scanner.tokenize(); |
11288 // | 11348 // |
11289 // Parse the source. | 11349 // Parse the source. |
11290 // | 11350 // |
11291 Parser parser = new Parser(null, listener); | 11351 Parser parser = new Parser(null, listener); |
11292 return invokeParserMethodImpl( | 11352 return invokeParserMethodImpl( |
11293 parser, methodName, <Object>[tokenStream], tokenStream) as Token; | 11353 parser, methodName, <Object>[tokenStream], tokenStream) as Token; |
11294 } | 11354 } |
11295 } | 11355 } |
OLD | NEW |