cairo-lang-parser 2.18.0

Cairo parser.
Documentation
//! > Test function call syntax tree

//! > test_runner_name
test_partial_parser_tree(expect_diagnostics: false)

//! > cairo_code
fn test() {
    f::<felt252, 7>(12, a + 3, ref b);
}

//! > top_level_kind
ExprFunctionCall

//! > ignored_kinds

//! > expected_diagnostics

//! > expected_tree
└── Top level kind: ExprFunctionCall
    ├── path (kind: ExprPath)
    │   ├── dollar (kind: OptionTerminalDollarEmpty) []
    │   └── segments (kind: ExprPathInner)
    │       └── item #0 (kind: PathSegmentWithGenericArgs)
    │           ├── ident (kind: TokenIdentifier): 'f'
    │           ├── separator (kind: TokenColonColon): '::'
    │           └── generic_args (kind: GenericArgs)
    │               ├── langle (kind: TokenLT): '<'
    │               ├── generic_args (kind: GenericArgList)
    │               │   ├── item #0 (kind: GenericArgUnnamed)
    │               │   │   └── value (kind: ExprPath)
    │               │   │       ├── dollar (kind: OptionTerminalDollarEmpty) []
    │               │   │       └── segments (kind: ExprPathInner)
    │               │   │           └── item #0 (kind: PathSegmentSimple)
    │               │   │               └── ident (kind: TokenIdentifier): 'felt252'
    │               │   ├── separator #0 (kind: TokenComma): ','
    │               │   └── item #1 (kind: GenericArgUnnamed)
    │               │       └── value (kind: TokenLiteralNumber): '7'
    │               └── rangle (kind: TokenGT): '>'
    └── arguments (kind: ArgListParenthesized)
        ├── lparen (kind: TokenLParen): '('
        ├── arguments (kind: ArgList)
        │   ├── item #0 (kind: Arg)
        │   │   ├── modifiers (kind: ModifierList) []
        │   │   └── arg_clause (kind: ArgClauseUnnamed)
        │   │       └── value (kind: TokenLiteralNumber): '12'
        │   ├── separator #0 (kind: TokenComma): ','
        │   ├── item #1 (kind: Arg)
        │   │   ├── modifiers (kind: ModifierList) []
        │   │   └── arg_clause (kind: ArgClauseUnnamed)
        │   │       └── value (kind: ExprBinary)
        │   │           ├── lhs (kind: ExprPath)
        │   │           │   ├── dollar (kind: OptionTerminalDollarEmpty) []
        │   │           │   └── segments (kind: ExprPathInner)
        │   │           │       └── item #0 (kind: PathSegmentSimple)
        │   │           │           └── ident (kind: TokenIdentifier): 'a'
        │   │           ├── op (kind: TokenPlus): '+'
        │   │           └── rhs (kind: TokenLiteralNumber): '3'
        │   ├── separator #1 (kind: TokenComma): ','
        │   └── item #2 (kind: Arg)
        │       ├── modifiers (kind: ModifierList)
        │       │   └── child #0 (kind: TokenRef): 'ref'
        │       └── arg_clause (kind: ArgClauseUnnamed)
        │           └── value (kind: ExprPath)
        │               ├── dollar (kind: OptionTerminalDollarEmpty) []
        │               └── segments (kind: ExprPathInner)
        │                   └── item #0 (kind: PathSegmentSimple)
        │                       └── ident (kind: TokenIdentifier): 'b'
        └── rparen (kind: TokenRParen): ')'

//! > ==========================================================================

//! > Test function call with named arguments

//! > test_runner_name
test_partial_parser_tree(expect_diagnostics: false)

//! > cairo_code
fn test() {
    f(12, y: a + 3, :z);
}

//! > top_level_kind
ExprFunctionCall

//! > ignored_kinds

//! > expected_diagnostics

//! > expected_tree
└── Top level kind: ExprFunctionCall
    ├── path (kind: ExprPath)
    │   ├── dollar (kind: OptionTerminalDollarEmpty) []
    │   └── segments (kind: ExprPathInner)
    │       └── item #0 (kind: PathSegmentSimple)
    │           └── ident (kind: TokenIdentifier): 'f'
    └── arguments (kind: ArgListParenthesized)
        ├── lparen (kind: TokenLParen): '('
        ├── arguments (kind: ArgList)
        │   ├── item #0 (kind: Arg)
        │   │   ├── modifiers (kind: ModifierList) []
        │   │   └── arg_clause (kind: ArgClauseUnnamed)
        │   │       └── value (kind: TokenLiteralNumber): '12'
        │   ├── separator #0 (kind: TokenComma): ','
        │   ├── item #1 (kind: Arg)
        │   │   ├── modifiers (kind: ModifierList) []
        │   │   └── arg_clause (kind: ArgClauseNamed)
        │   │       ├── name (kind: TokenIdentifier): 'y'
        │   │       ├── colon (kind: TokenColon): ':'
        │   │       └── value (kind: ExprBinary)
        │   │           ├── lhs (kind: ExprPath)
        │   │           │   ├── dollar (kind: OptionTerminalDollarEmpty) []
        │   │           │   └── segments (kind: ExprPathInner)
        │   │           │       └── item #0 (kind: PathSegmentSimple)
        │   │           │           └── ident (kind: TokenIdentifier): 'a'
        │   │           ├── op (kind: TokenPlus): '+'
        │   │           └── rhs (kind: TokenLiteralNumber): '3'
        │   ├── separator #1 (kind: TokenComma): ','
        │   └── item #2 (kind: Arg)
        │       ├── modifiers (kind: ModifierList) []
        │       └── arg_clause (kind: ArgClauseFieldInitShorthand)
        │           ├── colon (kind: TokenColon): ':'
        │           └── name (kind: ExprFieldInitShorthand)
        │               └── name (kind: TokenIdentifier): 'z'
        └── rparen (kind: TokenRParen): ')'