1
0
mirror of https://github.com/janet-lang/janet synced 2025-10-24 12:17:41 +00:00

Add utf-8 compatibility in parser. Symbols can

be valid utf-8 strings
This commit is contained in:
bakpakin
2017-12-20 23:03:34 -05:00
parent 8eea6e2a70
commit 34a83839f5
26 changed files with 1871 additions and 521 deletions

View File

@@ -24,6 +24,7 @@
#include <dst/dst.h>
#include "opcodes.h"
#include "gc.h"
/* Bytecode op argument types */
@@ -511,7 +512,7 @@ static DstAssembleResult dst_asm1(DstAssembler *parent, DstAssembleOptions opts)
DstValue x;
/* Initialize funcdef */
def = dst_alloc(DST_MEMORY_FUNCDEF, sizeof(DstFuncDef));
def = dst_gcalloc(DST_MEMORY_FUNCDEF, sizeof(DstFuncDef));
def->environments = NULL;
def->constants = NULL;
def->bytecode = NULL;
@@ -756,7 +757,7 @@ DstFunction *dst_asm_func(DstAssembleResult result) {
if (result.status != DST_ASSEMBLE_OK) {
return NULL;
}
DstFunction *func = dst_alloc(DST_MEMORY_FUNCTION, sizeof(DstFunction));
DstFunction *func = dst_gcalloc(DST_MEMORY_FUNCTION, sizeof(DstFunction));
func->def = result.funcdef;
func->envs = NULL;
return func;
@@ -906,5 +907,8 @@ DstValue dst_disasm(DstFuncDef *def) {
dst_table_put(ret, dst_csymbolv("environments"), dst_wrap_array(envs));
}
/* Add slotcount */
dst_table_put(ret, dst_csymbolv("slotcount"), dst_wrap_integer(def->slotcount));
return dst_wrap_struct(dst_table_to_struct(ret));
}