ffi: new native function format

This commit is contained in:
alex committed 2023-09-22 00:26:24 -07:00
1 parent f60715dfb3
commit 83c24843a3
14 files changed
+75 -57

No files matched your search

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