// 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 // Handles processing at the `}` on a typical code block, after a statement // scope is done. CARBON_PARSER_STATE(CodeBlockFinish) // Handles processing of a declaration scope. Things like fn, class, interface, // and so on. CARBON_PARSER_STATE(Declaration) // Handles processing of an expression. CARBON_PARSER_STATE(Expression) // As with Expression, but specifically uses the Type precedence grouping. CARBON_PARSER_STATE(ExpressionForType) // Handles the `;` for an expression statement, which is different from most // keyword statements. CARBON_PARSER_STATE(ExpressionStatementFinish) // Handles processing of a function's `fn (`, and enqueues parameter list // handling. CARBON_PARSER_STATE(FunctionIntroducer) // Handles processing of a function's parameter list `)`. CARBON_PARSER_STATE(FunctionParameterListFinish) // Handles processing of a function's syntax after `)`, primarily the // possibility a `->` return type is there. Always enqueues signature finish // handling. CARBON_PARSER_STATE(FunctionAfterParameterList) // Finishes a function return type. CARBON_PARSER_STATE(FunctionReturnTypeFinish) // Finishes a function signature. If it's a declaration, the function is done; // otherwise, this also starts definition processing. CARBON_PARSER_STATE(FunctionSignatureFinish) // Finishes a function definition. CARBON_PARSER_STATE(FunctionDefinitionFinish) // StatementFinish variants are just handling the `;` expectation. CARBON_PARSER_STATE(KeywordStatementFinishForReturn) // Handles the processing of a `(condition)` up through the expression. CARBON_PARSER_STATE(ParenCondition) // Finishes the processing of a `(condition)` after the expression. CARBON_PARSER_STATE(ParenConditionFinish) // Handles `if` processing between the condition and start of the first code // block. CARBON_PARSER_STATE(StatementIfConditionFinish) // Handles `if` processing after the end of the first code block, with the // optional `else`. CARBON_PARSER_STATE(StatementIfThenBlockFinish) // Handles `if` processing after a provided `else` code block. CARBON_PARSER_STATE(StatementIfElseBlockFinish) // Handles pattern parsing for a function parameter, enqueuing type expression // processing. Proceeds to the matching Finish state when done. CARBON_PARSER_STATE(PatternForFunctionParameter) // Finishes function parameter processing, including `,`. If there are more // parameters, enqueues another parameter processing state. CARBON_PARSER_STATE(PatternForFunctionParameterFinish) // Handles processing of statements within a scope. CARBON_PARSER_STATE(StatementScope) #undef CARBON_PARSER_STATE