@@ -752,7 +752,7 @@ impl Reader {
752
752
// parsing a new record, then we should sink into the final state
753
753
// and never move from there. (pro-tip: the start state doubles as
754
754
// the final state!)
755
- if state >= self . dfa . final_record || state. is_start ( ) {
755
+ if state >= self . dfa . final_record || state. is_start ( ) || state == self . dfa . in_comment {
756
756
self . dfa . new_state_final_end ( )
757
757
} else {
758
758
self . dfa . new_state_final_record ( )
@@ -1116,6 +1116,8 @@ struct Dfa {
1116
1116
in_field : DfaState ,
1117
1117
/// The DFA state corresponding to being inside an quoted field.
1118
1118
in_quoted : DfaState ,
1119
+ /// The DFA state corresponding to being inside a comment.
1120
+ in_comment : DfaState ,
1119
1121
/// The minimum DFA state that indicates a field has been parsed. All DFA
1120
1122
/// states greater than this are also final-field states.
1121
1123
final_field : DfaState ,
@@ -1132,6 +1134,7 @@ impl Dfa {
1132
1134
classes : DfaClasses :: new ( ) ,
1133
1135
in_field : DfaState ( 0 ) ,
1134
1136
in_quoted : DfaState ( 0 ) ,
1137
+ in_comment : DfaState ( 0 ) ,
1135
1138
final_field : DfaState ( 0 ) ,
1136
1139
final_record : DfaState ( 0 ) ,
1137
1140
}
@@ -1167,6 +1170,7 @@ impl Dfa {
1167
1170
fn finish ( & mut self ) {
1168
1171
self . in_field = self . new_state ( NfaState :: InField ) ;
1169
1172
self . in_quoted = self . new_state ( NfaState :: InQuotedField ) ;
1173
+ self . in_comment = self . new_state ( NfaState :: InComment ) ;
1170
1174
self . final_field = self . new_state ( NfaState :: EndFieldDelim ) ;
1171
1175
self . final_record = self . new_state ( NfaState :: EndRecord ) ;
1172
1176
}
0 commit comments