Skip to content

Commit 00fc16d

Browse files
Rename whitespace -> new_line
1 parent 6c75753 commit 00fc16d

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

src/classifier.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
pub const COMMA_CLASS: u8 = 1;
2-
pub const WHITESPACE_CLASS: u8 = 2;
2+
pub const NEW_LINE_CLASS: u8 = 2;
33

44
pub const QUOTATION_CLASS: u8 = 3;
55

@@ -14,15 +14,15 @@ pub const LO_LOOKUP: [u8; 16] = [
1414
0,
1515
0,
1616
0,
17-
WHITESPACE_CLASS,
17+
NEW_LINE_CLASS,
1818
0,
1919
COMMA_CLASS,
20-
WHITESPACE_CLASS,
20+
NEW_LINE_CLASS,
2121
0,
2222
0,
2323
];
2424
pub const HI_LOOKUP: [u8; 16] = [
25-
WHITESPACE_CLASS,
25+
NEW_LINE_CLASS,
2626
0,
2727
COMMA_CLASS | QUOTATION_CLASS,
2828
0,
@@ -115,13 +115,13 @@ mod tests {
115115
0,
116116
COMMA_CLASS,
117117
0,
118-
WHITESPACE_CLASS,
118+
NEW_LINE_CLASS,
119119
0,
120120
COMMA_CLASS,
121121
QUOTATION_CLASS,
122122
0,
123123
QUOTATION_CLASS,
124-
WHITESPACE_CLASS, // we always add a \n at the end
124+
NEW_LINE_CLASS, // we always add a \n at the end
125125
0,
126126
0,
127127
0,

src/reader.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::classifier::CsvClassifier;
2-
use crate::classifier::{COMMA_CLASS, QUOTATION_CLASS, WHITESPACE_CLASS};
2+
use crate::classifier::{COMMA_CLASS, NEW_LINE_CLASS, QUOTATION_CLASS};
33
use crate::grammar::Row;
44
use crate::u8x16::u8x16;
55
use anyhow::Result;
@@ -18,7 +18,7 @@ impl CsvReader {
1818
let capacity = vectors.len() / 4 + 1;
1919

2020
let comma_broadcast = u8x16::broadcast(COMMA_CLASS);
21-
let whitespace_broadcast = u8x16::broadcast(WHITESPACE_CLASS);
21+
let whitespace_broadcast = u8x16::broadcast(NEW_LINE_CLASS);
2222
let quotation_broadcast = u8x16::broadcast(QUOTATION_CLASS);
2323

2424
let mut comma_bitsets = Vec::with_capacity(capacity);
@@ -154,8 +154,14 @@ mod tests {
154154
assert_eq!(csv_reader2.whitespace_bitsets.len(), 2);
155155
assert_eq!(csv_reader2.comma_bitsets.len(), 2);
156156

157-
assert_eq!(csv_reader1.quotation_bitsets[0], csv_reader2.quotation_bitsets[0]);
158-
assert_eq!(csv_reader1.whitespace_bitsets[0], csv_reader2.whitespace_bitsets[0]);
157+
assert_eq!(
158+
csv_reader1.quotation_bitsets[0],
159+
csv_reader2.quotation_bitsets[0]
160+
);
161+
assert_eq!(
162+
csv_reader1.whitespace_bitsets[0],
163+
csv_reader2.whitespace_bitsets[0]
164+
);
159165
assert_eq!(csv_reader1.comma_bitsets[0], csv_reader2.comma_bitsets[0]);
160166

161167
Ok(())

0 commit comments

Comments
 (0)