tree-sitter-dockerfile/corpus/strings.txt
Martin Jambon 98fdcad2a0 Add support for single-quoted strings and distinguish JSON strings from
the double-quoted strings that support variable expansion.
2023-06-22 19:44:07 -07:00

147 lines
2.8 KiB
Plaintext

==========================
JSON string arrays
==========================
CMD ["a", "bcd"]
CMD ["\"\\"]
CMD ["\b\f\n\r\t\u0ABC\u12Cd"]
---
(source_file
(cmd_instruction
(json_string_array
(json_string)
(json_string)))
(cmd_instruction
(json_string_array
(json_string)))
(cmd_instruction
(json_string_array
(json_string))))
==========================
Double-quoted strings
==========================
ENV KEY "value"
ENV KEY "conti\
nue"
ENV KEY "quotes: \" '"
ENV KEY "backslash: \\"
ENV KEY "not escape sequences: \a \n"
ENV KEY "expansions: $FOO ${BAR}"
---
(source_file
(env_instruction
(env_pair
(unquoted_string)
(double_quoted_string)))
(env_instruction
(env_pair
(unquoted_string)
(double_quoted_string
(line_continuation))))
(env_instruction
(env_pair
(unquoted_string)
(double_quoted_string
(double_quoted_escape_sequence))))
(env_instruction
(env_pair
(unquoted_string)
(double_quoted_string
(double_quoted_escape_sequence))))
(env_instruction
(env_pair
(unquoted_string)
(double_quoted_string
(double_quoted_escape_sequence)
(double_quoted_escape_sequence))))
(env_instruction
(env_pair
(unquoted_string)
(double_quoted_string
(expansion
(variable))
(expansion
(variable))))))
==========================
Single-quoted strings
==========================
ENV KEY 'value'
ENV KEY 'conti\
nue'
ENV KEY 'quotes: \' \''
ENV KEY 'backslash: \\'
ENV KEY 'not escape sequences: \a \n'
---
(source_file
(env_instruction
(env_pair
(unquoted_string)
(single_quoted_string)))
(env_instruction
(env_pair
(unquoted_string)
(single_quoted_string
(line_continuation))))
(env_instruction
(env_pair
(unquoted_string)
(single_quoted_string
(single_quoted_escape_sequence)
(single_quoted_escape_sequence))))
(env_instruction
(env_pair
(unquoted_string)
(single_quoted_string
(single_quoted_escape_sequence))))
(env_instruction
(env_pair
(unquoted_string)
(single_quoted_string
(single_quoted_escape_sequence)
(single_quoted_escape_sequence)))))
==========================
Unquoted strings
==========================
ENV KEY value
ENV KEY two\ words
ENV KEY conti\
nue
ENV KEY $FOO${BAR}baz
---
(source_file
(env_instruction
(env_pair
(unquoted_string)
(unquoted_string)))
(env_instruction
(env_pair
(unquoted_string)
(unquoted_string)))
(env_instruction
(env_pair
(unquoted_string)
(unquoted_string
(line_continuation))))
(env_instruction
(env_pair
(unquoted_string)
(unquoted_string
(expansion
(variable))
(expansion
(variable))))))