Handle CR+LF end of line sequences in the license parser (#40718)
This commit is contained in:
@@ -180,11 +180,16 @@ class LicenseEntryWithLineBreaks extends LicenseEntry {
|
||||
currentLineIndent += 8;
|
||||
state = _LicenseEntryWithLineBreaksParserState.beforeParagraph;
|
||||
break;
|
||||
case '\r':
|
||||
case '\n':
|
||||
case '\f':
|
||||
if (lines.isNotEmpty) {
|
||||
yield getParagraph();
|
||||
}
|
||||
if (text[currentPosition] == '\r' && currentPosition < text.length - 1
|
||||
&& text[currentPosition + 1] == '\n') {
|
||||
currentPosition += 1;
|
||||
}
|
||||
lastLineIndent = 0;
|
||||
currentLineIndent = 0;
|
||||
currentParagraphIndentation = null;
|
||||
|
||||
@@ -158,6 +158,7 @@ S
|
||||
|
||||
test('LicenseEntryWithLineBreaks - leading and trailing whitespace', () {
|
||||
expect(const LicenseEntryWithLineBreaks(null, ' \n\n ').paragraphs.toList(), isEmpty);
|
||||
expect(const LicenseEntryWithLineBreaks(null, ' \r\n\r\n ').paragraphs.toList(), isEmpty);
|
||||
|
||||
List<LicenseParagraph> paragraphs;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user