CharacterClassExpression constructor
Implementation
CharacterClassExpression(List<List<int>> ranges) {
if (ranges.isEmpty) {
throw ArgumentError('List of ranges should not be empty');
}
for (final range in ranges) {
final start = range[0];
final end = range[1];
if (start is! int) {
throw ArgumentError('ranges');
}
if (end is! int) {
throw ArgumentError('ranges');
}
if (start > end) {
throw ArgumentError('ranges');
}
if (start > 0x10ffff) {
throw RangeError.value(start, 'start');
}
if (end > 0x10ffff) {
throw RangeError.value(end, 'end');
}
final group = GroupedRangeList(start, end, true);
this.ranges.addGroup(group);
}
this.ranges.freeze();
}