mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-24 22:02:23 +01:00
This supports both struct type literals, `{.x: i32, .y: i32}`, and struct
value literals, `{.x = 3, .y = 4}`. The degenerate case of `{}` is
treated as a struct value literal, with the expectation that an empty
struct value has the same type/value duality as an empty tuple value.
71 lines
2.5 KiB
Modula-2
71 lines
2.5 KiB
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_PARSE_NODE_KIND
|
|
#error "Must define the x-macro to use this file."
|
|
#endif
|
|
|
|
// Declarations.
|
|
CARBON_PARSE_NODE_KIND(DeclarationEnd)
|
|
CARBON_PARSE_NODE_KIND(EmptyDeclaration)
|
|
CARBON_PARSE_NODE_KIND(DeclaredName)
|
|
CARBON_PARSE_NODE_KIND(FunctionDeclaration)
|
|
CARBON_PARSE_NODE_KIND(ParameterList)
|
|
CARBON_PARSE_NODE_KIND(ParameterListComma)
|
|
CARBON_PARSE_NODE_KIND(ParameterListEnd)
|
|
CARBON_PARSE_NODE_KIND(PatternBinding)
|
|
CARBON_PARSE_NODE_KIND(ReturnType)
|
|
CARBON_PARSE_NODE_KIND(VariableDeclaration)
|
|
CARBON_PARSE_NODE_KIND(VariableInitializer)
|
|
CARBON_PARSE_NODE_KIND(FileEnd)
|
|
|
|
// Statements.
|
|
CARBON_PARSE_NODE_KIND(CodeBlockEnd)
|
|
CARBON_PARSE_NODE_KIND(CodeBlock)
|
|
CARBON_PARSE_NODE_KIND(ExpressionStatement)
|
|
CARBON_PARSE_NODE_KIND(IfStatement)
|
|
CARBON_PARSE_NODE_KIND(IfStatementElse)
|
|
CARBON_PARSE_NODE_KIND(WhileStatement)
|
|
CARBON_PARSE_NODE_KIND(Condition)
|
|
CARBON_PARSE_NODE_KIND(ConditionEnd)
|
|
CARBON_PARSE_NODE_KIND(ContinueStatement)
|
|
CARBON_PARSE_NODE_KIND(BreakStatement)
|
|
CARBON_PARSE_NODE_KIND(ReturnStatement)
|
|
CARBON_PARSE_NODE_KIND(StatementEnd)
|
|
|
|
// Expressions.
|
|
CARBON_PARSE_NODE_KIND(Literal)
|
|
CARBON_PARSE_NODE_KIND(TupleLiteral)
|
|
CARBON_PARSE_NODE_KIND(TupleLiteralComma)
|
|
CARBON_PARSE_NODE_KIND(TupleLiteralEnd)
|
|
CARBON_PARSE_NODE_KIND(NameReference)
|
|
CARBON_PARSE_NODE_KIND(ParenExpression)
|
|
CARBON_PARSE_NODE_KIND(ParenExpressionEnd)
|
|
CARBON_PARSE_NODE_KIND(DesignatorExpression)
|
|
CARBON_PARSE_NODE_KIND(DesignatedName)
|
|
CARBON_PARSE_NODE_KIND(CallExpression)
|
|
CARBON_PARSE_NODE_KIND(CallExpressionComma)
|
|
CARBON_PARSE_NODE_KIND(CallExpressionEnd)
|
|
CARBON_PARSE_NODE_KIND(PrefixOperator)
|
|
CARBON_PARSE_NODE_KIND(InfixOperator)
|
|
CARBON_PARSE_NODE_KIND(PostfixOperator)
|
|
|
|
// Struct literals.
|
|
CARBON_PARSE_NODE_KIND(StructLiteral)
|
|
CARBON_PARSE_NODE_KIND(StructTypeLiteral)
|
|
CARBON_PARSE_NODE_KIND(StructFieldDesignator)
|
|
CARBON_PARSE_NODE_KIND(StructFieldValue)
|
|
CARBON_PARSE_NODE_KIND(StructFieldType)
|
|
CARBON_PARSE_NODE_KIND(StructComma)
|
|
CARBON_PARSE_NODE_KIND(StructEnd)
|
|
|
|
#undef CARBON_PARSE_NODE_KIND
|