AzureMarker / intellij-lalrpop

Jetbrains plugin for the LALRPOP parser-generator
MIT License
16 stars 2 forks source link

Inject Rust into nonterminal types #12

Closed AzureMarker closed 3 years ago

AzureMarker commented 4 years ago

Idea: take something like

Comma<T>: Vec<T> {
    // ...
}

and inject Rust into the type using something like:

type __intellij_lalrpop_Comma<T> = Vec<T>;
dnbln commented 4 years ago

Does the name really matter? If not I think it would be a better idea to inject that for all type_refs(except where they are recursive)

AzureMarker commented 4 years ago

I don't think the name of the type alias matters, but it probably should be different enough that it won't be referenced by the user. Also, each injection site should be independent of each other, so names shouldn't clash anyways.

That's a good idea, injecting for all non-recursive type_refs.

dnbln commented 3 years ago

There's one small catch here:

Nonterminal<Rule>: Box<Rule> = {/*...*/};

Trying to rename "Rule" from the injection leads to image