mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 14:54:07 +10:00
Cleaned up some comments
This commit is contained in:
@@ -31,7 +31,7 @@ typedef enum Toy_AstFlag {
|
||||
TOY_AST_FLAG_MULTIPLY,
|
||||
TOY_AST_FLAG_DIVIDE,
|
||||
TOY_AST_FLAG_MODULO,
|
||||
TOY_AST_FLAG_ASSIGN, //TODO: implement the declare statement
|
||||
TOY_AST_FLAG_ASSIGN,
|
||||
TOY_AST_FLAG_ADD_ASSIGN,
|
||||
TOY_AST_FLAG_SUBTRACT_ASSIGN,
|
||||
TOY_AST_FLAG_MULTIPLY_ASSIGN,
|
||||
@@ -99,7 +99,6 @@ typedef struct Toy_AstPass {
|
||||
|
||||
typedef struct Toy_AstError {
|
||||
Toy_AstType type;
|
||||
//TODO: more data regarding the error
|
||||
} Toy_AstError;
|
||||
|
||||
typedef struct Toy_AstEnd {
|
||||
|
||||
@@ -36,7 +36,7 @@ typedef enum Toy_OpcodeType {
|
||||
//various action instructions
|
||||
TOY_OPCODE_PRINT,
|
||||
TOY_OPCODE_CONCAT,
|
||||
//TODO: clear the program stack
|
||||
//TODO: clear the program stack?
|
||||
|
||||
//meta instructions
|
||||
TOY_OPCODE_PASS,
|
||||
|
||||
@@ -92,7 +92,6 @@ static void emitString(Toy_Routine** rt, Toy_String* str) {
|
||||
static void writeRoutineCode(Toy_Routine** rt, Toy_Ast* ast); //forward declare for recursion
|
||||
|
||||
static void writeInstructionValue(Toy_Routine** rt, Toy_AstValue ast) {
|
||||
//TODO: store more complex values in the data code
|
||||
EMIT_BYTE(rt, code, TOY_OPCODE_READ);
|
||||
EMIT_BYTE(rt, code, ast.value.type);
|
||||
|
||||
@@ -369,7 +368,9 @@ static void* writeRoutine(Toy_Routine* rt, Toy_Ast* ast) {
|
||||
emitInt((void**)&buffer, &capacity, &count, 0); //subs
|
||||
}
|
||||
|
||||
//append various parts to the buffer TODO: add the rest
|
||||
//append various parts to the buffer
|
||||
//TODO: param region
|
||||
|
||||
if (rt->codeCount > 0) {
|
||||
expand(&buffer, &capacity, &count, rt->codeCount);
|
||||
memcpy((buffer + count), rt->code, rt->codeCount);
|
||||
@@ -394,6 +395,8 @@ static void* writeRoutine(Toy_Routine* rt, Toy_Ast* ast) {
|
||||
count += rt->dataCount;
|
||||
}
|
||||
|
||||
//TODO: subs region
|
||||
|
||||
//finally, record the total size within the header, and return the result
|
||||
*((int*)buffer) = count;
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "toy_bucket.h"
|
||||
#include "toy_value.h"
|
||||
|
||||
//TODO: Remove this
|
||||
#define TOY_STRING_MAX_LENGTH 1000
|
||||
|
||||
//rope pattern
|
||||
|
||||
@@ -25,7 +25,7 @@ bool Toy_private_isTruthy(Toy_Value value) {
|
||||
bool Toy_private_isEqual(Toy_Value left, Toy_Value right) {
|
||||
//temp check
|
||||
if (right.type > TOY_VALUE_STRING) {
|
||||
Toy_error(TOY_CC_ERROR "ERROR: Unknown types in value equality comparison\n" TOY_CC_RESET); //TODO: varargs
|
||||
Toy_error(TOY_CC_ERROR "ERROR: Unknown types in value equality comparison\n" TOY_CC_RESET);
|
||||
}
|
||||
|
||||
switch(left.type) {
|
||||
@@ -64,7 +64,7 @@ bool Toy_private_isEqual(Toy_Value left, Toy_Value right) {
|
||||
case TOY_VALUE_FUNCTION:
|
||||
case TOY_VALUE_OPAQUE:
|
||||
default:
|
||||
Toy_error(TOY_CC_ERROR "ERROR: Unknown types in value equality comparison\n" TOY_CC_RESET); //TODO: varargs
|
||||
Toy_error(TOY_CC_ERROR "ERROR: Unknown types in value equality comparison\n" TOY_CC_RESET);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -111,7 +111,7 @@ unsigned int Toy_hashValue(Toy_Value value) {
|
||||
return str->cachedHash;
|
||||
}
|
||||
else if (str->type == TOY_STRING_NODE) {
|
||||
//TODO: I wonder it it would be possible to discretely swap the composite node string with a new leaf string here? Would that speed up other parts of the code by not having to walk the tree?
|
||||
//TODO: I wonder if it would be possible to discretely swap the composite node string with a new leaf string here? Would that speed up other parts of the code by not having to walk the tree in future?
|
||||
char* buffer = Toy_getStringRawBuffer(str);
|
||||
str->cachedHash = hashCString(buffer);
|
||||
free(buffer);
|
||||
|
||||
@@ -29,8 +29,8 @@ typedef struct Toy_VM {
|
||||
//stack - immediate-level values only
|
||||
Toy_Stack* stack;
|
||||
|
||||
//heap - block-level key/value pairs
|
||||
//TODO: needs string util for identifiers
|
||||
//scope - block-level key/value pairs
|
||||
//TODO: Toy_Scope* scope;
|
||||
|
||||
//easy access to memory
|
||||
Toy_Bucket* stringBucket;
|
||||
|
||||
Reference in New Issue
Block a user