Added "dollar operator" to get the current offset

This commit is contained in:
WerWolv
2021-01-20 22:56:31 +01:00
parent 31426a289c
commit f0ab13ebc3
3 changed files with 8 additions and 1 deletions

View File

@@ -362,6 +362,9 @@ namespace hex::lang {
} else if (c == '?') {
tokens.emplace_back(TOKEN(Operator, TernaryConditional));
offset += 1;
} else if (c == '$') {
tokens.emplace_back(TOKEN(Operator, Dollar));
offset += 1;
} else if (c == '\'') {
auto character = getCharacterLiteral(code.substr(offset));

View File

@@ -97,6 +97,8 @@ namespace hex::lang {
} else if (MATCHES(sequence(IDENTIFIER))) {
std::vector<std::string> path;
return this->parseRValue(path);
} else if (MATCHES(sequence(OPERATOR_DOLLAR))) {
return new ASTNodeRValue({ "$" });
} else
throwParseError("expected integer or parenthesis");
}