Skip to content

Commit

Permalink
Merge 5890532 into babd7ac
Browse files Browse the repository at this point in the history
  • Loading branch information
am357 authored Jun 14, 2023
2 parents babd7ac + 5890532 commit f7be104
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 10 deletions.
5 changes: 3 additions & 2 deletions partiql-ast/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ path = "src/lib.rs"
bench = false

[dependencies]
indexmap = "1.9"
indexmap = { version = "1.9", default-features = false }
rust_decimal = { version = "1.25.0", default-features = false, features = ["std"] }
serde = { version = "1.*", features = ["derive"], optional = true }

Expand All @@ -31,7 +31,8 @@ default = []
serde = [
"dep:serde",
"rust_decimal/serde-with-str",
"rust_decimal/serde"
"rust_decimal/serde",
"indexmap/serde",
]

[dependencies.partiql-ast-macros]
Expand Down
4 changes: 1 addition & 3 deletions partiql-parser/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ use parse::{parse_partiql, AstData, ErrorData};
use partiql_ast::ast;
use partiql_source_map::line_offset_tracker::LineOffsetTracker;
use partiql_source_map::location::BytePosition;

use partiql_ast::ast::NodeId;
use partiql_source_map::metadata::LocationMap;
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
Expand Down Expand Up @@ -82,7 +80,7 @@ pub struct Parsed<'input> {
pub text: &'input str,
pub offsets: LineOffsetTracker,
pub ast: Box<ast::Expr>,
pub locations: LocationMap<NodeId>,
pub locations: LocationMap,
}

/// The output of errors when parsing PartiQL statement strings: an errors and auxiliary data.
Expand Down
4 changes: 2 additions & 2 deletions partiql-parser/src/parse/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ use crate::parse::parser_state::{IdGenerator, ParserState};
use crate::preprocessor::{PreprocessingPartiqlLexer, BUILT_INS};
use lalrpop_util as lpop;
use partiql_ast::ast;
use partiql_ast::ast::NodeId;
use partiql_source_map::line_offset_tracker::LineOffsetTracker;
use partiql_source_map::location::{ByteOffset, BytePosition, ToLocated};
use partiql_source_map::metadata::LocationMap;
Expand Down Expand Up @@ -41,7 +40,7 @@ type LalrpopErrorRecovery<'input> =
#[derive(Debug, Clone)]
pub(crate) struct AstData {
pub ast: Box<ast::Expr>,
pub locations: LocationMap<NodeId>,
pub locations: LocationMap,
pub offsets: LineOffsetTracker,
}

Expand Down Expand Up @@ -535,6 +534,7 @@ mod tests {

mod set_ops {
use super::*;
use partiql_ast::ast::NodeId;

#[derive(Default)]
pub(crate) struct NullIdGenerator {}
Expand Down
2 changes: 1 addition & 1 deletion partiql-parser/src/parse/parser_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ pub(crate) struct ParserState<'input, Id: IdGenerator> {
/// Generator for 'fresh' [`NodeId`]s
pub id_gen: Id,
/// Maps AST [`NodeId`]s to the location in the source from which each was derived.
pub locations: LocationMap<NodeId>,
pub locations: LocationMap,
/// Any errors accumulated during parse.
pub errors: ParseErrors<'input>,

Expand Down
2 changes: 2 additions & 0 deletions partiql-source-map/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ edition.workspace = true
bench = false

[dependencies]
partiql-ast = { path = "../partiql-ast", version = "0.5.*" }

smallvec = { version = "1.*" }
serde = { version = "1.*", features = ["derive"], optional = true }

Expand Down
4 changes: 2 additions & 2 deletions partiql-source-map/src/metadata.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::location::{BytePosition, Location};
use std::collections::HashMap;
use partiql_ast::ast::AstTypeMap;

/// Map of `T` to a [`Location<BytePosition>>`]
pub type LocationMap<T> = HashMap<T, Location<BytePosition>>;
pub type LocationMap = AstTypeMap<Location<BytePosition>>;

0 comments on commit f7be104

Please sign in to comment.