handle_pattern.cpp 578 B

12345678910111213141516171819
  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. #include "toolchain/parse/handle.h"
  6. namespace Carbon::Parse {
  7. auto HandlePattern(Context& context) -> void {
  8. context.PopAndDiscardState();
  9. if (context.PositionKind() == Lex::TokenKind::OpenParen) {
  10. context.PushState(State::PatternListAsTuple);
  11. } else {
  12. context.PushState(State::BindingPattern);
  13. }
  14. }
  15. } // namespace Carbon::Parse