diff --git a/crates/proof-of-sql-parser/src/error.rs b/crates/proof-of-sql-parser/src/error.rs index 13a235f30..e1449cc7d 100644 --- a/crates/proof-of-sql-parser/src/error.rs +++ b/crates/proof-of-sql-parser/src/error.rs @@ -1,3 +1,4 @@ +use alloc::string::String; use thiserror::Error; /// Errors encountered during the parsing process diff --git a/crates/proof-of-sql-parser/src/identifier.rs b/crates/proof-of-sql-parser/src/identifier.rs index 0f35186a9..949df4709 100644 --- a/crates/proof-of-sql-parser/src/identifier.rs +++ b/crates/proof-of-sql-parser/src/identifier.rs @@ -1,6 +1,7 @@ use crate::{sql::IdentifierParser, ParseError, ParseResult}; +use alloc::{format, string::ToString}; use arrayvec::ArrayString; -use std::{cmp::Ordering, fmt, ops::Deref, str::FromStr}; +use core::{cmp::Ordering, fmt, ops::Deref, str::FromStr}; /// Top-level unique identifier. #[derive(Debug, PartialEq, Eq, Clone, Hash, Ord, PartialOrd, Copy)] @@ -87,6 +88,7 @@ impl AsRef for Identifier { #[cfg(test)] mod tests { use super::*; + use alloc::{borrow::ToOwned, vec, vec::Vec}; #[test] fn from_str_identifier() { diff --git a/crates/proof-of-sql-parser/src/intermediate_ast.rs b/crates/proof-of-sql-parser/src/intermediate_ast.rs index 6b1948601..2095301a5 100644 --- a/crates/proof-of-sql-parser/src/intermediate_ast.rs +++ b/crates/proof-of-sql-parser/src/intermediate_ast.rs @@ -5,12 +5,13 @@ ***/ use crate::{intermediate_decimal::IntermediateDecimal, posql_time::PoSQLTimestamp, Identifier}; -use core::hash::Hash; -use serde::{Deserialize, Serialize}; -use std::{ +use alloc::{boxed::Box, string::String, vec::Vec}; +use core::{ fmt, fmt::{Display, Formatter}, + hash::Hash, }; +use serde::{Deserialize, Serialize}; /// Representation of a SetExpression, a collection of rows, each having one or more columns. #[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Clone)] diff --git a/crates/proof-of-sql-parser/src/intermediate_ast_tests.rs b/crates/proof-of-sql-parser/src/intermediate_ast_tests.rs index 182ee9124..0afae9a67 100644 --- a/crates/proof-of-sql-parser/src/intermediate_ast_tests.rs +++ b/crates/proof-of-sql-parser/src/intermediate_ast_tests.rs @@ -5,6 +5,7 @@ use crate::{ utility::*, SelectStatement, }; +use alloc::{borrow::ToOwned, string::ToString, vec}; // Sting parser tests #[test] diff --git a/crates/proof-of-sql-parser/src/intermediate_decimal.rs b/crates/proof-of-sql-parser/src/intermediate_decimal.rs index 12a4e87d6..d88e9041d 100644 --- a/crates/proof-of-sql-parser/src/intermediate_decimal.rs +++ b/crates/proof-of-sql-parser/src/intermediate_decimal.rs @@ -6,10 +6,10 @@ //! A decimal must have a decimal point. The lexer does not route //! whole integers to this contructor. use crate::intermediate_decimal::IntermediateDecimalError::{LossyCast, OutOfRange, ParseError}; +use alloc::string::String; use bigdecimal::{num_bigint::BigInt, BigDecimal, ParseBigDecimalError, ToPrimitive}; -use core::hash::Hash; +use core::{fmt, hash::Hash, str::FromStr}; use serde::{Deserialize, Serialize}; -use std::{fmt, str::FromStr}; use thiserror::Error; /// Errors related to the processing of decimal values in proof-of-sql @@ -157,6 +157,7 @@ impl TryFrom for i64 { #[cfg(test)] mod tests { use super::*; + use alloc::string::ToString; #[test] fn test_valid_decimal_simple() { diff --git a/crates/proof-of-sql-parser/src/posql_time/error.rs b/crates/proof-of-sql-parser/src/posql_time/error.rs index 090becbd0..1e07023d7 100644 --- a/crates/proof-of-sql-parser/src/posql_time/error.rs +++ b/crates/proof-of-sql-parser/src/posql_time/error.rs @@ -1,3 +1,4 @@ +use alloc::string::{String, ToString}; use serde::{Deserialize, Serialize}; use thiserror::Error; diff --git a/crates/proof-of-sql-parser/src/posql_time/timestamp.rs b/crates/proof-of-sql-parser/src/posql_time/timestamp.rs index 73583af87..6807388c5 100644 --- a/crates/proof-of-sql-parser/src/posql_time/timestamp.rs +++ b/crates/proof-of-sql-parser/src/posql_time/timestamp.rs @@ -1,4 +1,5 @@ use super::{PoSQLTimeUnit, PoSQLTimeZone, PoSQLTimestampError}; +use alloc::{format, string::ToString}; use chrono::{offset::LocalResult, DateTime, TimeZone, Utc}; use core::hash::Hash; use serde::{Deserialize, Serialize}; diff --git a/crates/proof-of-sql-parser/src/posql_time/timezone.rs b/crates/proof-of-sql-parser/src/posql_time/timezone.rs index 442c3a459..459195347 100644 --- a/crates/proof-of-sql-parser/src/posql_time/timezone.rs +++ b/crates/proof-of-sql-parser/src/posql_time/timezone.rs @@ -1,7 +1,7 @@ use super::PoSQLTimestampError; +use alloc::{string::ToString, sync::Arc}; use core::fmt; use serde::{Deserialize, Serialize}; -use std::sync::Arc; /// Captures a timezone from a timestamp query #[derive(Debug, Clone, Copy, Hash, Serialize, Deserialize, PartialEq, Eq)] @@ -75,6 +75,7 @@ impl fmt::Display for PoSQLTimeZone { #[cfg(test)] mod timezone_parsing_tests { use crate::posql_time::timezone; + use alloc::format; #[test] fn test_display_fixed_offset_positive() { diff --git a/crates/proof-of-sql-parser/src/resource_id.rs b/crates/proof-of-sql-parser/src/resource_id.rs index 9415c42e3..4f42c8474 100644 --- a/crates/proof-of-sql-parser/src/resource_id.rs +++ b/crates/proof-of-sql-parser/src/resource_id.rs @@ -1,6 +1,10 @@ //! This file defines the resource identifier type. use crate::{impl_serde_from_str, sql::ResourceIdParser, Identifier, ParseError, ParseResult}; -use std::{ +use alloc::{ + format, + string::{String, ToString}, +}; +use core::{ fmt::{self, Display}, str::FromStr, }; diff --git a/crates/proof-of-sql-parser/src/select_statement.rs b/crates/proof-of-sql-parser/src/select_statement.rs index a3cd75a07..b64a40825 100644 --- a/crates/proof-of-sql-parser/src/select_statement.rs +++ b/crates/proof-of-sql-parser/src/select_statement.rs @@ -1,7 +1,8 @@ use super::intermediate_ast::{OrderBy, SetExpression, Slice, TableExpression}; use crate::{sql::SelectStatementParser, Identifier, ParseError, ParseResult, ResourceId}; +use alloc::{boxed::Box, string::ToString, vec::Vec}; +use core::{fmt, ops::Deref, str::FromStr}; use serde::{Deserialize, Serialize}; -use std::{fmt, ops::Deref, str::FromStr}; /// Representation of a select statement, that is, the only type of queries allowed. #[derive(Serialize, Deserialize, PartialEq, Eq, Clone)] diff --git a/crates/proof-of-sql-parser/src/sql.lalrpop b/crates/proof-of-sql-parser/src/sql.lalrpop index 39040ecd8..3074833b9 100644 --- a/crates/proof-of-sql-parser/src/sql.lalrpop +++ b/crates/proof-of-sql-parser/src/sql.lalrpop @@ -3,6 +3,10 @@ use crate::select_statement; use crate::identifier; use lalrpop_util::ParseError::User; use crate::{intermediate_decimal::IntermediateDecimal, posql_time::PoSQLTimestamp}; +use alloc::boxed::Box; +use alloc::string::String; +use alloc::vec; +use alloc::vec::Vec; grammar; diff --git a/crates/proof-of-sql-parser/src/utility.rs b/crates/proof-of-sql-parser/src/utility.rs index 31926b09e..87d3d99ba 100644 --- a/crates/proof-of-sql-parser/src/utility.rs +++ b/crates/proof-of-sql-parser/src/utility.rs @@ -1,4 +1,5 @@ use crate::{intermediate_ast::*, Identifier, SelectStatement}; +use alloc::{boxed::Box, vec, vec::Vec}; /// Construct an identifier from a str pub fn ident(name: &str) -> Identifier {