mirror of
https://github.com/GayPizzaSpecifications/pork.git
synced 2025-08-03 21:21:33 +00:00
language: prelude and internal functions, and varargs support
This commit is contained in:
@ -117,6 +117,12 @@ types:
|
||||
type: Symbol
|
||||
- name: arguments
|
||||
type: List<Expression>
|
||||
ArgumentSpec:
|
||||
values:
|
||||
- name: symbol
|
||||
type: Symbol
|
||||
- name: multiple
|
||||
type: Boolean
|
||||
FunctionDefinition:
|
||||
parent: Definition
|
||||
values:
|
||||
@ -125,7 +131,7 @@ types:
|
||||
- name: symbol
|
||||
type: Symbol
|
||||
- name: arguments
|
||||
type: List<Symbol>
|
||||
type: List<ArgumentSpec>
|
||||
- name: block
|
||||
type: Block?
|
||||
- name: native
|
||||
|
@ -14,6 +14,7 @@ digraph A {
|
||||
type_InfixOperation [shape=box,label="InfixOperation"]
|
||||
type_BooleanLiteral [shape=box,label="BooleanLiteral"]
|
||||
type_FunctionCall [shape=box,label="FunctionCall"]
|
||||
type_ArgumentSpec [shape=box,label="ArgumentSpec"]
|
||||
type_FunctionDefinition [shape=box,label="FunctionDefinition"]
|
||||
type_If [shape=box,label="If"]
|
||||
type_ImportDeclaration [shape=box,label="ImportDeclaration"]
|
||||
@ -70,8 +71,10 @@ digraph A {
|
||||
type_InfixOperation -> type_InfixOperator [style=dotted]
|
||||
type_FunctionCall -> type_Symbol [style=dotted]
|
||||
type_FunctionCall -> type_Expression [style=dotted]
|
||||
type_ArgumentSpec -> type_Symbol [style=dotted]
|
||||
type_FunctionDefinition -> type_DefinitionModifiers [style=dotted]
|
||||
type_FunctionDefinition -> type_Symbol [style=dotted]
|
||||
type_FunctionDefinition -> type_ArgumentSpec [style=dotted]
|
||||
type_FunctionDefinition -> type_Block [style=dotted]
|
||||
type_FunctionDefinition -> type_Native [style=dotted]
|
||||
type_If -> type_Expression [style=dotted]
|
||||
|
9
ast/src/main/kotlin/gay/pizza/pork/ast/ArgumentSpec.kt
Normal file
9
ast/src/main/kotlin/gay/pizza/pork/ast/ArgumentSpec.kt
Normal file
@ -0,0 +1,9 @@
|
||||
// GENERATED CODE FROM PORK AST CODEGEN
|
||||
package gay.pizza.pork.ast
|
||||
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
@SerialName("argumentSpec")
|
||||
class ArgumentSpec(var symbol: Symbol, var multiple: Boolean)
|
@ -6,11 +6,11 @@ import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
@SerialName("functionDefinition")
|
||||
class FunctionDefinition(override val modifiers: DefinitionModifiers, override val symbol: Symbol, val arguments: List<Symbol>, val block: Block?, val native: Native?) : Definition() {
|
||||
class FunctionDefinition(override val modifiers: DefinitionModifiers, override val symbol: Symbol, val arguments: List<ArgumentSpec>, val block: Block?, val native: Native?) : Definition() {
|
||||
override val type: NodeType = NodeType.FunctionDefinition
|
||||
|
||||
override fun <T> visitChildren(visitor: NodeVisitor<T>): List<T> =
|
||||
visitor.visitAll(listOf(symbol), arguments, listOf(block), listOf(native))
|
||||
visitor.visitAll(listOf(symbol), listOf(block), listOf(native))
|
||||
|
||||
override fun <T> visit(visitor: NodeVisitor<T>): T =
|
||||
visitor.visitFunctionDefinition(this)
|
||||
|
Reference in New Issue
Block a user