//! > Test a syntax tree with literals
//! > test_runner_name
test_partial_parser_tree(expect_diagnostics: false)
//! > cairo_code
#[derive(Copy, Drop)]
enum bool {
False: (),
True: (),
}
#[empty_attr()]
mod empty {}
#[derive(Copy, Drop, PartialEq, Serde)]
struct u256 {
low: u128,
}
#[post('/', data: '<todo_form>')]
fn string_value() {}
#[cfg(attr(value: C))]
fn const_value() {}
#[cfg_attr(test, assert_instr(instr: add_a.b))]
fn custom_name() {}
#[attr(foo::bar, qwe)]
fn arbitrary_token_tree() {}
//! > top_level_kind
ModuleItemList
//! > ignored_kinds
ExprBlock
FunctionDeclaration
MemberList
VariantList
//! > expected_diagnostics
//! > expected_tree
└── Top level kind: ModuleItemList
├── child #0 (kind: ItemEnum)
│ ├── attributes (kind: AttributeList)
│ │ └── child #0 (kind: Attribute)
│ │ ├── hash (kind: TokenHash): '#'
│ │ ├── lbrack (kind: TokenLBrack): '['
│ │ ├── attr (kind: ExprPath)
│ │ │ ├── dollar (kind: OptionTerminalDollarEmpty) []
│ │ │ └── segments (kind: ExprPathInner)
│ │ │ └── item #0 (kind: PathSegmentSimple)
│ │ │ └── ident (kind: TokenIdentifier): 'derive'
│ │ ├── arguments (kind: ArgListParenthesized)
│ │ │ ├── lparen (kind: TokenLParen): '('
│ │ │ ├── arguments (kind: ArgList)
│ │ │ │ ├── item #0 (kind: Arg)
│ │ │ │ │ ├── modifiers (kind: ModifierList) []
│ │ │ │ │ └── arg_clause (kind: ArgClauseUnnamed)
│ │ │ │ │ └── value (kind: ExprPath)
│ │ │ │ │ ├── dollar (kind: OptionTerminalDollarEmpty) []
│ │ │ │ │ └── segments (kind: ExprPathInner)
│ │ │ │ │ └── item #0 (kind: PathSegmentSimple)
│ │ │ │ │ └── ident (kind: TokenIdentifier): 'Copy'
│ │ │ │ ├── separator #0 (kind: TokenComma): ','
│ │ │ │ └── item #1 (kind: Arg)
│ │ │ │ ├── modifiers (kind: ModifierList) []
│ │ │ │ └── arg_clause (kind: ArgClauseUnnamed)
│ │ │ │ └── value (kind: ExprPath)
│ │ │ │ ├── dollar (kind: OptionTerminalDollarEmpty) []
│ │ │ │ └── segments (kind: ExprPathInner)
│ │ │ │ └── item #0 (kind: PathSegmentSimple)
│ │ │ │ └── ident (kind: TokenIdentifier): 'Drop'
│ │ │ └── rparen (kind: TokenRParen): ')'
│ │ └── rbrack (kind: TokenRBrack): ']'
│ ├── visibility (kind: VisibilityDefault) []
│ ├── enum_kw (kind: TokenEnum): 'enum'
│ ├── name (kind: TokenIdentifier): 'bool'
│ ├── generic_params (kind: OptionWrappedGenericParamListEmpty) []
│ ├── lbrace (kind: TokenLBrace): '{'
│ ├── variants (kind: VariantList) <ignored>
│ └── rbrace (kind: TokenRBrace): '}'
├── child #1 (kind: ItemModule)
│ ├── attributes (kind: AttributeList)
│ │ └── child #0 (kind: Attribute)
│ │ ├── hash (kind: TokenHash): '#'
│ │ ├── lbrack (kind: TokenLBrack): '['
│ │ ├── attr (kind: ExprPath)
│ │ │ ├── dollar (kind: OptionTerminalDollarEmpty) []
│ │ │ └── segments (kind: ExprPathInner)
│ │ │ └── item #0 (kind: PathSegmentSimple)
│ │ │ └── ident (kind: TokenIdentifier): 'empty_attr'
│ │ ├── arguments (kind: ArgListParenthesized)
│ │ │ ├── lparen (kind: TokenLParen): '('
│ │ │ ├── arguments (kind: ArgList) []
│ │ │ └── rparen (kind: TokenRParen): ')'
│ │ └── rbrack (kind: TokenRBrack): ']'
│ ├── visibility (kind: VisibilityDefault) []
│ ├── module_kw (kind: TokenModule): 'mod'
│ ├── name (kind: TokenIdentifier): 'empty'
│ └── body (kind: ModuleBody)
│ ├── lbrace (kind: TokenLBrace): '{'
│ ├── items (kind: ModuleItemList) []
│ └── rbrace (kind: TokenRBrace): '}'
├── child #2 (kind: ItemStruct)
│ ├── attributes (kind: AttributeList)
│ │ └── child #0 (kind: Attribute)
│ │ ├── hash (kind: TokenHash): '#'
│ │ ├── lbrack (kind: TokenLBrack): '['
│ │ ├── attr (kind: ExprPath)
│ │ │ ├── dollar (kind: OptionTerminalDollarEmpty) []
│ │ │ └── segments (kind: ExprPathInner)
│ │ │ └── item #0 (kind: PathSegmentSimple)
│ │ │ └── ident (kind: TokenIdentifier): 'derive'
│ │ ├── arguments (kind: ArgListParenthesized)
│ │ │ ├── lparen (kind: TokenLParen): '('
│ │ │ ├── arguments (kind: ArgList)
│ │ │ │ ├── item #0 (kind: Arg)
│ │ │ │ │ ├── modifiers (kind: ModifierList) []
│ │ │ │ │ └── arg_clause (kind: ArgClauseUnnamed)
│ │ │ │ │ └── value (kind: ExprPath)
│ │ │ │ │ ├── dollar (kind: OptionTerminalDollarEmpty) []
│ │ │ │ │ └── segments (kind: ExprPathInner)
│ │ │ │ │ └── item #0 (kind: PathSegmentSimple)
│ │ │ │ │ └── ident (kind: TokenIdentifier): 'Copy'
│ │ │ │ ├── separator #0 (kind: TokenComma): ','
│ │ │ │ ├── item #1 (kind: Arg)
│ │ │ │ │ ├── modifiers (kind: ModifierList) []
│ │ │ │ │ └── arg_clause (kind: ArgClauseUnnamed)
│ │ │ │ │ └── value (kind: ExprPath)
│ │ │ │ │ ├── dollar (kind: OptionTerminalDollarEmpty) []
│ │ │ │ │ └── segments (kind: ExprPathInner)
│ │ │ │ │ └── item #0 (kind: PathSegmentSimple)
│ │ │ │ │ └── ident (kind: TokenIdentifier): 'Drop'
│ │ │ │ ├── separator #1 (kind: TokenComma): ','
│ │ │ │ ├── item #2 (kind: Arg)
│ │ │ │ │ ├── modifiers (kind: ModifierList) []
│ │ │ │ │ └── arg_clause (kind: ArgClauseUnnamed)
│ │ │ │ │ └── value (kind: ExprPath)
│ │ │ │ │ ├── dollar (kind: OptionTerminalDollarEmpty) []
│ │ │ │ │ └── segments (kind: ExprPathInner)
│ │ │ │ │ └── item #0 (kind: PathSegmentSimple)
│ │ │ │ │ └── ident (kind: TokenIdentifier): 'PartialEq'
│ │ │ │ ├── separator #2 (kind: TokenComma): ','
│ │ │ │ └── item #3 (kind: Arg)
│ │ │ │ ├── modifiers (kind: ModifierList) []
│ │ │ │ └── arg_clause (kind: ArgClauseUnnamed)
│ │ │ │ └── value (kind: ExprPath)
│ │ │ │ ├── dollar (kind: OptionTerminalDollarEmpty) []
│ │ │ │ └── segments (kind: ExprPathInner)
│ │ │ │ └── item #0 (kind: PathSegmentSimple)
│ │ │ │ └── ident (kind: TokenIdentifier): 'Serde'
│ │ │ └── rparen (kind: TokenRParen): ')'
│ │ └── rbrack (kind: TokenRBrack): ']'
│ ├── visibility (kind: VisibilityDefault) []
│ ├── struct_kw (kind: TokenStruct): 'struct'
│ ├── name (kind: TokenIdentifier): 'u256'
│ ├── generic_params (kind: OptionWrappedGenericParamListEmpty) []
│ ├── lbrace (kind: TokenLBrace): '{'
│ ├── members (kind: MemberList) <ignored>
│ └── rbrace (kind: TokenRBrace): '}'
├── child #3 (kind: FunctionWithBody)
│ ├── attributes (kind: AttributeList)
│ │ └── child #0 (kind: Attribute)
│ │ ├── hash (kind: TokenHash): '#'
│ │ ├── lbrack (kind: TokenLBrack): '['
│ │ ├── attr (kind: ExprPath)
│ │ │ ├── dollar (kind: OptionTerminalDollarEmpty) []
│ │ │ └── segments (kind: ExprPathInner)
│ │ │ └── item #0 (kind: PathSegmentSimple)
│ │ │ └── ident (kind: TokenIdentifier): 'post'
│ │ ├── arguments (kind: ArgListParenthesized)
│ │ │ ├── lparen (kind: TokenLParen): '('
│ │ │ ├── arguments (kind: ArgList)
│ │ │ │ ├── item #0 (kind: Arg)
│ │ │ │ │ ├── modifiers (kind: ModifierList) []
│ │ │ │ │ └── arg_clause (kind: ArgClauseUnnamed)
│ │ │ │ │ └── value (kind: TokenShortString): ''/''
│ │ │ │ ├── separator #0 (kind: TokenComma): ','
│ │ │ │ └── item #1 (kind: Arg)
│ │ │ │ ├── modifiers (kind: ModifierList) []
│ │ │ │ └── arg_clause (kind: ArgClauseNamed)
│ │ │ │ ├── name (kind: TokenIdentifier): 'data'
│ │ │ │ ├── colon (kind: TokenColon): ':'
│ │ │ │ └── value (kind: TokenShortString): ''<todo_form>''
│ │ │ └── rparen (kind: TokenRParen): ')'
│ │ └── rbrack (kind: TokenRBrack): ']'
│ ├── visibility (kind: VisibilityDefault) []
│ ├── declaration (kind: FunctionDeclaration) <ignored>
│ └── body (kind: ExprBlock) <ignored>
├── child #4 (kind: FunctionWithBody)
│ ├── attributes (kind: AttributeList)
│ │ └── child #0 (kind: Attribute)
│ │ ├── hash (kind: TokenHash): '#'
│ │ ├── lbrack (kind: TokenLBrack): '['
│ │ ├── attr (kind: ExprPath)
│ │ │ ├── dollar (kind: OptionTerminalDollarEmpty) []
│ │ │ └── segments (kind: ExprPathInner)
│ │ │ └── item #0 (kind: PathSegmentSimple)
│ │ │ └── ident (kind: TokenIdentifier): 'cfg'
│ │ ├── arguments (kind: ArgListParenthesized)
│ │ │ ├── lparen (kind: TokenLParen): '('
│ │ │ ├── arguments (kind: ArgList)
│ │ │ │ └── item #0 (kind: Arg)
│ │ │ │ ├── modifiers (kind: ModifierList) []
│ │ │ │ └── arg_clause (kind: ArgClauseUnnamed)
│ │ │ │ └── value (kind: ExprFunctionCall)
│ │ │ │ ├── path (kind: ExprPath)
│ │ │ │ │ ├── dollar (kind: OptionTerminalDollarEmpty) []
│ │ │ │ │ └── segments (kind: ExprPathInner)
│ │ │ │ │ └── item #0 (kind: PathSegmentSimple)
│ │ │ │ │ └── ident (kind: TokenIdentifier): 'attr'
│ │ │ │ └── arguments (kind: ArgListParenthesized)
│ │ │ │ ├── lparen (kind: TokenLParen): '('
│ │ │ │ ├── arguments (kind: ArgList)
│ │ │ │ │ └── item #0 (kind: Arg)
│ │ │ │ │ ├── modifiers (kind: ModifierList) []
│ │ │ │ │ └── arg_clause (kind: ArgClauseNamed)
│ │ │ │ │ ├── name (kind: TokenIdentifier): 'value'
│ │ │ │ │ ├── colon (kind: TokenColon): ':'
│ │ │ │ │ └── value (kind: ExprPath)
│ │ │ │ │ ├── dollar (kind: OptionTerminalDollarEmpty) []
│ │ │ │ │ └── segments (kind: ExprPathInner)
│ │ │ │ │ └── item #0 (kind: PathSegmentSimple)
│ │ │ │ │ └── ident (kind: TokenIdentifier): 'C'
│ │ │ │ └── rparen (kind: TokenRParen): ')'
│ │ │ └── rparen (kind: TokenRParen): ')'
│ │ └── rbrack (kind: TokenRBrack): ']'
│ ├── visibility (kind: VisibilityDefault) []
│ ├── declaration (kind: FunctionDeclaration) <ignored>
│ └── body (kind: ExprBlock) <ignored>
├── child #5 (kind: FunctionWithBody)
│ ├── attributes (kind: AttributeList)
│ │ └── child #0 (kind: Attribute)
│ │ ├── hash (kind: TokenHash): '#'
│ │ ├── lbrack (kind: TokenLBrack): '['
│ │ ├── attr (kind: ExprPath)
│ │ │ ├── dollar (kind: OptionTerminalDollarEmpty) []
│ │ │ └── segments (kind: ExprPathInner)
│ │ │ └── item #0 (kind: PathSegmentSimple)
│ │ │ └── ident (kind: TokenIdentifier): 'cfg_attr'
│ │ ├── arguments (kind: ArgListParenthesized)
│ │ │ ├── lparen (kind: TokenLParen): '('
│ │ │ ├── arguments (kind: ArgList)
│ │ │ │ ├── item #0 (kind: Arg)
│ │ │ │ │ ├── modifiers (kind: ModifierList) []
│ │ │ │ │ └── arg_clause (kind: ArgClauseUnnamed)
│ │ │ │ │ └── value (kind: ExprPath)
│ │ │ │ │ ├── dollar (kind: OptionTerminalDollarEmpty) []
│ │ │ │ │ └── segments (kind: ExprPathInner)
│ │ │ │ │ └── item #0 (kind: PathSegmentSimple)
│ │ │ │ │ └── ident (kind: TokenIdentifier): 'test'
│ │ │ │ ├── separator #0 (kind: TokenComma): ','
│ │ │ │ └── item #1 (kind: Arg)
│ │ │ │ ├── modifiers (kind: ModifierList) []
│ │ │ │ └── arg_clause (kind: ArgClauseUnnamed)
│ │ │ │ └── value (kind: ExprFunctionCall)
│ │ │ │ ├── path (kind: ExprPath)
│ │ │ │ │ ├── dollar (kind: OptionTerminalDollarEmpty) []
│ │ │ │ │ └── segments (kind: ExprPathInner)
│ │ │ │ │ └── item #0 (kind: PathSegmentSimple)
│ │ │ │ │ └── ident (kind: TokenIdentifier): 'assert_instr'
│ │ │ │ └── arguments (kind: ArgListParenthesized)
│ │ │ │ ├── lparen (kind: TokenLParen): '('
│ │ │ │ ├── arguments (kind: ArgList)
│ │ │ │ │ └── item #0 (kind: Arg)
│ │ │ │ │ ├── modifiers (kind: ModifierList) []
│ │ │ │ │ └── arg_clause (kind: ArgClauseNamed)
│ │ │ │ │ ├── name (kind: TokenIdentifier): 'instr'
│ │ │ │ │ ├── colon (kind: TokenColon): ':'
│ │ │ │ │ └── value (kind: ExprBinary)
│ │ │ │ │ ├── lhs (kind: ExprPath)
│ │ │ │ │ │ ├── dollar (kind: OptionTerminalDollarEmpty) []
│ │ │ │ │ │ └── segments (kind: ExprPathInner)
│ │ │ │ │ │ └── item #0 (kind: PathSegmentSimple)
│ │ │ │ │ │ └── ident (kind: TokenIdentifier): 'add_a'
│ │ │ │ │ ├── op (kind: TokenDot): '.'
│ │ │ │ │ └── rhs (kind: ExprPath)
│ │ │ │ │ ├── dollar (kind: OptionTerminalDollarEmpty) []
│ │ │ │ │ └── segments (kind: ExprPathInner)
│ │ │ │ │ └── item #0 (kind: PathSegmentSimple)
│ │ │ │ │ └── ident (kind: TokenIdentifier): 'b'
│ │ │ │ └── rparen (kind: TokenRParen): ')'
│ │ │ └── rparen (kind: TokenRParen): ')'
│ │ └── rbrack (kind: TokenRBrack): ']'
│ ├── visibility (kind: VisibilityDefault) []
│ ├── declaration (kind: FunctionDeclaration) <ignored>
│ └── body (kind: ExprBlock) <ignored>
└── child #6 (kind: FunctionWithBody)
├── attributes (kind: AttributeList)
│ └── child #0 (kind: Attribute)
│ ├── hash (kind: TokenHash): '#'
│ ├── lbrack (kind: TokenLBrack): '['
│ ├── attr (kind: ExprPath)
│ │ ├── dollar (kind: OptionTerminalDollarEmpty) []
│ │ └── segments (kind: ExprPathInner)
│ │ └── item #0 (kind: PathSegmentSimple)
│ │ └── ident (kind: TokenIdentifier): 'attr'
│ ├── arguments (kind: ArgListParenthesized)
│ │ ├── lparen (kind: TokenLParen): '('
│ │ ├── arguments (kind: ArgList)
│ │ │ ├── item #0 (kind: Arg)
│ │ │ │ ├── modifiers (kind: ModifierList) []
│ │ │ │ └── arg_clause (kind: ArgClauseUnnamed)
│ │ │ │ └── value (kind: ExprPath)
│ │ │ │ ├── dollar (kind: OptionTerminalDollarEmpty) []
│ │ │ │ └── segments (kind: ExprPathInner)
│ │ │ │ ├── item #0 (kind: PathSegmentSimple)
│ │ │ │ │ └── ident (kind: TokenIdentifier): 'foo'
│ │ │ │ ├── separator #0 (kind: TokenColonColon): '::'
│ │ │ │ └── item #1 (kind: PathSegmentSimple)
│ │ │ │ └── ident (kind: TokenIdentifier): 'bar'
│ │ │ ├── separator #0 (kind: TokenComma): ','
│ │ │ └── item #1 (kind: Arg)
│ │ │ ├── modifiers (kind: ModifierList) []
│ │ │ └── arg_clause (kind: ArgClauseUnnamed)
│ │ │ └── value (kind: ExprPath)
│ │ │ ├── dollar (kind: OptionTerminalDollarEmpty) []
│ │ │ └── segments (kind: ExprPathInner)
│ │ │ └── item #0 (kind: PathSegmentSimple)
│ │ │ └── ident (kind: TokenIdentifier): 'qwe'
│ │ └── rparen (kind: TokenRParen): ')'
│ └── rbrack (kind: TokenRBrack): ']'
├── visibility (kind: VisibilityDefault) []
├── declaration (kind: FunctionDeclaration) <ignored>
└── body (kind: ExprBlock) <ignored>