in lib/message_format.dart [557:596]
Queue<_BlockTypeAndVal> _parseBlock(String pattern) {
var result = Queue<_BlockTypeAndVal>();
var parts = _extractParts(pattern);
for (var thePart in parts) {
_BlockTypeAndVal? block;
if (_ElementType.string == thePart._type) {
block = _BlockTypeAndVal(_BlockType.string, thePart._value);
} else if (_ElementType.block == thePart._type) {
_checkAndThrow(thePart._value is String,
'The value should be a string: ${thePart._value}');
var blockType = _parseBlockType(thePart._value);
switch (blockType) {
case _BlockType.select:
block = _BlockTypeAndVal(
_BlockType.select, _parseSelectBlock(thePart._value));
break;
case _BlockType.plural:
block = _BlockTypeAndVal(
_BlockType.plural, _parsePluralBlock(thePart._value));
break;
case _BlockType.ordinal:
block = _BlockTypeAndVal(
_BlockType.ordinal, _parseOrdinalBlock(thePart._value));
break;
case _BlockType.simple:
block = _BlockTypeAndVal(_BlockType.simple, thePart._value);
break;
default:
_checkAndThrow(
false, 'Unknown block type for pattern: ${thePart._value}');
}
} else {
_checkAndThrow(false, 'Unknown part of the pattern.');
}
result.add(block!);
}
return result;
}