feat: パーサ作り始め
This commit is contained in:
parent
49498d581e
commit
daed5fb235
|
@ -0,0 +1,19 @@
|
||||||
|
package dev.usbharu.markdown
|
||||||
|
|
||||||
|
import kotlin.collections.List
|
||||||
|
|
||||||
|
sealed class AstNode
|
||||||
|
data class RootNode(val node: AstNode) : AstNode()
|
||||||
|
data class BodyNode(val body: List<AstNode>) : AstNode()
|
||||||
|
sealed class BlockNode : AstNode()
|
||||||
|
|
||||||
|
data class HeaderNode(val header: Int, val headerText: HeaderText?) : BlockNode()
|
||||||
|
data class HeaderText(val text: String) : BlockNode()
|
||||||
|
sealed interface QuotableNode
|
||||||
|
data class QuoteNode(val nodes: List<QuotableNode>) : AstNode(), QuotableNode
|
||||||
|
data object SeparatorNode : BlockNode()
|
||||||
|
sealed class ListNode : BlockNode()
|
||||||
|
data class DiscListNode(val node: InlineNode, val childList: List<ListNode>) : ListNode()
|
||||||
|
data class DecimalListNode(val node: InlineNode, val childList: List<ListNode>) : ListNode()
|
||||||
|
|
||||||
|
sealed class InlineNode : AstNode(), QuotableNode
|
|
@ -0,0 +1,9 @@
|
||||||
|
package dev.usbharu.markdown
|
||||||
|
|
||||||
|
import kotlin.collections.List
|
||||||
|
|
||||||
|
class Parser {
|
||||||
|
fun parse(tokens: List<Token>) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue