mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 09:11:05 +01:00
Implement parsing observe declarations (#6674)
This implements parsing of the [`observe`](https://docs.carbon-lang.dev/docs/design/generics/details.html#observing-a-type-implements-an-interface) declarations. - Added states and node kinds. - Added node categories. - Added a diagnostic for invalid keywords/operators. - Implemented parser state handlers. - Added structs to `typed_nodes.h`. - Added parser tests.
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
|
||||
#include <optional>
|
||||
|
||||
#include "toolchain/lex/token_kind.h"
|
||||
#include "toolchain/parse/context.h"
|
||||
#include "toolchain/parse/handle.h"
|
||||
|
||||
@@ -64,6 +65,7 @@ auto HandleStatement(Context& context) -> void {
|
||||
case Lex::TokenKind::Let:
|
||||
case Lex::TokenKind::Library:
|
||||
case Lex::TokenKind::Namespace:
|
||||
case Lex::TokenKind::Observe:
|
||||
// We intentionally don't handle Package here, because `package.` can be
|
||||
// used at the start of an expression, and it's not worth disambiguating it.
|
||||
case Lex::TokenKind::Var: {
|
||||
|
||||
Reference in New Issue
Block a user