Skip to content
This repository was archived by the owner on Feb 4, 2025. It is now read-only.

The lexer should only return a span and a token-kind #384

Closed
jyn514 opened this issue Apr 27, 2020 · 4 comments
Closed

The lexer should only return a span and a token-kind #384

jyn514 opened this issue Apr 27, 2020 · 4 comments
Assignees
Labels
enhancement New feature or request hard Extra attention is needed lexer Issue dealing with parsing the lexical tokens of a program technical-debt

Comments

@jyn514
Copy link
Owner

jyn514 commented Apr 27, 2020

This is the traditional way to write a lexer, used by yacc, logos, and clang. The lexer identifies the boundaries of the token and the token kind and nothing else. This means for instance 1000000000000000000000000 would not be a lex error, but instead a parse error (and I'd probably want to delay it even further into constant folding).

This would make it significantly easier to switch to logos and support rust-lang/rust-bindgen#1762.

This requires a fairly significant refactor.

@jyn514 jyn514 added enhancement New feature or request lexer Issue dealing with parsing the lexical tokens of a program technical-debt labels Apr 27, 2020
@jyn514 jyn514 added this to the Preprocessor for bindgen milestone Apr 27, 2020
@jyn514 jyn514 added the hard Extra attention is needed label Apr 27, 2020
@jyn514 jyn514 pinned this issue May 1, 2020
@hdamron17
Copy link
Collaborator

Why should the lexer only provide span and token kind? It seems this restriction is only necessary for the preprocessor.

@jyn514
Copy link
Owner Author

jyn514 commented May 29, 2020

Look at the linked issues for examples; #385 and #383 in particular would be tricky without this, I'd have to move types all the way into the lexer.

@Stupremee
Copy link
Contributor

After I finished my current PRs, I will try to implement this.

@hdamron17 hdamron17 self-assigned this Jun 13, 2020
@hdamron17
Copy link
Collaborator

I am working on this in #474 because I needed it for #456.

@jyn514 jyn514 closed this as completed in 0ef39e4 Jul 27, 2020
@jyn514 jyn514 unpinned this issue Aug 6, 2020
jyn514 added a commit that referenced this issue Feb 4, 2025
Close #384: Return only span and type from lexer
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request hard Extra attention is needed lexer Issue dealing with parsing the lexical tokens of a program technical-debt
Projects
None yet
Development

No branches or pull requests

3 participants