handle_pattern.cpp 542 B

123456789101112131415161718
  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 HandlePattern(Context& context) -> void {
  7. context.PopAndDiscardState();
  8. if (context.PositionKind() == Lex::TokenKind::OpenParen) {
  9. context.PushState(State::PatternListAsTuple);
  10. } else {
  11. context.PushState(State::BindingPattern);
  12. }
  13. }
  14. } // namespace Carbon::Parse