Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

naive statement splitter #142

Merged
merged 13 commits into from
Oct 21, 2024
85 changes: 80 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions crates/pg_lexer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ static PATTERN_LEXER: LazyLock<Regex> =
fn whitespace_tokens(input: &str) -> VecDeque<Token> {
let mut tokens = VecDeque::new();

for cap in PATTERN_LEXER.captures_iter(&input) {
for cap in PATTERN_LEXER.captures_iter(input) {
if let Some(whitespace) = cap.name("whitespace") {
tokens.push_back(Token {
token_type: TokenType::Whitespace,
Expand Down Expand Up @@ -139,8 +139,8 @@ pub fn lex(text: &str) -> Vec<Token> {
kind: SyntaxKind::from(&pg_query_token),
text: token_text,
span: TextRange::new(
TextSize::try_from(u32::try_from(pg_query_token.start).unwrap()).unwrap(),
TextSize::try_from(u32::try_from(pg_query_token.end).unwrap()).unwrap(),
TextSize::from(u32::try_from(pg_query_token.start).unwrap()),
TextSize::from(u32::try_from(pg_query_token.end).unwrap()),
),
});
pos += len;
Expand Down
1 change: 1 addition & 0 deletions crates/pg_statement_splitter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ edition = "2021"
[dependencies]
pg_lexer.workspace = true
text-size = "1.1.1"
ntest = "0.9.3"

[dev-dependencies]
pg_query = "0.8"
Expand Down
Loading
Loading