Added "dollar operator" to get the current offset
This commit is contained in:
parent
31426a289c
commit
f0ab13ebc3
@ -59,7 +59,8 @@ namespace hex::lang {
|
||||
BoolOr,
|
||||
BoolXor,
|
||||
BoolNot,
|
||||
TernaryConditional
|
||||
TernaryConditional,
|
||||
Dollar
|
||||
};
|
||||
|
||||
enum class ValueType {
|
||||
@ -225,6 +226,7 @@ namespace hex::lang {
|
||||
#define OPERATOR_BOOLXOR COMPONENT(Operator, BoolXor)
|
||||
#define OPERATOR_BOOLNOT COMPONENT(Operator, BoolNot)
|
||||
#define OPERATOR_TERNARYCONDITIONAL COMPONENT(Operator, TernaryConditional)
|
||||
#define OPERATOR_DOLLAR COMPONENT(Operator, Dollar)
|
||||
|
||||
#define VALUETYPE_CUSTOMTYPE COMPONENT(ValueType, CustomType)
|
||||
#define VALUETYPE_PADDING COMPONENT(ValueType, Padding)
|
||||
|
@ -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));
|
||||
|
||||
|
@ -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");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user