### Show GreenNode with source text using show Source: https://julialang.github.io/JuliaSyntax.jl Displays the `GreenNode` tree with token strings by passing the source text to `show` with MIME"text/plain". This shows the actual token values alongside the tree structure. ```julia julia> show(stdout, MIME"text/plain"(), greentree, text) 1:9 │[call] 1:7 │ [parens] 1:1 │ ( "(" 2:6 │ [call] 2:2 │ Identifier ✔ "x" 3:3 │ Whitespace " " 4:4 │ + ✔ "+" 5:5 │ Whitespace " " 6:6 │ Identifier ✔ "y" 7:7 │ ) ")" 8:8 │ * ✔ "*" 9:9 │ Identifier ✔ "z" ``` -------------------------------- ### Parse to SyntaxNode AST with parsestmt Source: https://julialang.github.io/JuliaSyntax.jl Parses the expression "(x + y)*z" into a source-ordered AST using `JuliaSyntax.parsestmt` with `SyntaxNode`. The output shows the tree structure with line:column positions and file name. ```julia julia> using JuliaSyntax julia> parsestmt(SyntaxNode, "(x + y)*z", filename="foo.jl") line:col│ tree │ file_name 1:1 │[call-i] │foo.jl 1:1 │ [parens] 1:2 │ [call-i] 1:2 │ x 1:4 │ + 1:6 │ y 1:8 │ * 1:9 │ z ``` -------------------------------- ### Parse to GreenNode green tree with parsestmt Source: https://julialang.github.io/JuliaSyntax.jl Parses the same expression into a `GreenNode` representation using `JuliaSyntax.parsestmt`. The output shows byte ranges and flags nontrivia tokens with ✔, while parentheses are treated as trivia. ```julia julia> text = "(x + y)*z" greentree = parsestmt(JuliaSyntax.GreenNode, text) 1:9 │[call] 1:7 │ [parens] 1:1 │ ( 2:6 │ [call] 2:2 │ Identifier ✔ 3:3 │ Whitespace 4:4 │ + ✔ 5:5 │ Whitespace 6:6 │ Identifier ✔ 7:7 │ ) 8:8 │ * ✔ 9:9 │ Identifier ✔ ``` -------------------------------- ### Parse to Expr with parsestmt Source: https://julialang.github.io/JuliaSyntax.jl Parses the expression into a Julia `Expr` using `JuliaSyntax.parsestmt`. The output shows the resulting expression as `:((x + y) * z)`. ```julia julia> JuliaSyntax.parsestmt(Expr, "(x + y)*z") :((x + y) * z) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.