Cleaned up the list implementation so as to NOT copy items into a new buffer.
This commit is contained in:
+8
-7
@@ -42,12 +42,15 @@ IRState* ParseTokens(List* tokens) {
|
||||
|
||||
AdvanceParser(); //Consume the label token
|
||||
|
||||
if (!symbol) AddSymbolToTable(t->Lemexe, NULL, strlen(t->Lemexe), MachineState.SymbolsTable)->Resolved = 1;
|
||||
else symbol->Resolved = 1;
|
||||
if (!symbol) symbol = AddSymbolToTable(t->Lemexe, NULL, strlen(t->Lemexe), MachineState.SymbolsTable);
|
||||
|
||||
symbol->Resolved = 1;
|
||||
|
||||
AdvanceParser(); //Consume the NewLine
|
||||
|
||||
// Instruction* ins = HandleOperation();
|
||||
Instruction* ins = HandleOperation();
|
||||
|
||||
if (!ins) printf("No op %s\n", symbol->Name);
|
||||
|
||||
// if (!ins) continue;
|
||||
|
||||
@@ -211,13 +214,11 @@ Instruction* HandleOperation() {
|
||||
|
||||
InsertInstruction:
|
||||
|
||||
AddListItem(ins, sizeof(Instruction), MachineState.Instructions);
|
||||
AddListItem(ins, MachineState.Instructions);
|
||||
|
||||
AdvanceParser(); //Consume the line break
|
||||
|
||||
free(ins);
|
||||
|
||||
return MachineState.Instructions->content[(MachineState.Instructions->size - 1) * sizeof(Instruction)];
|
||||
return ins;
|
||||
}
|
||||
|
||||
void PrintSymbols(void) {
|
||||
|
||||
Reference in New Issue
Block a user