Skip to content

Commit

Permalink
Remove tick from being a valid literal terminator character.
Browse files Browse the repository at this point in the history
  • Loading branch information
Christopher Regali committed Jan 20, 2023
1 parent 74be34a commit e50e24a
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions src/csv/tokenizer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ const DEFAULT_FIELD_SEPARATOR: char = ',';
const ESCAPE_BYTE: u8 = b'\\';
const ESCAPE_QUOTE_BYTE: u8 = b'"';
const QUOTE: char = '\"';
const TICK: char = '\'';
const NEW_LINE: char = '\n';
const CARRIAGE_RETURN: char = '\r';

Expand All @@ -25,14 +24,12 @@ pub enum Token<'a> {
#[derive(PartialEq, Eq, Debug, Clone, Copy)]
enum LiteralTerminator {
Quote,
Tick,
}

impl LiteralTerminator {
pub fn get_char(&self) -> char {
match self {
LiteralTerminator::Quote => QUOTE,
LiteralTerminator::Tick => TICK,
}
}
}
Expand Down Expand Up @@ -131,12 +128,6 @@ fn find_special_char(string: &str, field_sep: char) -> Option<SpecialCharacter>
LiteralTerminator::Quote,
));
}
TICK => {
return Some(SpecialCharacter::LiteralMarker(
pos,
LiteralTerminator::Tick,
));
}
NEW_LINE => {
return Some(SpecialCharacter::NewLine(pos));
}
Expand Down Expand Up @@ -403,7 +394,7 @@ bla,bla"#;
fn tokenize_to_values_cuts_last_nl() {
let str = "bla\n2.0\n\n";
let mut parser = Parser::new_guess_format(Cursor::new(str)).unwrap();
let lines: Vec<_> = parser.parse_to_rows().unwrap().collect();
let lines = parser.parse_to_rows().unwrap();
assert_eq!(lines.len(), 2);
}

Expand Down

0 comments on commit e50e24a

Please sign in to comment.