SolsNode stores line info
This commit is contained in:
@@ -138,6 +138,7 @@ static inline ResultType(Nothing, charptr) parseIdentifier(SolsParser* parser) {
|
||||
APPEND_ESTR(err, " (in parseLiteral() function)");
|
||||
return Error(Nothing, charptr, err.str);
|
||||
}
|
||||
node.as.success.line = peek.as.success.line;
|
||||
addChildToSolsNode(parser->currentParent, node.as.success);
|
||||
return Success(Nothing, charptr, {});
|
||||
}
|
||||
@@ -153,6 +154,7 @@ static inline ResultType(Nothing, charptr) parseLiteral(SolsParser* parser) {
|
||||
APPEND_ESTR(err, " (in parseLiteral() function)");
|
||||
return Error(Nothing, charptr, err.str);
|
||||
}
|
||||
node.as.success.line = peek.as.success.line;
|
||||
addChildToSolsNode(parser->currentParent, node.as.success);
|
||||
return Success(Nothing, charptr, {});
|
||||
}
|
||||
@@ -165,6 +167,9 @@ static inline ResultType(Nothing, charptr) parsePuts(SolsParser* parser) {
|
||||
return Error(Nothing, charptr, tokens.as.error);
|
||||
}
|
||||
|
||||
ResultType(SolsToken, Nothing) peek = parserPeek(parser, 0);
|
||||
if (peek.error) return Error(Nothing, charptr, "ruh roh");
|
||||
|
||||
for (;;) {
|
||||
ResultType(SolsToken, Nothing) peek = parserPeek(parser, 1);
|
||||
if (peek.error) break;
|
||||
@@ -178,6 +183,7 @@ static inline ResultType(Nothing, charptr) parsePuts(SolsParser* parser) {
|
||||
// Create node
|
||||
ResultType(SolsNode, charptr) node = createSolsNode(SNT_PUTS);
|
||||
if (node.error) return Error(Nothing, charptr, node.as.error);
|
||||
node.as.success.line = peek.as.success.line;
|
||||
|
||||
// Parse selected tokens
|
||||
ResultType(SolsParser, charptr) putsParser = createSolsParser(&tokens.as.success);
|
||||
|
||||
Reference in New Issue
Block a user