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

Editorial: add a 'decode a list of base64 VLQ' algorithm #130

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

szuend
Copy link
Collaborator

@szuend szuend commented Sep 24, 2024

This PR extracts a 'decode a list of base64 VLQ' algorithm that consumes a string wholly and returns all contained VLQ numbers as a list. We can share this algorithm between decoding mappings and originalScopes/generatedRanges of the scopes proposal.

It also makes the algorithm slightly more readable as we can get rid of position and we don't necessarily need the relative* variables as they only have a single use-site.

source-map.bs Outdated Show resolved Hide resolved
source-map.bs Outdated Show resolved Hide resolved
Copy link
Member

@jridgewell jridgewell left a comment

Choose a reason for hiding this comment

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

Can we keep the optional error for a non-1/4/5 length segment?

My code will be slightly out of spec since we'll eat the , as a 0 value and continue reading values from the next segment. I see if I can instead limit my position to < commaIndex without adding more checks.

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.

3 participants