SolsNode stores line info
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user