Skip to content

feat(parser): introduce ParserImpl::token_source method #11737

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

Merged

Conversation

overlookmotel
Copy link
Contributor

@overlookmotel overlookmotel commented Jun 16, 2025

Introduce ParserImpl::token_source to get the source text corresponding to a Token.

Also:

  • Use this method in ParserImpl::cur_src.
  • Add a separate path to check validity of the string slice operation in debug mode.
  • Add #[inline] to cur_src. As we're using unchecked slicing, this method is only a few instructions.

@github-actions github-actions bot added A-parser Area - Parser C-enhancement Category - New feature or request labels Jun 16, 2025
Copy link
Contributor Author

overlookmotel commented Jun 16, 2025


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@overlookmotel overlookmotel marked this pull request as ready for review June 16, 2025 10:23
Copy link

codspeed-hq bot commented Jun 16, 2025

CodSpeed Instrumentation Performance Report

Merging #11737 will not alter performance

Comparing 06-16-feat_parser_introduce_parserimpl_token_source_method (e05d9bb) with main (7c0fff7)

Summary

✅ 38 untouched benchmarks

@graphite-app graphite-app bot added the 0-merge Merge with Graphite Merge Queue label Jun 16, 2025
Copy link
Contributor

graphite-app bot commented Jun 16, 2025

Merge activity

Introduce `ParserImpl::token_source` to get the source text corresponding to a `Token`.

Also:

* Use this method in `ParserImpl::cur_src`.
* Add a separate path to check validity of the string slice operation in debug mode.
* Add `#[inline]` to `cur_src`. As we're using unchecked slicing, this method is only a few instructions.
@graphite-app graphite-app bot force-pushed the 06-16-feat_parser_introduce_parserimpl_token_source_method branch from 4bc8335 to e05d9bb Compare June 16, 2025 11:14
@graphite-app graphite-app bot merged commit e05d9bb into main Jun 16, 2025
25 checks passed
@graphite-app graphite-app bot deleted the 06-16-feat_parser_introduce_parserimpl_token_source_method branch June 16, 2025 11:20
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Jun 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-parser Area - Parser C-enhancement Category - New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant