mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 09:11:05 +01:00
The presence or absence of whitespace is used to determine which operator is in use, following the rules described in #520. Support for prefix * dereference operator follows #523. Co-authored-by: Geoff Romer <gromer@google.com>
This commit is contained in:
committed by
GitHub
co-authored by
Geoff Romer
parent
d6b47ba10f
commit
89e21113c3
@@ -245,15 +245,18 @@ auto Expression::MakeIndex(int line_num, const Expression* exp,
|
||||
|
||||
static void PrintOp(Operator op) {
|
||||
switch (op) {
|
||||
case Operator::Neg:
|
||||
std::cout << "-";
|
||||
break;
|
||||
case Operator::Add:
|
||||
std::cout << "+";
|
||||
break;
|
||||
case Operator::Neg:
|
||||
case Operator::Sub:
|
||||
std::cout << "-";
|
||||
break;
|
||||
case Operator::Mul:
|
||||
case Operator::Deref:
|
||||
case Operator::Ptr:
|
||||
std::cout << "*";
|
||||
break;
|
||||
case Operator::Not:
|
||||
std::cout << "not";
|
||||
break;
|
||||
|
||||
@@ -42,11 +42,14 @@ enum class ExpressionKind {
|
||||
enum class Operator {
|
||||
Add,
|
||||
And,
|
||||
Deref,
|
||||
Eq,
|
||||
Mul,
|
||||
Neg,
|
||||
Not,
|
||||
Or,
|
||||
Sub,
|
||||
Ptr,
|
||||
};
|
||||
|
||||
struct Expression;
|
||||
|
||||
Reference in New Issue
Block a user