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

Add in support for boolean, character, and symbol literals. #22

Merged
merged 2 commits into from
Apr 1, 2021

Conversation

ckipp01
Copy link
Collaborator

@ckipp01 ckipp01 commented Mar 21, 2021

Previously we would just handle boolean literals and character literals
as identifiers, and wouldn't handle symbol literals.

@ckipp01 ckipp01 changed the title This adds in support for boolean literals. This adds in support for boolean and character literals. Mar 21, 2021
@ckipp01 ckipp01 changed the title This adds in support for boolean and character literals. Add in support for boolean and character literals. Mar 21, 2021
@ckipp01 ckipp01 marked this pull request as draft March 21, 2021 17:49
@ckipp01
Copy link
Collaborator Author

ckipp01 commented Mar 21, 2021

Just realized I also need to support symbol literals as well, plus there is an issue here with character literals. I'll add symbol literals to this as well before marking it ready to review.

Previously we would just handle boolean literals and character literals
as identifiers, and wouldn't handle symbol literals.
@ckipp01 ckipp01 marked this pull request as ready for review March 22, 2021 18:38
@ckipp01 ckipp01 changed the title Add in support for boolean and character literals. Add in support for boolean, character, and symbol literals. Mar 22, 2021
Comment on lines +651 to +663
character_literal: $ => token(seq(
'\'',
optional(choice(
seq('\\', choice(
/[^xu]/,
/u[0-9a-fA-F]{4}/,
/u{[0-9a-fA-F]+}/,
/x[0-9a-fA-F]{2}/
)),
/[^\\'\n]/
)),
'\''
)),
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I went back and forth on this a bunch trying to exactly get what is described here, and finally I just went with a modified version of what tree-sitter-rust was using.

@maxbrunsfeld maxbrunsfeld merged commit fb23ed9 into tree-sitter:master Apr 1, 2021
@maxbrunsfeld
Copy link
Contributor

Thanks! Sorry for the delay.

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.

2 participants