mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
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:
@@ -145,6 +145,7 @@ class ParseTree {
|
||||
private:
|
||||
class Parser;
|
||||
friend Parser;
|
||||
friend class Parser2;
|
||||
|
||||
// The in-memory representation of data used for a particular node in the
|
||||
// tree.
|
||||
@@ -153,6 +154,15 @@ class ParseTree {
|
||||
int subtree_size_arg)
|
||||
: kind(k), token(t), subtree_size(subtree_size_arg) {}
|
||||
|
||||
// TODO: Parser2 only uses this construct. Can remove the other if we
|
||||
// switch.
|
||||
NodeImpl(ParseNodeKind kind, bool has_error, TokenizedBuffer::Token token,
|
||||
int subtree_size)
|
||||
: kind(kind),
|
||||
has_error(has_error),
|
||||
token(token),
|
||||
subtree_size(subtree_size) {}
|
||||
|
||||
// The kind of this node. Note that this is only a single byte.
|
||||
ParseNodeKind kind;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user