handle_namespace.cpp 774 B

1234567891011121314151617181920212223
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. #include "toolchain/parse/context.h"
  5. namespace Carbon::Parse {
  6. auto HandleNamespace(Context& context) -> void {
  7. auto state = context.PopState();
  8. context.PushState(state, State::NamespaceFinish);
  9. context.PushState(State::DeclNameAndParamsAsNone, state.token);
  10. }
  11. auto HandleNamespaceFinish(Context& context) -> void {
  12. auto state = context.PopState();
  13. context.AddNodeExpectingDeclSemi(state, NodeKind::Namespace,
  14. Lex::TokenKind::Namespace,
  15. /*is_def_allowed=*/false);
  16. }
  17. } // namespace Carbon::Parse