feat: パーサ作り始め

This commit is contained in:
usbharu 2024-11-15 02:04:03 +09:00
parent 49498d581e
commit daed5fb235
Signed by: usbharu
GPG Key ID: 95CBCF7046307B77
2 changed files with 28 additions and 0 deletions

View File

@ -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

View File

@ -0,0 +1,9 @@
package dev.usbharu.markdown
import kotlin.collections.List
class Parser {
fun parse(tokens: List<Token>) {
}
}