Checkpoint for a parser rewrite (#2364)

The intent of this approach is to eliminate recursion limits as a barrier for the parser. While it may not be urgent to address, I want to avoid pouring effort into a parser approach that we don't think will be usable long-term.

Right now this is passing a minor set of tests. It's intended to be enough to show how I'm thinking about flow control for the parser. I'm manually switching back and forth because it seemed like the easiest approach that avoids duplicating tests.
This commit is contained in:
Jon Ross-Perkins
2022-11-02 14:43:40 -07:00
committed by GitHub
parent b6094c6a98
commit 9107916b11
9 changed files with 550 additions and 1 deletions
+19
View File
@@ -0,0 +1,19 @@
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#include "toolchain/parser/parser_state.h"
#include "llvm/ADT/StringRef.h"
namespace Carbon {
auto ParserState::name() const -> llvm::StringRef {
static constexpr llvm::StringLiteral Names[] = {
#define CARBON_PARSER_STATE(Name) #Name,
#include "toolchain/parser/parser_state.def"
};
return Names[static_cast<int>(state_)];
}
} // namespace Carbon