====================================
A string constant.
====================================
{{"\"output\""}}
---
(template
    (interpreted_string_literal
        (escape_sequence)
        (escape_sequence)))

====================================
A raw string constant.
====================================
{{`"output"`}}
---
(template (raw_string_literal))

====================================
A function call.
====================================
{{printf "%q" "output"}}
---
(template
    (function_call
        (identifier)
        (argument_list
            (interpreted_string_literal)
            (interpreted_string_literal))))

====================================
A function call whose final argument comes from the previous command.
====================================
{{"output" | printf "%q"}}
---
(template
    (chained_pipeline
        (interpreted_string_literal)
        (function_call
            (identifier)
            (argument_list
                (interpreted_string_literal)))))

====================================
A parenthesized argument.
====================================
{{printf "%q" (print "out" "put")}}
---
(template
    (function_call
        (identifier)
        (argument_list
            (interpreted_string_literal)
            (parenthesized_pipeline
                (function_call
                    (identifier)
                    (argument_list
                        (interpreted_string_literal)
                        (interpreted_string_literal)))))))

====================================
A more elaborate call.
====================================
{{"put" | printf "%s%s" "out" | printf "%q"}}
---
(template
    (chained_pipeline
        (chained_pipeline
            (interpreted_string_literal)
            (function_call
                (identifier)
                (argument_list
                    (interpreted_string_literal)
                    (interpreted_string_literal))))
        (function_call
            (identifier)
            (argument_list
                (interpreted_string_literal)))))

====================================
A longer chain.
====================================
{{"output" | printf "%s" | printf "%q"}}
---
(template
    (chained_pipeline
        (chained_pipeline
            (interpreted_string_literal)
            (function_call
                (identifier)
                (argument_list
                    (interpreted_string_literal))))
        (function_call
            (identifier)
            (argument_list
                (interpreted_string_literal)))))

====================================
A with action using dot.
====================================
{{with "output"}}{{printf "%q" .}}{{end}}
---
(template
    (with_action
        (interpreted_string_literal)
        (function_call
            (identifier)
            (argument_list
                (interpreted_string_literal)
                (dot)))))

====================================
A with action using dot.
====================================
{{with "output"}}{{printf "%q" .}}{{end}}
---
(template
    (with_action
        (interpreted_string_literal)
        (function_call
            (identifier)
            (argument_list
                (interpreted_string_literal)
                (dot)))))

====================================
A with action that creates and uses a variable.
====================================
{{with $x := "output" | printf "%q"}}{{$x}}{{end}}
---
(template
    (with_action
        (variable_definition
            (variable (identifier))
            (chained_pipeline
                (interpreted_string_literal)
                (function_call
                    (identifier)
                    (argument_list
                        (interpreted_string_literal)))))
        (variable (identifier))))

====================================
A with action that uses the variable in another action.
====================================
{{with $x := "output"}}{{printf "%q" $x}}{{end}}
---
(template
    (with_action
        (variable_definition
            (variable (identifier))
            (interpreted_string_literal))
        (function_call
            (identifier)
            (argument_list
                (interpreted_string_literal)
                (variable (identifier))))))

====================================
The same, but pipelined.
====================================
{{with $x := "output"}}{{$x | printf "%q"}}{{end}}
---
(template
    (with_action
        (variable_definition
            (variable
                (identifier))
            (interpreted_string_literal))
        (chained_pipeline
            (variable
                (identifier))
            (function_call
                (identifier)
                (argument_list
                    (interpreted_string_literal))))))
