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

Provide more information in the tokenizer (added to the Token) #13

Closed
Specy opened this issue Sep 14, 2024 · 1 comment
Closed

Provide more information in the tokenizer (added to the Token) #13

Specy opened this issue Sep 14, 2024 · 1 comment
Assignees

Comments

@Specy
Copy link
Collaborator

Specy commented Sep 14, 2024

Most parsers have information on a token that tell you at what position the token is in. for example in this tokenized string (tokens separated by a |):

foo|(|bar|+|baz|)

foo: offset 0, len 3 (optional, can be derived from the slice itself
(: offset 3, len 1
bar: offset: 4, len 3

etc...
Other useful proprieties are start line, end line, start column, end column

Also, does the parser ignore whitespace? foo(bar+baz) and foo(bar + baz) tokenize the same.
The offset information is useful to create things like this:
image
I was calculating the offset myself but since whitespace seems to be ignored, the tokens positions are wrong, this would be solved with the offsets.

This should also help with #1

@umut-sahin
Copy link
Owner

Yeap, this should be done, for sure. I'll try to take a look this weekend.

@umut-sahin umut-sahin self-assigned this Sep 17, 2024
Specy added a commit to Specy/dotlr that referenced this issue Oct 1, 2024
Specy added a commit to Specy/dotlr that referenced this issue Oct 1, 2024
Specy added a commit to Specy/dotlr that referenced this issue Oct 1, 2024
Specy added a commit to Specy/dotlr that referenced this issue Oct 1, 2024
Specy added a commit to Specy/dotlr that referenced this issue Oct 1, 2024
Specy added a commit to Specy/dotlr that referenced this issue Oct 12, 2024
Specy added a commit to Specy/dotlr that referenced this issue Oct 12, 2024
Specy added a commit to Specy/dotlr that referenced this issue Oct 14, 2024
B
feat: add token span info, fixes umut-sahin#1 and umut-sahin#13
Specy added a commit to Specy/dotlr that referenced this issue Oct 14, 2024
Specy added a commit to Specy/dotlr that referenced this issue Oct 21, 2024
Specy added a commit to Specy/dotlr that referenced this issue Oct 21, 2024
Specy added a commit to Specy/dotlr that referenced this issue Oct 31, 2024
umut-sahin pushed a commit that referenced this issue Nov 7, 2024
@Specy Specy closed this as completed Nov 10, 2024
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