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

Rename node.tokens #4

Closed
conartist6 opened this issue May 14, 2022 · 2 comments
Closed

Rename node.tokens #4

conartist6 opened this issue May 14, 2022 · 2 comments

Comments

@conartist6
Copy link
Member

conartist6 commented May 14, 2022

We need to carefully consider the best way to attach tokens to nodes.

node.tokens property has existing usages which would cause conflicts and breakages.

node[Symbol.for('cst/tokens')] would make the data format less usable -- harder to inspect, serialize, deserialize, etc.

node.cstTokens or node.ownTokens seems like it would probably be best.

@gibson042
Copy link

The ECMAScript specification uses the term "input element" (and note that tokens are a strict subset of input elements, with line terminators, linear whitespace, and comments being included in the latter category but not the former). In estree/estree#41 (comment) , I used sourceElements as the closest synonym I could find that didn't read strangely when removed from the context of that specification.

@conartist6
Copy link
Member Author

I'm leaning towards node.cstTokens. If I can't use a name directly from the spec I don't think cstTokens has an appreciably different meaning than sourceElements.

@conartist6 conartist6 changed the title Don't use node.tokens Rename node.tokens Jul 2, 2022
@conartist6 conartist6 changed the title Rename node.tokens Rename node.tokens Jul 2, 2022
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

No branches or pull requests

2 participants