-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
How do we define a Tokenstream? #2071
Comments
We might even want to narrow down the definition of type TokenStream = Array<string | Token>;
interface Token {
type: string;
content: string | TokenStream;
// some other properties
} because that is what |
Merged
Yeah, in general, if we can bring the types into alignment with what is actually produced at runtime, I'm ok with tightening up the types. It would only mean that consuming code has been handling cases it doesn't have to. |
Closed by #1782. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For #2070 I had to look at the tests of
TokenStreamTransformer.simplify
. And from these tests, a token stream is defined as:Yes, nested token streams.
But I always assumed that a token stream looks like this:
And I even added the condition that a token stream doesn't contain adjacent strings. I assumed this because the token stream produced by
tokenize
has these properties and because these properties are very useful.Point is: I wrote code with these assumptions, so do I have to rewrite it?
What is the correct definition of a token stream?
/cc @Golmote @mAAdhaTTah
The text was updated successfully, but these errors were encountered: