SolsNode stores line info

This commit is contained in:
2026-02-24 19:33:41 +11:00
parent d4017b7c18
commit 2266990cb4
3 changed files with 21 additions and 4 deletions

View File

@@ -15,6 +15,14 @@ typedef enum SolsTokenType {
typedef char* charptr;
// Stores information about the line that the token/node is on, for printing if an error
// occurs.
// .num is the line number, .content is the line's contents.
typedef struct LineInfo {
size_t num;
char* content;
} LineInfo;
// Represents a token lexed by the lex() function.
// Most token types exclusively use the .type field, however some tokens require storing
// more data, inside the .as union.
@@ -31,10 +39,7 @@ typedef struct SolsToken {
char* idName;
char* inlineGround;
} as;
struct {
size_t num;
char* content;
} line;
LineInfo line;
} SolsToken;
Result(SolsToken, charptr);