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

feat: require string tokens used as comparison values to be delimited #23

Merged
merged 9 commits into from
Sep 18, 2023

Conversation

jimlambrt
Copy link
Collaborator

@jimlambrt jimlambrt commented Sep 16, 2023

Originally, you could could write a query like: name=alice

This PR requires that same query to be written as: name="alice"

This change will allow us to introduce new keywords and/or reserved words as needed in the future without introducing breaking changes. It also disambiguates symbols from strings.

Also, this PR sets us up to support additional string delimiters in a subsequent PR. For instance, we can support ` (backtick) and ' (singe quote) as string delimiters which would really improve the UX for writing queries.

This PR also includes:

@jimlambrt
Copy link
Collaborator Author

I still need to update the docs and add a CHANGELOG entry. Besides those chores, this PR is ready for review.

@jimlambrt jimlambrt force-pushed the jimlambrt-req-delimitted-strings branch 2 times, most recently from df8771a to d2d414c Compare September 17, 2023 13:03
@jefferai
Copy link
Member

Also, this PR sets us up to support additional string delimiters in a subsequent PR. For instance, we can support ` (backtick) and ' (singe quote) as string delimiters which would really improve the UX for writing queries.

Do we want this? Would it be better to standardize on a single delimiter so that you can include others without escaping? e.g. if we standardize on single quote, we don't need to escape embedded double quotes. Or if we standardize on double quotes we don't need to escape apostrophes.

@jimlambrt
Copy link
Collaborator Author

jimlambrt commented Sep 17, 2023

The idea is to make it easier for the user by allowing them to choose the most convenient delimiter for the query they're writing.

Examples using double-quotes, single-quotes and backticks:

description=`Alice's Restaurant`  
description="Alice's Restaurant" 
description='This restaurant is "owned" by Alice'

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Show resolved Hide resolved
lex.go Outdated Show resolved Hide resolved
Copy link

@talanknight talanknight left a comment

Choose a reason for hiding this comment

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

Looks good. Thanks!

Copy link

@johanbrandhorst johanbrandhorst left a comment

Choose a reason for hiding this comment

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

Could you add some quoted strings to the fuzz tests?

GRAMMAR.md Outdated Show resolved Hide resolved
@jimlambrt jimlambrt force-pushed the jimlambrt-req-delimitted-strings branch from 9875cd6 to e7f4757 Compare September 18, 2023 18:26
@jimlambrt jimlambrt merged commit e7f4757 into main Sep 18, 2023
9 checks passed
@jimlambrt jimlambrt added the enhancement New feature or request label Sep 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants