Parser is reading variable declarations, read more

This is an incomplete process. It's supposed to be robust enough to
support the types of arrays and dictionaries, but arrays and
dictionaries aren't implemented in the literals yet, so that's my next
task.

I'll come back to variable declarations later.
This commit is contained in:
2022-08-10 11:01:32 +01:00
parent 9603baeb0a
commit 6a883bde96
9 changed files with 218 additions and 17 deletions

View File

@@ -71,8 +71,8 @@ Literal _toStringLiteral(char* str) {
return ((Literal){LITERAL_STRING, {.string.ptr = (char*)str, .string.length = strlen((char*)str)}});
}
Literal _toIdentifierLiteral(char* str, unsigned char types) {
return ((Literal){LITERAL_IDENTIFIER,{.identifier.ptr = (char*)str,.identifier.length = strlen((char*)str),.identifier.types = types}});
Literal _toIdentifierLiteral(char* str) {
return ((Literal){LITERAL_IDENTIFIER,{.identifier.ptr = (char*)str,.identifier.length = strlen((char*)str)}});
}
char* copyString(char* original, int length) {
@@ -121,7 +121,7 @@ bool literalsAreEqual(Literal lhs, Literal rhs) {
default:
//should never bee seen
fprintf(stderr, "[Internal] Unrecognized literal type: %d\n", lhs.type);
fprintf(stderr, "[internal] Unrecognized literal type: %d\n", lhs.type);
return false;
}
}