Chromium Code Reviews| 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 /** | 5 /** |
| 6 * An event generating parser of Dart programs. This parser expects | 6 * An event generating parser of Dart programs. This parser expects |
| 7 * all tokens in a linked list (aka a token stream). | 7 * all tokens in a linked list (aka a token stream). |
| 8 * | 8 * |
| 9 * The class [Scanner] is used to generate a token stream. See the | 9 * The class [Scanner] is used to generate a token stream. See the |
| 10 * file scanner.dart. | 10 * file scanner.dart. |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 53 } | 53 } |
| 54 } | 54 } |
| 55 | 55 |
| 56 Token parseMetadataStar(Token token) { | 56 Token parseMetadataStar(Token token) { |
| 57 while (optional('@', token)) { | 57 while (optional('@', token)) { |
| 58 token = parseMetadata(token); | 58 token = parseMetadata(token); |
| 59 } | 59 } |
| 60 return token; | 60 return token; |
| 61 } | 61 } |
| 62 | 62 |
| 63 /** | |
| 64 * Parse | |
| 65 * [: ('@' qualified (‘.’ identifier)? (arguments)?)* :] | |
| 66 */ | |
|
Johnni Winther
2012/08/22 13:25:20
The stated grammar describes a sequence of metadat
ahe
2012/08/22 13:36:47
See below.
Johnni Winther
2012/08/22 13:48:56
I think the comment describes parseMetadataStar wh
ahe
2012/08/22 13:53:10
Correct. Thank you, I couldn't see it.
ahe
2012/08/22 14:15:55
Done.
| |
| 63 Token parseMetadata(Token token) { | 67 Token parseMetadata(Token token) { |
| 64 listener.beginMetadata(token); | 68 listener.beginMetadata(token); |
| 65 Token atToken = token; | 69 Token atToken = token; |
| 66 assert(optional('@', token)); | 70 assert(optional('@', token)); |
| 67 token = parseIdentifier(token.next); | 71 token = parseIdentifier(token.next); |
| 68 token = parseQualifiedRestOpt(token); | 72 token = parseQualifiedRestOpt(token); |
| 73 token = parseQualifiedRestOpt(token); | |
|
Johnni Winther
2012/08/22 13:25:20
Why call this twice? It doesn't the stated grammar
ahe
2012/08/22 13:36:47
qualified is:
identifier ('.' identifier)?
So wh
Johnni Winther
2012/08/22 13:48:56
Ahhh!
| |
| 69 token = parseArgumentsOpt(token); | 74 token = parseArgumentsOpt(token); |
| 70 listener.endMetadata(atToken, token); | 75 listener.endMetadata(atToken, token); |
| 71 return token; | 76 return token; |
| 72 } | 77 } |
| 73 | 78 |
| 74 Token parseInterface(Token token) { | 79 Token parseInterface(Token token) { |
| 75 Token interfaceKeyword = token; | 80 Token interfaceKeyword = token; |
| 76 listener.beginInterface(token); | 81 listener.beginInterface(token); |
| 77 token = parseIdentifier(token.next); | 82 token = parseIdentifier(token.next); |
| 78 token = parseTypeVariablesOpt(token); | 83 token = parseTypeVariablesOpt(token); |
| (...skipping 1744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1823 } | 1828 } |
| 1824 listener.handleContinueStatement(hasTarget, continueKeyword, token); | 1829 listener.handleContinueStatement(hasTarget, continueKeyword, token); |
| 1825 return expectSemicolon(token); | 1830 return expectSemicolon(token); |
| 1826 } | 1831 } |
| 1827 | 1832 |
| 1828 Token parseEmptyStatement(Token token) { | 1833 Token parseEmptyStatement(Token token) { |
| 1829 listener.handleEmptyStatement(token); | 1834 listener.handleEmptyStatement(token); |
| 1830 return expectSemicolon(token); | 1835 return expectSemicolon(token); |
| 1831 } | 1836 } |
| 1832 } | 1837 } |
| OLD | NEW |