mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Parse ref as operator (#6539)
This is the first step of implementing the guidance in #6342. --------- Co-authored-by: josh11b <15258583+josh11b@users.noreply.github.com>
This commit is contained in:
@@ -30,7 +30,8 @@ struct PrecedenceGroup::OperatorPriorityTable {
|
||||
{Additive, Modulo, BitwiseAnd, BitwiseOr, BitwiseXor, BitShift},
|
||||
{Relational, Where});
|
||||
MarkHigherThan({Relational, LogicalPrefix}, {LogicalAnd, LogicalOr});
|
||||
MarkHigherThan({As, LogicalAnd, LogicalOr, Where}, {If});
|
||||
MarkHigherThan({As, LogicalAnd, LogicalOr, Where}, {Ref});
|
||||
MarkHigherThan({Ref}, {If});
|
||||
MarkHigherThan({If}, {Assignment});
|
||||
MarkHigherThan({Assignment, IncrementDecrement}, {Lowest});
|
||||
|
||||
@@ -166,6 +167,9 @@ auto PrecedenceGroup::ForLeading(Lex::TokenKind kind)
|
||||
case Lex::TokenKind::If:
|
||||
return PrecedenceGroup(If);
|
||||
|
||||
case Lex::TokenKind::Ref:
|
||||
return PrecedenceGroup(Ref);
|
||||
|
||||
case Lex::TokenKind::Const:
|
||||
case Lex::TokenKind::Partial:
|
||||
return PrecedenceGroup(TypePrefix);
|
||||
|
||||
Reference in New Issue
Block a user