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

wip: Reserved keywords only unquoted #800

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

alixander
Copy link
Collaborator

@alixander alixander commented Feb 12, 2023

@nhooyr spot check before i go too far on this. there's a number of places where we iterate over ida and check reserved. those will be annoying, as we now have to change them to carry info about their original AST quoting. E.g. there's a lot of ScalarString() conversions made too early now

closes #477

Copy link
Contributor

@nhooyr nhooyr left a comment

Choose a reason for hiding this comment

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

looks reasonable otherwise to me

Name: head,
parent: m,
Name: headString,
IsUnquoted: headUnquoted,
Copy link
Contributor

Choose a reason for hiding this comment

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

You also need to check that there are no escapes. Use len(headString) == len(head.(*d2ast.UnquotedString).RawString). i.e there are no escapes if the length of the string value is equal to it's length in the AST.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

IsUnquoted could be confusing then, but i can't think of a word that encapsulates "is unquoted or is escaped". Raw already means something else. will leave as IsUnquoted for now unless u have a word

Copy link
Contributor

Choose a reason for hiding this comment

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

Yea just add a comment on IsUnquoted. I have no better word in mind.

@janydoe
Copy link
Contributor

janydoe commented Jun 21, 2023

I wait this one, to remove trailing space in quoted reserved keywords!

Related: #1419

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.

compiler: escape reserved keywords
3 participants