parser_state.cpp 552 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/parser/parser_state.h"
  5. #include "llvm/ADT/StringRef.h"
  6. namespace Carbon {
  7. auto ParserState::name() const -> llvm::StringRef {
  8. static constexpr llvm::StringLiteral Names[] = {
  9. #define CARBON_PARSER_STATE(Name) #Name,
  10. #include "toolchain/parser/parser_state.def"
  11. };
  12. return Names[static_cast<int>(state_)];
  13. }
  14. } // namespace Carbon