mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-24 22:02:23 +01:00
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.
22 lines
830 B
Modula-2
22 lines
830 B
Modula-2
// 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
|
|
//
|
|
// Note that this is an X-macro header.
|
|
//
|
|
// It does not use `#include` guards, and instead is designed to be `#include`ed
|
|
// after the x-macro is defined in order for its inclusion to expand to the
|
|
// desired output. The x-macro for this header is `CARBON_PARSE_NODE_KIND`. The
|
|
// definition provided will be removed at the end of this file to clean up.
|
|
|
|
#ifndef CARBON_PARSER_STATE
|
|
#error "Must define the x-macro to use this file."
|
|
#endif
|
|
|
|
CARBON_PARSER_STATE(Declaration)
|
|
CARBON_PARSER_STATE(FunctionIntroducer)
|
|
CARBON_PARSER_STATE(FunctionParameterList)
|
|
CARBON_PARSER_STATE(FunctionParameterListDone)
|
|
|
|
#undef CARBON_PARSER_STATE
|