mirror of
https://github.com/GayPizzaSpecifications/pork.git
synced 2025-08-04 05:31:33 +00:00
language: none support
This commit is contained in:
@ -276,6 +276,9 @@ types:
|
||||
Continue:
|
||||
parent: Expression
|
||||
values: []
|
||||
NoneLiteral:
|
||||
parent: Expression
|
||||
values: []
|
||||
Native:
|
||||
parent: Node
|
||||
values:
|
||||
|
@ -34,6 +34,7 @@ digraph A {
|
||||
type_ForIn [shape=box,label="ForIn"]
|
||||
type_Break [shape=box,label="Break"]
|
||||
type_Continue [shape=box,label="Continue"]
|
||||
type_NoneLiteral [shape=box,label="NoneLiteral"]
|
||||
type_Native [shape=box,label="Native"]
|
||||
type_Node -> type_Expression
|
||||
type_Node -> type_Symbol
|
||||
@ -62,6 +63,7 @@ digraph A {
|
||||
type_Expression -> type_ForIn
|
||||
type_Expression -> type_Break
|
||||
type_Expression -> type_Continue
|
||||
type_Expression -> type_NoneLiteral
|
||||
type_Definition -> type_FunctionDefinition
|
||||
type_Definition -> type_LetDefinition
|
||||
type_Declaration -> type_ImportDeclaration
|
||||
|
@ -56,6 +56,9 @@ class NodeCoalescer(val handler: (Node) -> Unit) : NodeVisitor<Unit> {
|
||||
override fun visitNative(node: Native): Unit =
|
||||
handle(node)
|
||||
|
||||
override fun visitNoneLiteral(node: NoneLiteral): Unit =
|
||||
handle(node)
|
||||
|
||||
override fun visitParentheses(node: Parentheses): Unit =
|
||||
handle(node)
|
||||
|
||||
|
@ -24,6 +24,7 @@ enum class NodeType(val parent: NodeType? = null) {
|
||||
ListLiteral(Expression),
|
||||
LongLiteral(Expression),
|
||||
Native(Node),
|
||||
NoneLiteral(Expression),
|
||||
Parentheses(Expression),
|
||||
PrefixOperation(Expression),
|
||||
SetAssignment(Expression),
|
||||
|
@ -38,6 +38,8 @@ interface NodeVisitor<T> {
|
||||
|
||||
fun visitNative(node: Native): T
|
||||
|
||||
fun visitNoneLiteral(node: NoneLiteral): T
|
||||
|
||||
fun visitParentheses(node: Parentheses): T
|
||||
|
||||
fun visitPrefixOperation(node: PrefixOperation): T
|
||||
|
@ -29,6 +29,7 @@ fun <T> NodeVisitor<T>.visit(node: Node): T =
|
||||
is ForIn -> visitForIn(node)
|
||||
is Break -> visitBreak(node)
|
||||
is Continue -> visitContinue(node)
|
||||
is NoneLiteral -> visitNoneLiteral(node)
|
||||
is Native -> visitNative(node)
|
||||
}
|
||||
|
||||
|
22
ast/src/main/kotlin/gay/pizza/pork/ast/NoneLiteral.kt
Normal file
22
ast/src/main/kotlin/gay/pizza/pork/ast/NoneLiteral.kt
Normal file
@ -0,0 +1,22 @@
|
||||
// GENERATED CODE FROM PORK AST CODEGEN
|
||||
package gay.pizza.pork.ast
|
||||
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
@SerialName("noneLiteral")
|
||||
class NoneLiteral : Expression() {
|
||||
override val type: NodeType = NodeType.NoneLiteral
|
||||
|
||||
override fun <T> visit(visitor: NodeVisitor<T>): T =
|
||||
visitor.visitNoneLiteral(this)
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (other !is NoneLiteral) return false
|
||||
return true
|
||||
}
|
||||
|
||||
override fun hashCode(): Int =
|
||||
31 * type.hashCode()
|
||||
}
|
Reference in New Issue
Block a user