miksilo.modularLanguages.deltas.statement.assignment.AssignmentPrecedence.scala Maven / Gradle / Ivy
The newest version!
package miksilo.modularLanguages.deltas.statement.assignment
import miksilo.modularLanguages.core.deltas.grammars.LanguageGrammars
import miksilo.modularLanguages.core.deltas.{Contract, DeltaWithGrammar}
import miksilo.languageServer.core.language.Language
import miksilo.modularLanguages.core.node.GrammarKey
import miksilo.modularLanguages.deltas.expression.ExpressionDelta
object AssignmentPrecedence extends DeltaWithGrammar {
override def dependencies: Set[Contract] = Set(ExpressionDelta)
override def transformGrammars(grammars: LanguageGrammars, state: Language): Unit = {
val expressionGrammar = grammars.find(ExpressionDelta.FirstPrecedenceGrammar)
val assignmentGrammar = grammars.create(AssignmentGrammar, expressionGrammar.inner)
expressionGrammar.inner = assignmentGrammar
}
object AssignmentGrammar extends GrammarKey
override def description: String = "Wraps the current expression grammar in a failing assignment grammar."
}