Adds support for parenthesized expressions

This commit is contained in:
2019-05-21 17:16:53 +02:00
parent ae25598864
commit aec07bd29a
7 changed files with 186 additions and 127 deletions

View File

@@ -16,6 +16,7 @@ enum class ParsedExpressionKind{
Unary,
Binary,
Parenthesized,
};
class ParsedExpression {
@@ -96,6 +97,23 @@ public:
}
};
class ParenthesizedExpression : public ParsedExpression{
ParsedExpression* _expression;
public:
ParsedExpressionKind GetKind() final{
return ParsedExpressionKind::Parenthesized;
}
explicit ParenthesizedExpression(ParsedExpression* innerExpression, unsigned int start, unsigned int length)
: ParsedExpression(start, length){
_expression = innerExpression;
}
ParsedExpression* GetInnerExpression(){
return _expression;
}
};
class UnaryExpression : public ParsedExpression{
UnaryOperatorKind _kind;
ParsedExpression* _operand;