This commit is contained in:
parent
5fb64e12e1
commit
bfb47d9b5f
@ -21,20 +21,20 @@ namespace MalachScript {
|
|||||||
};
|
};
|
||||||
|
|
||||||
enum class LogicOperator : uint8_t {
|
enum class LogicOperator : uint8_t {
|
||||||
LogicalAnd, // &&, and
|
LogicalAnd, // &&, and
|
||||||
LogicalOr, // ||, or
|
LogicalOr, // ||, or
|
||||||
LogicalXor, // ^^, xor
|
LogicalXor, // ^^, xor
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class ComparisonOperator : uint8_t {
|
enum class ComparisonOperator : uint8_t {
|
||||||
Equality, // ==
|
Equality, // ==
|
||||||
Inequality, // !=
|
Inequality, // !=
|
||||||
LessThan, // <
|
LessThan, // <
|
||||||
LessThanEquals, // <=
|
LessThanEquals, // <=
|
||||||
GreaterThan, // >
|
GreaterThan, // >
|
||||||
GreaterThanEquals, // >=
|
GreaterThanEquals, // >=
|
||||||
Identity, // is
|
Identity, // is
|
||||||
InverseIdentity, // !is
|
InverseIdentity, // !is
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class MathOperator : uint8_t {
|
enum class MathOperator : uint8_t {
|
||||||
@ -55,15 +55,7 @@ namespace MalachScript {
|
|||||||
ArithmeticRightShift,
|
ArithmeticRightShift,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class PreOperator : uint8_t {
|
enum class PreOperator : uint8_t { Negation, Identity, Inversion, Increment, Decrement, BitwiseComplement, Handle };
|
||||||
Negation,
|
|
||||||
Identity,
|
|
||||||
Inversion,
|
|
||||||
Increment,
|
|
||||||
Decrement,
|
|
||||||
BitwiseComplement,
|
|
||||||
Handle
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // MALACHSCRIPT_OPERATORS_HPP
|
#endif // MALACHSCRIPT_OPERATORS_HPP
|
||||||
|
@ -867,7 +867,7 @@ namespace MalachScript::Parser {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
bool Parser::ParseExprStat(const ParsedStatement*& out, const LexToken*& currentToken) {
|
bool Parser::ParseExprStat(const ParsedStatement*& out, const LexToken*& currentToken) {
|
||||||
if (!ParseAssign(out, currentToken)){
|
if (!ParseAssign(out, currentToken)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
EXPECT_TOKEN(currentToken, SemicolonSymbol);
|
EXPECT_TOKEN(currentToken, SemicolonSymbol);
|
||||||
|
@ -319,11 +319,12 @@ namespace MalachScript::Parser {
|
|||||||
: ParsedStatementImpl(span), _literalValue(literalValue) {}
|
: ParsedStatementImpl(span), _literalValue(literalValue) {}
|
||||||
|
|
||||||
[[nodiscard]] inline const T& GetLiteralValue() const noexcept { return _literalValue; }
|
[[nodiscard]] inline const T& GetLiteralValue() const noexcept { return _literalValue; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
T _literalValue;
|
T _literalValue;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ParsedReturnStatement : public ParsedStatementImpl<ParsedStatementKind::Return>{
|
class ParsedReturnStatement : public ParsedStatementImpl<ParsedStatementKind::Return> {
|
||||||
public:
|
public:
|
||||||
ParsedReturnStatement(const TextSpan& span, const ParsedStatement* statement)
|
ParsedReturnStatement(const TextSpan& span, const ParsedStatement* statement)
|
||||||
: ParsedStatementImpl(span), _statement(statement) {}
|
: ParsedStatementImpl(span), _statement(statement) {}
|
||||||
@ -332,16 +333,16 @@ namespace MalachScript::Parser {
|
|||||||
std::unique_ptr<const ParsedStatement> _statement;
|
std::unique_ptr<const ParsedStatement> _statement;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ParsedVarAccessStatement : public ParsedStatementImpl<ParsedStatementKind::VarAccess>{
|
class ParsedVarAccessStatement : public ParsedStatementImpl<ParsedStatementKind::VarAccess> {
|
||||||
public:
|
public:
|
||||||
ParsedVarAccessStatement(const TextSpan& span, std::vector<Identifier> scope)
|
ParsedVarAccessStatement(const TextSpan& span, std::vector<Identifier> scope)
|
||||||
: ParsedStatementImpl(span), _scope(std::move(scope)) {}
|
: ParsedStatementImpl(span), _scope(std::move(scope)) {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<Identifier> _scope;
|
std::vector<Identifier> _scope;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ParsedIncrementStatement : public ParsedStatementImpl<ParsedStatementKind::Increment>{
|
class ParsedIncrementStatement : public ParsedStatementImpl<ParsedStatementKind::Increment> {
|
||||||
public:
|
public:
|
||||||
ParsedIncrementStatement(const TextSpan& span, const ParsedStatement* statement)
|
ParsedIncrementStatement(const TextSpan& span, const ParsedStatement* statement)
|
||||||
: ParsedStatementImpl(span), _statement(statement) {}
|
: ParsedStatementImpl(span), _statement(statement) {}
|
||||||
@ -350,7 +351,7 @@ namespace MalachScript::Parser {
|
|||||||
std::unique_ptr<const ParsedStatement> _statement;
|
std::unique_ptr<const ParsedStatement> _statement;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ParsedDecrementStatement : public ParsedStatementImpl<ParsedStatementKind::Decrement>{
|
class ParsedDecrementStatement : public ParsedStatementImpl<ParsedStatementKind::Decrement> {
|
||||||
public:
|
public:
|
||||||
ParsedDecrementStatement(const TextSpan& span, const ParsedStatement* statement)
|
ParsedDecrementStatement(const TextSpan& span, const ParsedStatement* statement)
|
||||||
: ParsedStatementImpl(span), _statement(statement) {}
|
: ParsedStatementImpl(span), _statement(statement) {}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user