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

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

====================================
A function call.
====================================
{{printf "%q" "output"}}
---
(source_file
    (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"}}
---
(source_file
    (template
        (chained_pipeline
            (interpreted_string_literal)
            (function_call
                (identifier)
                (argument_list
                    (interpreted_string_literal))))))

====================================
A parenthesized argument.
====================================
{{printf "%q" (print "out" "put")}}
---
(source_file
    (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"}}
---
(source_file
    (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"}}
---
(source_file
    (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}}
---
(source_file
    (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}}
---
(source_file
    (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}}
---
(source_file
    (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}}
---
(source_file
    (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}}
---
(source_file
    (template
        (with_action
            (variable_definition
                (variable
                    (identifier))
                (interpreted_string_literal))
            (chained_pipeline
                (variable
                    (identifier))
                (function_call
                    (identifier)
                    (argument_list
                        (interpreted_string_literal)))))))
