Skip to content

Commit

Permalink
Making query parses more efficient.
Browse files Browse the repository at this point in the history
  • Loading branch information
eazar001 committed Sep 23, 2019
1 parent 9850a9d commit faab9ce
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bfg-prolog"
version = "0.4.0"
version = "0.5.0"
authors = ["Ebrahim Azarisooreh <ebrahim.azarisooreh@gmail.com>"]
edition = "2018"

Expand Down
1 change: 0 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,6 @@ impl Environment {
let mut env = self.clone();
let mut asrl = asrl;
let mut next_asrl = Some(asrl.to_vec());
c.reverse();

while let Some(a) = c.pop() {
let Atom {
Expand Down
5 changes: 1 addition & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,5 @@ fn parse_code(code: &str) -> Vec<Assertion> {

fn parse_query(query: &str) -> Clause {
let clause_parser = parser::ClauseParser::new();
let mut c = clause_parser.parse(query).unwrap();
c.reverse();

c
clause_parser.parse(query).unwrap()
}
5 changes: 1 addition & 4 deletions tests/query_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@ fn parse_code(code: &str) -> Vec<Assertion> {

fn parse_query(query: &str) -> Clause {
let clause_parser = parser::ClauseParser::new();
let mut c = clause_parser.parse(query).unwrap();
c.reverse();

c
clause_parser.parse(query).unwrap()
}

fn compare_answers(answers: Vec<String>, expected: &[&str]) {
Expand Down

0 comments on commit faab9ce

Please sign in to comment.