Skip to content

Fix Token::Table identifier hack#60

Merged
ryancinsight merged 1 commit intomainfrom
fix-table-token-hack-15208312873007818251
Jan 11, 2026
Merged

Fix Token::Table identifier hack#60
ryancinsight merged 1 commit intomainfrom
fix-table-token-hack-15208312873007818251

Conversation

@google-labs-jules
Copy link
Contributor

@google-labs-jules google-labs-jules bot commented Jan 11, 2026

Refactored Token::Table to carry the original string payload, enabling correct identifier parsing for the keyword "TABLE" and resolving a parser hack. Updated parser logic to consume the new token variant correctly.


PR created automatically by Jules for task 15208312873007818251 started by @ryancinsight

High-level PR Summary

This PR refactors the Token::Table enum variant to store the original string identifier, removing a parser hack that previously treated the TABLE keyword as a generic identifier. The tokenizer now preserves the original string when creating Token::Table, and the parser adds a dedicated consume_table_keyword() method to handle this token variant properly. This ensures correct identifier parsing while maintaining the keyword's special status in SQL grammar.

⏱️ Estimated Review Time: 5-15 minutes

💡 Review Order Suggestion
Order File Path
1 src/core/query/sql/tokenizer.rs
2 src/core/query/sql/parser/core.rs
3 src/core/query/sql/parser/statement.rs
4 src/core/query/sql/tests/parser_tests.rs

Need help? Join our Discord

This change modifies `Token::Table` to store the original string representation, allowing it to be used as an identifier with correct casing. It replaces the previous hack in `SqlParser::expect_identifier` with proper handling of the `Token::Table` variant. A new method `consume_table_keyword` is added to `SqlParser` to handle `Token::Table` consumption since it's no longer a unit variant.

Changes:
- Update `Token::Table` to `Token::Table(String)` in `src/core/query/sql/tokenizer.rs`.
- Update `SqlTokenizer` to capture the table keyword string.
- Update `SqlParser::expect_identifier` in `src/core/query/sql/parser/core.rs` to return the stored string for `Token::Table`.
- Add `SqlParser::consume_table_keyword` to handle matching `Token::Table` regardless of its payload.
- Update `SqlParser` in `src/core/query/sql/parser/statement.rs` to use `consume_table_keyword`.
- Update `parser_tests.rs` to match the new debug output format for `Token::Table`.
@google-labs-jules
Copy link
Contributor Author

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@coderabbitai
Copy link

coderabbitai bot commented Jan 11, 2026

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Comment @coderabbitai help to get the list of available commands and usage tips.

@openhands-ai
Copy link

openhands-ai bot commented Jan 11, 2026

Looks like there are a few issues preventing this PR from being merged!

  • GitHub Actions are failing:
    • Rust CI
    • Rust CI

If you'd like me to help, just leave a comment, like

@OpenHands please fix the failing actions on PR #60 at branch `fix-table-token-hack-15208312873007818251`

Feel free to include any additional details that might help me get this PR into a better state.

You can manage your notification settings

Copy link

@recurseml recurseml bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review by RecurseML

🔍 Review performed on 1740f02..808fd1b

✨ No bugs found, your code is sparkling clean

✅ Files analyzed, no issues (4)

src/core/query/sql/parser/core.rs
src/core/query/sql/parser/statement.rs
src/core/query/sql/tests/parser_tests.rs
src/core/query/sql/tokenizer.rs

@ryancinsight ryancinsight marked this pull request as ready for review January 11, 2026 06:13
@ryancinsight ryancinsight merged commit 4260dc0 into main Jan 11, 2026
2 of 4 checks passed
@ryancinsight ryancinsight deleted the fix-table-token-hack-15208312873007818251 branch January 11, 2026 06:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant