mirror of
https://github.com/GayPizzaSpecifications/pork.git
synced 2025-08-03 21:21:33 +00:00
ffi: new native function format
This commit is contained in:
@ -308,8 +308,11 @@ class Parser(source: TokenSource, attribution: NodeAttribution) :
|
||||
override fun parseNative(): Native = guarded(NodeType.Native) {
|
||||
expect(TokenType.Native)
|
||||
val form = parseSymbol()
|
||||
val definition = parseStringLiteral()
|
||||
Native(form, definition)
|
||||
val definitions = mutableListOf<StringLiteral>()
|
||||
while (peek(TokenType.StringLiteral)) {
|
||||
definitions.add(parseStringLiteral())
|
||||
}
|
||||
Native(form, definitions)
|
||||
}
|
||||
|
||||
override fun parseNoneLiteral(): NoneLiteral = guarded(NodeType.NoneLiteral) {
|
||||
|
@ -82,7 +82,12 @@ class Printer(buffer: StringBuilder) : NodeVisitor<Unit> {
|
||||
append("native ")
|
||||
visit(node.form)
|
||||
append(" ")
|
||||
visit(node.definition)
|
||||
for ((index, argument) in node.definitions.withIndex()) {
|
||||
visit(argument)
|
||||
if (index + 1 != node.definitions.size) {
|
||||
append(" ")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun visitNoneLiteral(node: NoneLiteral) {
|
||||
|
Reference in New Issue
Block a user