Skip to content

Commit

Permalink
rename stmt_parse to stmt_parse_pass
Browse files Browse the repository at this point in the history
digama0 committed Oct 15, 2021
1 parent 57dacaf commit 28cb1bb
Showing 5 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/database.rs
Original file line number Diff line number Diff line change
@@ -619,7 +619,7 @@ impl Database {
}

/// Parses the statements using the grammar.
pub fn stmt_parse(&mut self) -> &Arc<StmtParse> {
pub fn stmt_parse_pass(&mut self) -> &Arc<StmtParse> {
if self.stmt_parse.is_none() {
self.name_pass();
self.scope_pass();
@@ -755,7 +755,7 @@ impl Database {
diags.extend(self.grammar_pass().diagnostics());
}
if types.contains(&DiagnosticClass::StmtParse) {
diags.extend(self.stmt_parse().diagnostics());
diags.extend(self.stmt_parse_pass().diagnostics());
}
time(&self.options.clone(), "diag", || {
diag::to_annotations(self.parse_result(), diags)
6 changes: 3 additions & 3 deletions src/formula_tests.rs
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@ const FORMULA_DB: &[u8] = b"
/// Shall result in ` A := 1 ` and ` B := 2 `
fn test_unify() {
let mut db = mkdb(FORMULA_DB);
let stmt_parse = db.stmt_parse().clone();
let stmt_parse = db.stmt_parse_pass().clone();
let names = db.name_pass().clone();
let goal = stmt_parse
.get_formula(&db.statement("1p2com").unwrap())
@@ -44,7 +44,7 @@ fn test_unify() {
/// Unification of ` ( 1 + 2 ) = ( 2 + 1 ) ` with ` ( A + 1 ) = ( B + 1 ) ` shall fail.
fn test_unify_fail() {
let mut db = mkdb(FORMULA_DB);
let stmt_parse = db.stmt_parse().clone();
let stmt_parse = db.stmt_parse_pass().clone();
let goal = stmt_parse
.get_formula(&db.statement("1p2com").unwrap())
.unwrap();
@@ -59,7 +59,7 @@ fn test_unify_fail() {
/// Shall result in ` ( ( 1 + 2 ) + 1 ) = ( ( 2 + 1 ) + 1 ) `
fn test_substitute() {
let mut db = mkdb(FORMULA_DB);
let stmt_parse = db.stmt_parse().clone();
let stmt_parse = db.stmt_parse_pass().clone();
let names = db.name_pass().clone();
let goal = stmt_parse
.get_formula(&db.statement("1p2com").unwrap())
2 changes: 1 addition & 1 deletion src/grammar.rs
Original file line number Diff line number Diff line change
@@ -1383,7 +1383,7 @@ pub(crate) fn build_grammar<'a>(grammar: &mut Grammar, sset: &'a Arc<SegmentSet>
/// // Create an empty database and load any file provided
/// let mut db = Database::new(options);
/// db.parse("set.mm".to_string(), vec![]);
/// let stmt_parse = db.stmt_parse();
/// let stmt_parse = db.stmt_parse_pass();
/// ```
///
/// The parse tree for a given statement can then be obtained through [`StmtParse::get_formula`].
12 changes: 6 additions & 6 deletions src/grammar_tests.rs
Original file line number Diff line number Diff line change
@@ -44,7 +44,7 @@ fn test_db_stmt_parse() {
let mut db = mkdb(GRAMMAR_DB);
let sset = db.parse_result().clone();
let grammar = db.grammar_pass().clone();
let stmt_parse = db.stmt_parse().clone();
let stmt_parse = db.stmt_parse_pass().clone();
assert!(sset.parse_diagnostics().is_empty());
assert!(grammar.diagnostics().is_empty());
assert!(stmt_parse.diagnostics().is_empty());
@@ -53,7 +53,7 @@ fn test_db_stmt_parse() {
#[test]
fn test_db_formula() {
let mut db = mkdb(GRAMMAR_DB);
let stmt_parse = db.stmt_parse().clone();
let stmt_parse = db.stmt_parse_pass().clone();
let names = db.name_pass().clone();
{
let sref = db.statement("ax-com").unwrap();
@@ -112,7 +112,7 @@ const GRAMMAR_DB_32: &[u8] = b"
#[test]
fn test_db_32_formula() {
let mut db = mkdb(GRAMMAR_DB_32);
let stmt_parse = db.stmt_parse().clone();
let stmt_parse = db.stmt_parse_pass().clone();
let names = db.name_pass().clone();
{
let sref = db.statement("check").unwrap();
@@ -155,7 +155,7 @@ const GARDEN_PATH_DB: &[u8] = b"
fn test_garden_path_1() {
let mut db = mkdb(GARDEN_PATH_DB);
let sset = db.parse_result().clone();
let stmt_parse = db.stmt_parse().clone();
let stmt_parse = db.stmt_parse_pass().clone();
let names = db.name_pass().clone();
assert!(sset.parse_diagnostics().is_empty());
let sref = db.statement("formula1").unwrap();
@@ -171,7 +171,7 @@ fn test_garden_path_1() {
#[test]
fn test_garden_path_2() {
let mut db = mkdb(GARDEN_PATH_DB);
let stmt_parse = db.stmt_parse().clone();
let stmt_parse = db.stmt_parse_pass().clone();
let names = db.name_pass().clone();
let sref = db.statement("formula2").unwrap();
let formula = stmt_parse.get_formula(&sref).unwrap();
@@ -188,7 +188,7 @@ fn test_garden_path_2() {
#[test]
fn test_garden_path_3() {
let mut db = mkdb(GARDEN_PATH_DB);
let stmt_parse = db.stmt_parse().clone();
let stmt_parse = db.stmt_parse_pass().clone();
let names = db.name_pass().clone();
let sref = db.statement("formula3").unwrap();
let formula = stmt_parse.get_formula(&sref).unwrap();
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
@@ -103,7 +103,7 @@ fn main() {
}

if matches.is_present("verify_parse_stmt") {
db.stmt_parse();
db.stmt_parse_pass();
db.verify_parse_stmt();
}

0 comments on commit 28cb1bb

Please sign in to comment.