Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions crates/pgt_lexer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ pub enum TokenType {
impl From<&ScanToken> for TokenType {
fn from(token: &ScanToken) -> TokenType {
match token.token {
// SqlComment
275 => TokenType::Whitespace,
// SqlComment | CComment
275 | 276 => TokenType::Whitespace,
_ => match token.keyword_kind() {
KeywordKind::NoKeyword => TokenType::NoKeyword,
KeywordKind::UnreservedKeyword => TokenType::UnreservedKeyword,
Expand Down Expand Up @@ -59,6 +59,7 @@ pub static WHITESPACE_TOKENS: &[SyntaxKind] = &[
SyntaxKind::Tab,
SyntaxKind::Newline,
SyntaxKind::SqlComment,
SyntaxKind::CComment,
];

static PATTERN_LEXER: LazyLock<Regex> = LazyLock::new(|| {
Expand Down
5 changes: 5 additions & 0 deletions crates/pgt_statement_splitter/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,11 @@ mod tests {
.expect_statements(vec!["insert into tbl (id) select 1", "select 3"]);
}

#[test]
fn c_style_comments() {
Tester::from("/* this is a test */\nselect 1").expect_statements(vec!["select 1"]);
}

#[test]
fn with_check() {
Tester::from("create policy employee_insert on journey_execution for insert to authenticated with check ((select private.organisation_id()) = organisation_id);")
Expand Down