mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 15:51:07 +01:00
Sync the keyword list (#1097)
I was mainly looking at keywords trying to figure out what needs work and the amount to which it doesn't reflect the design confused me (including some things that we've decided not to include, and some things I'm not aware of discussion about). I figured this cleanup would at least make it somewhat clearer why things are in there. I'm treating https://github.com/carbon-language/carbon-lang/blob/trunk/docs/design/lexical_conventions/words.md as canonical, with `_` and `xor` as presumably deliberate exceptions. Similarly avoiding symbol tokens because I assume you'll push proposals for the difference. I dropped the `Keyword` qualifier because `is` makes `IsKeyword` a name conflict, and dropping the qualifier seemed like the more consistent solution (it doesn't do `AmpSymbol`, after all). If we need clarity I might lean towards a separate namespace to avoid naming conflicts.
This commit is contained in:
@@ -199,7 +199,7 @@ auto PrecedenceGroup::ForLeading(TokenKind kind)
|
||||
case TokenKind::Star():
|
||||
return PrecedenceGroup(TermPrefix);
|
||||
|
||||
case TokenKind::NotKeyword():
|
||||
case TokenKind::Not():
|
||||
return PrecedenceGroup(LogicalPrefix);
|
||||
|
||||
case TokenKind::Minus():
|
||||
@@ -233,9 +233,9 @@ auto PrecedenceGroup::ForTrailing(TokenKind kind, bool infix)
|
||||
return Trailing{.level = CompoundAssignment, .is_binary = true};
|
||||
|
||||
// Logical operators.
|
||||
case TokenKind::AndKeyword():
|
||||
case TokenKind::And():
|
||||
return Trailing{.level = LogicalAnd, .is_binary = true};
|
||||
case TokenKind::OrKeyword():
|
||||
case TokenKind::Or():
|
||||
return Trailing{.level = LogicalOr, .is_binary = true};
|
||||
|
||||
// Bitwise operators.
|
||||
@@ -243,7 +243,7 @@ auto PrecedenceGroup::ForTrailing(TokenKind kind, bool infix)
|
||||
return Trailing{.level = BitwiseAnd, .is_binary = true};
|
||||
case TokenKind::Pipe():
|
||||
return Trailing{.level = BitwiseOr, .is_binary = true};
|
||||
case TokenKind::XorKeyword():
|
||||
case TokenKind::Xor():
|
||||
return Trailing{.level = BitwiseXor, .is_binary = true};
|
||||
case TokenKind::GreaterGreater():
|
||||
case TokenKind::LessLess():
|
||||
@@ -282,7 +282,7 @@ auto PrecedenceGroup::ForTrailing(TokenKind kind, bool infix)
|
||||
|
||||
// Prefix-only operators.
|
||||
case TokenKind::Tilde():
|
||||
case TokenKind::NotKeyword():
|
||||
case TokenKind::Not():
|
||||
break;
|
||||
|
||||
// Symbolic tokens that might be operators eventually.
|
||||
|
||||
Reference in New Issue
Block a user