handle_pattern.cpp 677 B

1234567891011121314151617181920
  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. auto state = context.PopState();
  9. if (context.PositionKind() == Lex::TokenKind::OpenParen) {
  10. context.PushStateForPattern(State::PatternListAsTuple,
  11. state.in_var_pattern);
  12. } else {
  13. context.PushStateForPattern(State::BindingPattern, state.in_var_pattern);
  14. }
  15. }
  16. } // namespace Carbon::Parse