-
Notifications
You must be signed in to change notification settings - Fork 2
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
More inspections #22
More inspections #22
Conversation
src/main/kotlin/com/mdrobnak/lalrpop/inspections/MissingTerminalsInspection.kt
Show resolved
Hide resolved
src/main/kotlin/com/mdrobnak/lalrpop/psi/ext/LpNonterminalRef.kt
Outdated
Show resolved
Hide resolved
src/main/resources/inspectionDescriptions/MissingTerminals.html
Outdated
Show resolved
Hide resolved
src/main/kotlin/com/mdrobnak/lalrpop/inspections/NamedSymbolsInspection.kt
Outdated
Show resolved
Hide resolved
src/main/kotlin/com/mdrobnak/lalrpop/inspections/WrongInferredTypeInspection.kt
Outdated
Show resolved
Hide resolved
src/main/kotlin/com/mdrobnak/lalrpop/psi/ext/LpNonterminalRef.kt
Outdated
Show resolved
Hide resolved
src/main/kotlin/com/mdrobnak/lalrpop/LpRefactoringSupportProvider.kt
Outdated
Show resolved
Hide resolved
src/main/kotlin/com/mdrobnak/lalrpop/inspections/WrongInferredTypeInspection.kt
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking pretty good!
src/main/kotlin/com/mdrobnak/lalrpop/psi/ext/LpNonterminalParam.kt
Outdated
Show resolved
Hide resolved
src/main/kotlin/com/mdrobnak/lalrpop/inspections/WrongInferredTypeInspection.kt
Show resolved
Hide resolved
src/main/kotlin/com/mdrobnak/lalrpop/inspections/WrongInferredTypeInspection.kt
Outdated
Show resolved
Hide resolved
src/main/kotlin/com/mdrobnak/lalrpop/inspections/WrongInferredTypeInspection.kt
Outdated
Show resolved
Hide resolved
src/main/kotlin/com/mdrobnak/lalrpop/inspections/WrongInferredTypeInspection.kt
Show resolved
Hide resolved
src/main/kotlin/com/mdrobnak/lalrpop/inspections/WrongInferredTypeInspection.kt
Outdated
Show resolved
Hide resolved
return object : LpVisitor() { | ||
override fun visitNonterminal(nonterminal: LpNonterminal) { | ||
if (nonterminal.nonterminalName.nonterminalParams != null) return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it may be possible to support nonterminals with params by generating unit structs in Rust file. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not really sure what you mean. ctx.canCombineTypes()
would return true
only if both types are ()
, right? What do you have in mind?
PS: sorry for not answering sooner, I was way too busy this week.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No worries about responding slower; it's the holiday season now 🙂.
For each type/rule parameter, the generated Rust code could have a RuleN
struct which is used in place of the generic type. For example:
MyNonterminal<K, V>: HashMap<K, V> = ...; // alternative type resolves to std::collections::HashMap<K, V>
// imports
struct Rule1;
struct Rule2;
type T1 = HashMap<Rule1, Rule2>;
type T2 = std::collections::HashMap<Rule1, Rule2>;
There might be some issues if the generic type has bounds, like Hash
in this case. It may be better to check if the Rust plugin supports comparing types with unbound generics (i.e. type T1<K, V> = HashMap<K, V>;
).
But I think this can wait for a future PR, if you think it's worthwhile to pursue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm ready to merge this, but I'll wait in case you're planning on adding more commits.
@dblanovschi Let me know when you're ready for this PR to be merged. I'll probably make a release right afterwards. |
With the last commit, there is only #22 (comment) left. I think that'd be worth looking into, but some other time. |
src/main/kotlin/com/mdrobnak/lalrpop/inspections/PrecedenceInspection.kt
Outdated
Show resolved
Hide resolved
src/main/kotlin/com/mdrobnak/lalrpop/inspections/PrecedenceInspection.kt
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again for contributing! These inspections look great!
This PR adds inspections for the first 3 ideas mentioned in #18 + 3 extra.