RPG-Alex commented on issue #2065:
URL: 
https://github.com/apache/datafusion-sqlparser-rs/issues/2065#issuecomment-3399916485

   After looking around I have found 
[this](https://github.com/apache/datafusion-sqlparser-rs/blob/4490c8c55cbe1e6b96a29fd9ba448e06320af50a/src/tokenizer.rs#L459):
   ```rust
   pub enum Whitespace {
       Space,
       Newline,
       Tab,
       SingleLineComment { comment: String, prefix: String },
       MultiLineComment(String),
   }
   ```
   
   So not only does the tokenizer support comments it tracks the comment 
content!
   
   I have then gone to the [parser 
mod](https://github.com/apache/datafusion-sqlparser-rs/blob/4490c8c55cbe1e6b96a29fd9ba448e06320af50a/src/parser/mod.rs#L454),
 where the `Tokenizer::new` is used, and after adding a `println!` on a small 
sql string to parse, I can see:
   ```
   Tokens found: ... TokenWithSpan { token: Whitespace(SingleLineComment { 
comment: " this is a comment\n", prefix: "--" }), span: 
Span(Location(2,1)..Location(3,1)) }, ... }
   ```
   (ellipses for omitted output for brevity)
   
   For clarity the query I used:
   ```sql
   -- this is a comment
   SELECT * FROM foo; SELECT * FROM bar;
   ```
   
   So it seems that the single line comment is being successfully tokenized! I 
may try to implement support for this depending on the difficulty around 
integrating with the parser. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to