Tweaked some APIs, hid some functions I don't want in the API

This commit is contained in:
2023-02-16 13:06:07 +00:00
parent 501ff6fff4
commit 1668dca255
13 changed files with 33 additions and 29 deletions

View File

@@ -39,7 +39,7 @@ int main() {
Toy_writeCompiler(&compiler, node);
//collate
int size = 0;
size_t size = 0;
unsigned char* bytecode = Toy_collateCompiler(&compiler, &size);
//cleanup
@@ -78,7 +78,7 @@ int main() {
}
//collate
int size = 0;
size_t size = 0;
unsigned char* bytecode = Toy_collateCompiler(&compiler, &size);
//cleanup

View File

@@ -87,7 +87,7 @@ int main() {
Toy_writeCompiler(&compiler, node);
//collate
int size = 0;
size_t size = 0;
const unsigned char* bytecode = Toy_collateCompiler(&compiler, &size);
//NOTE: suppress print output for testing

View File

@@ -15,10 +15,10 @@ int main() {
Toy_initLexer(&lexer, source);
//get each token
Toy_Token print = Toy_scanLexer(&lexer);
Toy_Token null = Toy_scanLexer(&lexer);
Toy_Token semi = Toy_scanLexer(&lexer);
Toy_Token eof = Toy_scanLexer(&lexer);
Toy_Token print = Toy_private_scanLexer(&lexer);
Toy_Token null = Toy_private_scanLexer(&lexer);
Toy_Token semi = Toy_private_scanLexer(&lexer);
Toy_Token eof = Toy_private_scanLexer(&lexer);
//test each token is correct
if (strncmp(print.lexeme, "print", print.length)) {

View File

@@ -50,7 +50,7 @@ const unsigned char* compileStringCustom(const char* source, size_t* size) {
}
//get the bytecode dump
const unsigned char* tb = Toy_collateCompiler(&compiler, (int*)(size));
const unsigned char* tb = Toy_collateCompiler(&compiler, size);
//cleanup
Toy_freeCompiler(&compiler);