Sfoglia il codice sorgente

support comments and empty lines

Lucas Stadler 10 anni fa
parent
commit
fe27aa5551
1 ha cambiato i file con 1 aggiunte e 1 eliminazioni
  1. 1 1
      rust/solve/src/cnf.rs

+ 1 - 1
rust/solve/src/cnf.rs

26
/// line specifies this.  Each following line represents a clause with possibly
26
/// line specifies this.  Each following line represents a clause with possibly
27
/// negated literals, terminated by 0 and a newline.
27
/// negated literals, terminated by 0 and a newline.
28
pub fn parse_dimac(dimac: &str) -> Result<CNF, String> {
28
pub fn parse_dimac(dimac: &str) -> Result<CNF, String> {
29
	let mut lines = dimac.lines();
29
	let mut lines = dimac.lines().filter(|l| !(l.starts_with("c") || l.trim() == ""));
30
	let mut num_vars;
30
	let mut num_vars;
31
	let mut num_clauses;
31
	let mut num_clauses;
32
32