Added scopes using '{}' symbols, read more

I've also added a new literal type called 'identifier'. This will be
used for variable names, and has a type mask embedded in it.
This commit is contained in:
2022-08-08 15:02:12 +01:00
parent 08ce270e06
commit 6d5549fc8e
15 changed files with 335 additions and 68 deletions

View File

@@ -194,23 +194,8 @@ void debug() {
initLiteralDictionary(&dictionary);
for (int i = 0; i < 100; i++) {
setLiteralDictionary(&dictionary, TO_INTEGER_LITERAL(i), TO_INTEGER_LITERAL(i * 2));
}
for (int i = 0; i < 100; i++) {
printf("%d: ", i);
printLiteral( getLiteralDictionary(&dictionary, TO_INTEGER_LITERAL(i)) );
printf("\n");
}
printf("-------------");
for (int i = 0; i < dictionary.capacity; i++) {
printf("%d: ", i);
printLiteral(dictionary.entries[i].key);
printf("\n");
}
setLiteralDictionary(&dictionary, TO_IDENTIFIER_LITERAL("variable", MASK_INTEGER), TO_INTEGER_LITERAL(2));
printLiteral( getLiteralDictionary(&dictionary, TO_IDENTIFIER_LITERAL("variable", MASK_INTEGER)) );
freeLiteralDictionary(&dictionary);
}