mirror of
https://github.com/ilyakooo0/intellij-haskell.git
synced 2024-09-11 14:56:19 +03:00
Preparations for supporting Cabal's internal library.
This commit is contained in:
parent
05d710b4cd
commit
2b8f370505
@ -150,7 +150,7 @@ sealed trait CabalStanza {
|
||||
}
|
||||
|
||||
case class LibraryCabalStanza(sectionRootElement: PsiElement, packageName: String, modulePath: String) extends CabalStanza {
|
||||
val nameElementType: Option[IElementType] = None
|
||||
val nameElementType: Option[IElementType] = Some(CabalTypes.LIBRARY_NAME)
|
||||
|
||||
val targetName: String = s"$packageName:lib"
|
||||
|
||||
|
@ -52,7 +52,8 @@ final class CabalPsiBuilder(builder: PsiBuilder)
|
||||
)
|
||||
|
||||
def library(): Boolean = stanza(
|
||||
"library", LIBRARY, LIBRARY_KEY, noStanzaArgs, () => libraryField()
|
||||
"library", LIBRARY, LIBRARY_KEY,
|
||||
() => stanzaNameArg(LIBRARY_NAME)(), () => libraryField()
|
||||
)
|
||||
|
||||
def libraryField(): Boolean = (
|
||||
@ -122,7 +123,7 @@ final class CabalPsiBuilder(builder: PsiBuilder)
|
||||
|
||||
def stanzaNameArg(el: CabalStanzaArgTokenType)(): Unit = getTokenType match {
|
||||
case _: CabalWordLikeTokenType => remapAdvance(el)
|
||||
case _ => error(s"Expected name argument")
|
||||
case _ => () // non internal library has no name
|
||||
}
|
||||
|
||||
def invalidStanza(): Boolean = {
|
||||
|
@ -323,6 +323,7 @@ public interface CabalTypes {
|
||||
|
||||
CabalElementType LIBRARY = new CabalElementType("LIBRARY");
|
||||
CabalStanzaKeyTokenType LIBRARY_KEY = new CabalStanzaKeyTokenType("LIBRARY_KEY");
|
||||
CabalStanzaArgTokenType LIBRARY_NAME = new CabalStanzaArgTokenType("LIBRARY_NAME");
|
||||
|
||||
CabalElementType EXPOSED_MODULES = new CabalElementType("EXPOSED_MODULES");
|
||||
CabalFieldKeyTokenType EXPOSED_MODULES_KEY = new CabalFieldKeyTokenType("EXPOSED_MODULES_KEY");
|
||||
|
Loading…
Reference in New Issue
Block a user