File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -981,8 +981,11 @@ pub enum Expr {
981981 /// XXX not valid SQL syntax, this is a hack needed to support parameter substitution
982982 /// `[ NOT ] IN <in_expr>`
983983 InExpr {
984+ /// Left-hand expression to test for membership.
984985 expr : Box < Expr > ,
986+ /// Unparenthesized expression providing the candidate values.
985987 in_expr : Box < Expr > ,
988+ /// `true` when the `NOT` modifier is present.
986989 negated : bool ,
987990 } ,
988991 /// `[ NOT ] IN UNNEST(array_expression)`
Original file line number Diff line number Diff line change @@ -1509,7 +1509,9 @@ pub enum TableFactor {
15091509 /// A pass-through query string that is not parsed.
15101510 /// This is useful while building/rewriting queries with a known valid SQL string and to avoid parsing it.
15111511 PassThroughQuery {
1512+ /// Query text to emit without parsing.
15121513 query : String ,
1514+ /// Optional alias for the pass-through query.
15131515 alias : Option < TableAlias > ,
15141516 } ,
15151517 /// `TABLE(<expr>)[ AS <alias> ]`
Original file line number Diff line number Diff line change 155155#![ allow( clippy:: large_enum_variant) ]
156156#![ forbid( clippy:: unreachable) ]
157157#![ forbid( missing_docs) ]
158- // TODO: Fix and remove this.
159- #![ expect( clippy:: unnecessary_unwrap) ]
160158
161159// Allow proc-macros to find this crate
162160extern crate self as sqlparser;
Original file line number Diff line number Diff line change @@ -788,13 +788,18 @@ impl fmt::Display for TokenWithSpan {
788788 }
789789}
790790
791+ /// A token and its byte range in the original SQL text.
791792pub struct TokenWithRange {
793+ /// Parsed token.
792794 pub token : Token ,
795+ /// Inclusive byte offset where the token starts.
793796 pub start : usize ,
797+ /// Exclusive byte offset where the token ends.
794798 pub end : usize ,
795799}
796800
797801impl TokenWithRange {
802+ /// Create a token with its inclusive start and exclusive end byte offsets.
798803 pub fn new ( token : Token , start : usize , end : usize ) -> Self {
799804 Self { token, start, end }
800805 }
@@ -957,6 +962,7 @@ impl<'a> Tokenizer<'a> {
957962 Ok ( twl. into_iter ( ) . map ( |t| t. token ) . collect ( ) )
958963 }
959964
965+ /// Tokenize the statement and return each token with its source byte range.
960966 pub fn tokenize_with_range ( & mut self ) -> Result < Vec < TokenWithRange > , TokenizerError > {
961967 let mut tokens = Vec :: < TokenWithRange > :: new ( ) ;
962968 let mut state = State {
Original file line number Diff line number Diff line change @@ -16018,6 +16018,7 @@ fn ast_with_pass_through_query() {
1601816018 explicit: false,
1601916019 name: Ident::new("ty"),
1602016020 columns: vec![],
16021+ at: None,
1602116022 }),
1602216023 };
1602316024
@@ -16042,6 +16043,7 @@ fn ast_with_pass_through_query_with_explicit_alias() {
1604216043 explicit: true,
1604316044 name: Ident::new("ty"),
1604416045 columns: vec![],
16046+ at: None,
1604516047 }),
1604616048 };
1604716049
You can’t perform that action at this time.
0 commit comments