| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 fasta.scanner.precedence; | 5 library fasta.scanner.precedence; |
| 6 | 6 |
| 7 import '../../scanner/token.dart'; | 7 import '../../scanner/token.dart'; |
| 8 import 'token_constants.dart'; | 8 import 'token_constants.dart'; |
| 9 | 9 |
| 10 class PrecedenceInfo implements TokenType { | 10 class PrecedenceInfo implements TokenType { |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 OPEN_CURLY_BRACKET_INFO, | 86 OPEN_CURLY_BRACKET_INFO, |
| 87 CLOSE_CURLY_BRACKET_INFO, | 87 CLOSE_CURLY_BRACKET_INFO, |
| 88 INT_INFO, | 88 INT_INFO, |
| 89 STRING_INFO, | 89 STRING_INFO, |
| 90 OPEN_SQUARE_BRACKET_INFO, | 90 OPEN_SQUARE_BRACKET_INFO, |
| 91 CLOSE_SQUARE_BRACKET_INFO, | 91 CLOSE_SQUARE_BRACKET_INFO, |
| 92 DOUBLE_INFO, | 92 DOUBLE_INFO, |
| 93 STRING_INTERPOLATION_INFO, | 93 STRING_INTERPOLATION_INFO, |
| 94 STRING_INTERPOLATION_IDENTIFIER_INFO, | 94 STRING_INTERPOLATION_IDENTIFIER_INFO, |
| 95 HEXADECIMAL_INFO, | 95 HEXADECIMAL_INFO, |
| 96 COMMENT_INFO, | 96 SINGLE_LINE_COMMENT_INFO, |
| 97 MULTI_LINE_COMMENT_INFO, |
| 97 ]; | 98 ]; |
| 98 | 99 |
| 99 @override | 100 @override |
| 100 bool get isAdditiveOperator => precedence == ADDITIVE_PRECEDENCE; | 101 bool get isAdditiveOperator => precedence == ADDITIVE_PRECEDENCE; |
| 101 | 102 |
| 102 @override | 103 @override |
| 103 bool get isAssignmentOperator => precedence == ASSIGNMENT_PRECEDENCE; | 104 bool get isAssignmentOperator => precedence == ASSIGNMENT_PRECEDENCE; |
| 104 | 105 |
| 105 @override | 106 @override |
| 106 bool get isAssociativeOperator => | 107 bool get isAssociativeOperator => |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 const int POSTFIX_PRECEDENCE = 16; | 331 const int POSTFIX_PRECEDENCE = 16; |
| 331 const PrecedenceInfo PERIOD_INFO = | 332 const PrecedenceInfo PERIOD_INFO = |
| 332 const PrecedenceInfo('.', 'PERIOD', POSTFIX_PRECEDENCE, PERIOD_TOKEN); | 333 const PrecedenceInfo('.', 'PERIOD', POSTFIX_PRECEDENCE, PERIOD_TOKEN); |
| 333 const PrecedenceInfo QUESTION_PERIOD_INFO = const PrecedenceInfo( | 334 const PrecedenceInfo QUESTION_PERIOD_INFO = const PrecedenceInfo( |
| 334 '?.', 'QUESTION_PERIOD', POSTFIX_PRECEDENCE, QUESTION_PERIOD_TOKEN, | 335 '?.', 'QUESTION_PERIOD', POSTFIX_PRECEDENCE, QUESTION_PERIOD_TOKEN, |
| 335 isOperator: true); | 336 isOperator: true); |
| 336 | 337 |
| 337 const PrecedenceInfo KEYWORD_INFO = | 338 const PrecedenceInfo KEYWORD_INFO = |
| 338 const PrecedenceInfo('keyword', 'KEYWORD', 0, KEYWORD_TOKEN); | 339 const PrecedenceInfo('keyword', 'KEYWORD', 0, KEYWORD_TOKEN); |
| 339 | 340 |
| 340 const PrecedenceInfo EOF_INFO = | 341 const PrecedenceInfo EOF_INFO = const PrecedenceInfo('', 'EOF', 0, EOF_TOKEN); |
| 341 const PrecedenceInfo('', 'EOF', 0, EOF_TOKEN); | |
| 342 | 342 |
| 343 /// Precedence info used by synthetic tokens that are created during parser | 343 /// Precedence info used by synthetic tokens that are created during parser |
| 344 /// recovery (non-analyzer use case). | 344 /// recovery (non-analyzer use case). |
| 345 const PrecedenceInfo RECOVERY_INFO = | 345 const PrecedenceInfo RECOVERY_INFO = |
| 346 const PrecedenceInfo('recovery', 'RECOVERY', 0, RECOVERY_TOKEN); | 346 const PrecedenceInfo('recovery', 'RECOVERY', 0, RECOVERY_TOKEN); |
| 347 | 347 |
| 348 const PrecedenceInfo IDENTIFIER_INFO = | 348 const PrecedenceInfo IDENTIFIER_INFO = |
| 349 const PrecedenceInfo('identifier', 'STRING_INT', 0, IDENTIFIER_TOKEN); | 349 const PrecedenceInfo('identifier', 'STRING_INT', 0, IDENTIFIER_TOKEN); |
| 350 | 350 |
| 351 const PrecedenceInfo SCRIPT_INFO = | 351 const PrecedenceInfo SCRIPT_INFO = |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 const PrecedenceInfo STRING_INTERPOLATION_INFO = const PrecedenceInfo( | 384 const PrecedenceInfo STRING_INTERPOLATION_INFO = const PrecedenceInfo( |
| 385 '\${', 'STRING_INTERPOLATION_EXPRESSION', 0, STRING_INTERPOLATION_TOKEN); | 385 '\${', 'STRING_INTERPOLATION_EXPRESSION', 0, STRING_INTERPOLATION_TOKEN); |
| 386 | 386 |
| 387 const PrecedenceInfo STRING_INTERPOLATION_IDENTIFIER_INFO = | 387 const PrecedenceInfo STRING_INTERPOLATION_IDENTIFIER_INFO = |
| 388 const PrecedenceInfo('\$', 'STRING_INTERPOLATION_IDENTIFIER', 0, | 388 const PrecedenceInfo('\$', 'STRING_INTERPOLATION_IDENTIFIER', 0, |
| 389 STRING_INTERPOLATION_IDENTIFIER_TOKEN); | 389 STRING_INTERPOLATION_IDENTIFIER_TOKEN); |
| 390 | 390 |
| 391 const PrecedenceInfo HEXADECIMAL_INFO = | 391 const PrecedenceInfo HEXADECIMAL_INFO = |
| 392 const PrecedenceInfo('hexadecimal', 'HEXADECIMAL', 0, HEXADECIMAL_TOKEN); | 392 const PrecedenceInfo('hexadecimal', 'HEXADECIMAL', 0, HEXADECIMAL_TOKEN); |
| 393 | 393 |
| 394 const PrecedenceInfo COMMENT_INFO = | 394 const PrecedenceInfo SINGLE_LINE_COMMENT_INFO = |
| 395 const PrecedenceInfo('comment', 'COMMENT', 0, COMMENT_TOKEN); | 395 const PrecedenceInfo('comment', 'SINGLE_LINE_COMMENT', 0, COMMENT_TOKEN); |
| 396 |
| 397 const PrecedenceInfo MULTI_LINE_COMMENT_INFO = |
| 398 const PrecedenceInfo('comment', 'MULTI_LINE_COMMENT', 0, COMMENT_TOKEN); |
| OLD | NEW |