Unverified Commit c94a994d authored by Jason Simmons's avatar Jason Simmons Committed by GitHub

Handle CR+LF end of line sequences in the license parser (#40718)

parent 0086243b
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment