@@ -428,14 +428,15 @@ enum NfaState {
428
428
InQuotedField = 3 ,
429
429
InEscapedQuote = 4 ,
430
430
InDoubleEscapedQuote = 5 ,
431
- InComment = 6 ,
431
+ InEscapeSequence = 6 ,
432
+ InComment = 7 ,
432
433
// All states below are "final field" states.
433
434
// Namely, they indicate that a field has been parsed.
434
- EndFieldDelim = 7 ,
435
+ EndFieldDelim = 8 ,
435
436
// All states below are "final record" states.
436
437
// Namely, they indicate that a record has been parsed.
437
- EndRecord = 8 ,
438
- CRLF = 9 ,
438
+ EndRecord = 9 ,
439
+ CRLF = 10 ,
439
440
}
440
441
441
442
/// A list of NFA states that have an explicit representation in the DFA.
@@ -970,7 +971,7 @@ impl Reader {
970
971
match state {
971
972
End | StartRecord | EndRecord | InComment | CRLF => End ,
972
973
StartField | EndFieldDelim | EndFieldTerm | InField
973
- | InQuotedField | InEscapedQuote | InDoubleEscapedQuote
974
+ | InQuotedField | InEscapedQuote | InDoubleEscapedQuote | InEscapeSequence
974
975
| InRecordTerm => EndRecord ,
975
976
}
976
977
}
@@ -1018,6 +1019,8 @@ impl Reader {
1018
1019
( EndFieldDelim , NfaInputAction :: Discard )
1019
1020
} else if self . term . equals ( c) {
1020
1021
( EndFieldTerm , NfaInputAction :: Epsilon )
1022
+ } else if !self . quoting && self . escape == Some ( c) {
1023
+ ( InEscapeSequence , NfaInputAction :: Discard )
1021
1024
} else {
1022
1025
( InField , NfaInputAction :: CopyToOutput )
1023
1026
}
@@ -1043,6 +1046,9 @@ impl Reader {
1043
1046
( InField , NfaInputAction :: CopyToOutput )
1044
1047
}
1045
1048
}
1049
+ InEscapeSequence => {
1050
+ ( InField , NfaInputAction :: CopyToOutput )
1051
+ } ,
1046
1052
InComment => {
1047
1053
if b'\n' == c {
1048
1054
( StartRecord , NfaInputAction :: Discard )
0 commit comments