forked from solstice/solstice
Type parser
This commit is contained in:
@@ -6,6 +6,21 @@
|
||||
#include <groundvm.h>
|
||||
|
||||
SolsTokenPrecedence getPrecedence(SolsToken *token) {
|
||||
static size_t braceCount = 0;
|
||||
switch (token->type) {
|
||||
case STT_OPEN_CURLY: {
|
||||
braceCount++;
|
||||
return STP_OTHER;
|
||||
}
|
||||
case STT_CLOSE_CURLY: {
|
||||
braceCount--;
|
||||
return STP_OTHER;
|
||||
}
|
||||
default: break;
|
||||
}
|
||||
if (braceCount > 0) {
|
||||
return STP_OTHER;
|
||||
}
|
||||
switch (token->type) {
|
||||
case STT_LINE_END: return STP_NEWLINE;
|
||||
case STT_KW_PUTS: return STP_PUTS;
|
||||
@@ -1399,9 +1414,7 @@ static inline ResultType(Nothing, charptr) parseDef(SolsParser* parser) {
|
||||
SolsNode codeBlock = parser->currentParent->children.at[parser->currentParent->children.count - 1];
|
||||
parser->currentParent->children.count--;
|
||||
|
||||
// We need to get the actual node from the parent to modify it
|
||||
SolsNode* defNode = &parser->currentParent->children.at[parser->currentParent->children.count - 1];
|
||||
addChildToSolsNode(defNode, codeBlock);
|
||||
addChildToSolsNode(&parser->currentParent->children.at[0], parser->currentParent->children.at[1]);
|
||||
|
||||
return Success(Nothing, charptr, {});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user