mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-24 22:02:23 +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:
@@ -8,6 +8,7 @@
|
||||
#include "toolchain/parse/context.h"
|
||||
#include "toolchain/parse/handle.h"
|
||||
#include "toolchain/parse/node_kind.h"
|
||||
#include "toolchain/parse/state.h"
|
||||
|
||||
namespace Carbon::Parse {
|
||||
|
||||
@@ -130,6 +131,8 @@ static constexpr auto DeclIntroducers = [] {
|
||||
StateKind::TypeAfterIntroducerAsInterface);
|
||||
set(Lex::TokenKind::Namespace, NodeKind::NamespaceStart,
|
||||
StateKind::Namespace);
|
||||
set(Lex::TokenKind::Observe, NodeKind::ObserveIntroducer,
|
||||
StateKind::ObserveAfterIntroducer);
|
||||
set(Lex::TokenKind::Require, NodeKind::RequireIntroducer,
|
||||
StateKind::RequireAfterIntroducer);
|
||||
set_contextual(Lex::TokenKind::Let, RegularContext, NodeKind::LetIntroducer,
|
||||
|
||||
Reference in New Issue
Block a user