-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Expose Dependency Declarations with ANTLR parsing context for manipul…
…ation (#17) - Introduce DependencyElement module and used as elements type in DependencyContainer for clarity and type safety - Add a function to expose declaration with context
- Loading branch information
Showing
5 changed files
with
70 additions
and
57 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
core/src/main/kotlin/cash/grammar/kotlindsl/model/DependencyElement.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package cash.grammar.kotlindsl.model | ||
|
||
import com.squareup.cash.grammar.KotlinParser.StatementContext | ||
|
||
/** | ||
* Base class representing an element within the `dependencies` block. | ||
* | ||
* @property statement The context of the statement in the dependencies block. | ||
*/ | ||
public sealed class DependencyElement(public open val statement: StatementContext) | ||
|
||
/** | ||
* Represents a dependency declaration within the `dependencies` block. | ||
* | ||
* @property declaration The parsed dependency declaration. | ||
* @property statement The context of the statement in the dependencies block. | ||
*/ | ||
public data class DependencyDeclarationElement( | ||
val declaration: DependencyDeclaration, | ||
override val statement: StatementContext | ||
) : DependencyElement(statement) | ||
|
||
/** | ||
* Represents a statement within the `dependencies` block that is **not** a dependency declaration. | ||
* | ||
* @property statement The context of the statement within the dependencies block. | ||
*/ | ||
public data class NonDependencyDeclarationElement(override val statement: StatementContext) : DependencyElement(statement) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters