@@ -70,6 +70,7 @@ Map<ST, List<List<ST>>> grammar = <ST, List<List<ST>>>{
7070 ],
7171 ST .selectPart: < List <ST >> [
7272 < ST > [ST .identifier, ST .openBrace, ST .message, ST .closeBrace],
73+ < ST > [ST .number, ST .openBrace, ST .message, ST .closeBrace],
7374 < ST > [ST .other, ST .openBrace, ST .message, ST .closeBrace],
7475 ],
7576};
@@ -408,6 +409,7 @@ class Parser {
408409 case ST .selectParts:
409410 if (tokens.isNotEmpty && (
410411 tokens[0 ].type == ST .identifier ||
412+ tokens[0 ].type == ST .number ||
411413 tokens[0 ].type == ST .other
412414 )) {
413415 parseAndConstructNode (ST .selectParts, 0 );
@@ -418,8 +420,10 @@ class Parser {
418420 case ST .selectPart:
419421 if (tokens.isNotEmpty && tokens[0 ].type == ST .identifier) {
420422 parseAndConstructNode (ST .selectPart, 0 );
421- } else if (tokens.isNotEmpty && tokens[0 ].type == ST .other ) {
423+ } else if (tokens.isNotEmpty && tokens[0 ].type == ST .number ) {
422424 parseAndConstructNode (ST .selectPart, 1 );
425+ } else if (tokens.isNotEmpty && tokens[0 ].type == ST .other) {
426+ parseAndConstructNode (ST .selectPart, 2 );
423427 } else {
424428 throw L10nParserException (
425429 'ICU Syntax Error: Select parts must be of the form "identifier { message }"' ,
@@ -581,6 +585,10 @@ class Parser {
581585 checkExtraRules (syntaxTree);
582586 return syntaxTree;
583587 } on L10nParserException catch (error) {
588+ // For debugging purposes.
589+ if (logger == null ) {
590+ rethrow ;
591+ }
584592 logger? .printError (error.toString ());
585593 return Node (ST .empty, 0 , value: '' );
586594 }
0 commit comments