Skip to content

Commit

Permalink
[parser] trim end of line in CNF
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexandreDubray committed Nov 1, 2024
1 parent af2f4f9 commit 80694a3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/parsers/cnf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ impl Parser for CnfParser {
Ok(line) => {
if !line.starts_with('c') && !line.starts_with('p') {
// Note: the space before the 0 is important so that clauses like "1 -10 0" are correctly splitted
for clause in line.split(" 0").filter(|cl| !cl.is_empty()) {
for clause in line.trim_end().split(" 0").filter(|cl| !cl.is_empty()) {
clauses.push(clause.split_whitespace().map(|x| x.parse::<isize>().unwrap()).collect());
}
}
Expand Down Expand Up @@ -108,7 +108,7 @@ impl Parser for CnfParser {
Ok(line) => {
if !line.starts_with('c') && !line.starts_with('p') {
// Note: the space before the 0 is important so that clauses like "1 -10 0" are correctly splitted
for clause in line.split(" 0").filter(|cl| !cl.is_empty()) {
for clause in line.trim_end().split(" 0").filter(|cl| !cl.is_empty()) {
clauses.push(clause.split_whitespace().map(|x| x.parse::<isize>().unwrap()).collect());
}
}
Expand Down

0 comments on commit 80694a3

Please sign in to comment.