Implement Spanned to retrieve source locations on AST nodes (#1435)

Co-authored-by: Ifeanyi Ubah <ify1992@yahoo.com>
Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
This commit is contained in:
Mark-Oliver Junge 2024-11-26 17:22:30 +01:00 committed by GitHub
parent 0adec33b94
commit 3c8fd74804
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 3092 additions and 399 deletions

View file

@ -21,6 +21,8 @@
#[macro_use]
mod test_utils;
use helpers::attached_token::AttachedToken;
use sqlparser::tokenizer::Span;
use test_utils::*;
use sqlparser::ast::Expr::{BinaryOp, Identifier, MapAccess};
@ -39,12 +41,14 @@ fn parse_map_access_expr() {
assert_eq!(
Select {
distinct: None,
select_token: AttachedToken::empty(),
top: None,
top_before_distinct: false,
projection: vec![UnnamedExpr(MapAccess {
column: Box::new(Identifier(Ident {
value: "string_values".to_string(),
quote_style: None,
span: Span::empty(),
})),
keys: vec![MapAccessKey {
key: call(
@ -903,7 +907,8 @@ fn parse_create_view_with_fields_data_types() {
data_type: Some(DataType::Custom(
ObjectName(vec![Ident {
value: "int".into(),
quote_style: Some('"')
quote_style: Some('"'),
span: Span::empty(),
}]),
vec![]
)),
@ -914,7 +919,8 @@ fn parse_create_view_with_fields_data_types() {
data_type: Some(DataType::Custom(
ObjectName(vec![Ident {
value: "String".into(),
quote_style: Some('"')
quote_style: Some('"'),
span: Span::empty(),
}]),
vec![]
)),