@@ -70,6 +70,7 @@ Map<ST, List<List<ST>>> grammar = <ST, List<List<ST>>>{
70
70
],
71
71
ST .selectPart: < List <ST >> [
72
72
< ST > [ST .identifier, ST .openBrace, ST .message, ST .closeBrace],
73
+ < ST > [ST .number, ST .openBrace, ST .message, ST .closeBrace],
73
74
< ST > [ST .other, ST .openBrace, ST .message, ST .closeBrace],
74
75
],
75
76
};
@@ -408,6 +409,7 @@ class Parser {
408
409
case ST .selectParts:
409
410
if (tokens.isNotEmpty && (
410
411
tokens[0 ].type == ST .identifier ||
412
+ tokens[0 ].type == ST .number ||
411
413
tokens[0 ].type == ST .other
412
414
)) {
413
415
parseAndConstructNode (ST .selectParts, 0 );
@@ -418,8 +420,10 @@ class Parser {
418
420
case ST .selectPart:
419
421
if (tokens.isNotEmpty && tokens[0 ].type == ST .identifier) {
420
422
parseAndConstructNode (ST .selectPart, 0 );
421
- } else if (tokens.isNotEmpty && tokens[0 ].type == ST .other ) {
423
+ } else if (tokens.isNotEmpty && tokens[0 ].type == ST .number ) {
422
424
parseAndConstructNode (ST .selectPart, 1 );
425
+ } else if (tokens.isNotEmpty && tokens[0 ].type == ST .other) {
426
+ parseAndConstructNode (ST .selectPart, 2 );
423
427
} else {
424
428
throw L10nParserException (
425
429
'ICU Syntax Error: Select parts must be of the form "identifier { message }"' ,
@@ -581,6 +585,10 @@ class Parser {
581
585
checkExtraRules (syntaxTree);
582
586
return syntaxTree;
583
587
} on L10nParserException catch (error) {
588
+ // For debugging purposes.
589
+ if (logger == null ) {
590
+ rethrow ;
591
+ }
584
592
logger? .printError (error.toString ());
585
593
return Node (ST .empty, 0 , value: '' );
586
594
}
0 commit comments