Skip to content

Commit c8246fb

Browse files
committed
rename ValueWrapper to ValueWithSpan
1 parent 6cdc582 commit c8246fb

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

src/ast/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ pub use self::trigger::{
8686

8787
pub use self::value::{
8888
escape_double_quote_string, escape_quoted_string, DateTimeField, DollarQuotedString,
89-
NormalizationForm, TrimWhereField, Value, ValueWrapper,
89+
NormalizationForm, TrimWhereField, Value, ValueWithSpan,
9090
};
9191

9292
use crate::ast::helpers::key_value_options::KeyValueOptions;
@@ -892,7 +892,7 @@ pub enum Expr {
892892
/// Nested expression e.g. `(foo > bar)` or `(1)`
893893
Nested(Box<Expr>),
894894
/// A literal value, such as string, number, date or NULL
895-
Value(ValueWrapper),
895+
Value(ValueWithSpan),
896896
/// <https://dev.mysql.com/doc/refman/8.0/en/charset-introducer.html>
897897
IntroducedString {
898898
introducer: String,

src/ast/spans.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use core::iter;
2121
use crate::tokenizer::Span;
2222

2323
use super::{
24-
dcl::SecondaryRoles, value::ValueWrapper, AccessExpr, AlterColumnOperation, AlterIndexOperation, AlterTableOperation, Array, Assignment, AssignmentTarget, CloseCursor, ClusteredIndex, ColumnDef, ColumnOption, ColumnOptionDef, ConflictTarget, ConnectBy, ConstraintCharacteristics, CopySource, CreateIndex, CreateTable, CreateTableOptions, Cte, Delete, DoUpdate, ExceptSelectItem, ExcludeSelectItem, Expr, ExprWithAlias, Fetch, FromTable, Function, FunctionArg, FunctionArgExpr, FunctionArgumentClause, FunctionArgumentList, FunctionArguments, GroupByExpr, HavingBound, IlikeSelectItem, Insert, Interpolate, InterpolateExpr, Join, JoinConstraint, JoinOperator, JsonPath, JsonPathElem, LateralView, MatchRecognizePattern, Measure, NamedWindowDefinition, ObjectName, ObjectNamePart, Offset, OnConflict, OnConflictAction, OnInsert, OrderBy, OrderByExpr, Partition, PivotValueSource, ProjectionSelect, Query, ReferentialAction, RenameSelectItem, ReplaceSelectElement, ReplaceSelectItem, Select, SelectInto, SelectItem, SetExpr, SqlOption, Statement, Subscript, SymbolDefinition, TableAlias, TableAliasColumnDef, TableConstraint, TableFactor, TableObject, TableOptionsClustered, TableWithJoins, UpdateTableFromKind, Use, Value, Values, ViewColumnDef, WildcardAdditionalOptions, With, WithFill
24+
dcl::SecondaryRoles, value::ValueWithSpan, AccessExpr, AlterColumnOperation, AlterIndexOperation, AlterTableOperation, Array, Assignment, AssignmentTarget, CloseCursor, ClusteredIndex, ColumnDef, ColumnOption, ColumnOptionDef, ConflictTarget, ConnectBy, ConstraintCharacteristics, CopySource, CreateIndex, CreateTable, CreateTableOptions, Cte, Delete, DoUpdate, ExceptSelectItem, ExcludeSelectItem, Expr, ExprWithAlias, Fetch, FromTable, Function, FunctionArg, FunctionArgExpr, FunctionArgumentClause, FunctionArgumentList, FunctionArguments, GroupByExpr, HavingBound, IlikeSelectItem, Insert, Interpolate, InterpolateExpr, Join, JoinConstraint, JoinOperator, JsonPath, JsonPathElem, LateralView, MatchRecognizePattern, Measure, NamedWindowDefinition, ObjectName, ObjectNamePart, Offset, OnConflict, OnConflictAction, OnInsert, OrderBy, OrderByExpr, Partition, PivotValueSource, ProjectionSelect, Query, ReferentialAction, RenameSelectItem, ReplaceSelectElement, ReplaceSelectItem, Select, SelectInto, SelectItem, SetExpr, SqlOption, Statement, Subscript, SymbolDefinition, TableAlias, TableAliasColumnDef, TableConstraint, TableFactor, TableObject, TableOptionsClustered, TableWithJoins, UpdateTableFromKind, Use, Value, Values, ViewColumnDef, WildcardAdditionalOptions, With, WithFill
2525
};
2626

2727
/// Given an iterator of spans, return the [Span::union] of all spans.
@@ -1961,7 +1961,7 @@ impl Spanned for TableAliasColumnDef {
19611961
}
19621962

19631963

1964-
impl Spanned for ValueWrapper {
1964+
impl Spanned for ValueWithSpan {
19651965
fn span(&self) -> Span {
19661966
self.span
19671967
}

src/ast/value.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@ use sqlparser_derive::{Visit, VisitMut};
3434
#[derive(Debug, Clone, PartialEq, PartialOrd, Eq, Ord, Hash)]
3535
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
3636
#[cfg_attr(feature = "visitor", derive(Visit, VisitMut))]
37-
pub struct ValueWrapper {
37+
pub struct ValueWithSpan {
3838
pub value: Value,
3939
pub span: Span,
4040
}
4141

42-
impl From<ValueWrapper> for Value {
43-
fn from(value: ValueWrapper) -> Self {
42+
impl From<ValueWithSpan> for Value {
43+
fn from(value: ValueWithSpan) -> Self {
4444
value.value
4545
}
4646
}
@@ -112,7 +112,7 @@ pub enum Value {
112112
Placeholder(String),
113113
}
114114

115-
impl ValueWrapper {
115+
impl ValueWithSpan {
116116
/// If the underlying literal is a string, regardless of quote style, returns the associated string value
117117
pub fn into_string(self) -> Option<String> {
118118
self.value.into_string()
@@ -144,16 +144,16 @@ impl Value {
144144
}
145145
}
146146

147-
pub fn with_span(self, span: Span) -> ValueWrapper {
148-
ValueWrapper { value: self, span }
147+
pub fn with_span(self, span: Span) -> ValueWithSpan {
148+
ValueWithSpan { value: self, span }
149149
}
150150

151-
pub fn with_empty_span(self) -> ValueWrapper {
151+
pub fn with_empty_span(self) -> ValueWithSpan {
152152
self.with_span(Span::empty())
153153
}
154154
}
155155

156-
impl fmt::Display for ValueWrapper {
156+
impl fmt::Display for ValueWithSpan {
157157
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
158158
write!(f, "{}", self.value)
159159
}

src/parser/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8559,7 +8559,7 @@ impl<'a> Parser<'a> {
85598559
}
85608560

85618561
/// Parse a literal value (numbers, strings, date/time, booleans)
8562-
pub fn parse_value(&mut self) -> Result<ValueWrapper, ParserError> {
8562+
pub fn parse_value(&mut self) -> Result<ValueWithSpan, ParserError> {
85638563
let next_token = self.next_token();
85648564
let span = next_token.span;
85658565
let ok_value = |value: Value| Ok(value.with_span(span));
@@ -8656,7 +8656,7 @@ impl<'a> Parser<'a> {
86568656
}
86578657

86588658
/// Parse an unsigned numeric literal
8659-
pub fn parse_number_value(&mut self) -> Result<ValueWrapper, ParserError> {
8659+
pub fn parse_number_value(&mut self) -> Result<ValueWithSpan, ParserError> {
86608660
let value_wrapper = self.parse_value()?;
86618661
match &value_wrapper.value {
86628662
Value::Number(_, _) => Ok(value_wrapper),

0 commit comments

Comments
 (0)