Do some more stuff
This commit is contained in:
11
src/parser.c
11
src/parser.c
@@ -110,9 +110,8 @@ static GroundArg parseArgument(const char* token) {
|
||||
// Could be type reference or negative number
|
||||
if (strlen(token) > 1 && !isdigit(token[1])) {
|
||||
// Type reference (e.g., -int, -string)
|
||||
return createRefGroundArg(LABEL, token + 1); // Using LABEL for type refs
|
||||
return createRefGroundArg(TYPEREF, token + 1);
|
||||
}
|
||||
// Fall through to number parsing
|
||||
}
|
||||
|
||||
// Try to parse as number
|
||||
@@ -193,10 +192,10 @@ GroundProgram parseFile(const char* file) {
|
||||
// Check if first token is a label
|
||||
size_t tokenStart = 0;
|
||||
if (line.tokens[0].text[0] == '@') {
|
||||
// TODO: Handle labels - you might want to store them separately
|
||||
// For now, skip to next token
|
||||
tokenStart = 1;
|
||||
if (tokenStart >= line.count) continue;
|
||||
GroundInstruction inst = createGroundInstruction(CREATELABEL);
|
||||
addArgToInstruction(&inst, createRefGroundArg(LABEL, line.tokens[0].text + 1));
|
||||
addInstructionToProgram(&program, inst);
|
||||
continue;
|
||||
}
|
||||
|
||||
// First non-label token is the instruction
|
||||
|
||||
Reference in New Issue
Block a user