Files
tree-sitter-jhcl/test/corpus/templates.txt
mhoffm 380571cc1a * add field names to object elements
* dont hide template interpolation start/end and quoted template start/end tokens
2021-07-02 08:34:28 +02:00

285 lines
9.0 KiB
Plaintext

================================================================================
simple quoted template expression
================================================================================
foo = "${ var.bar }"
--------------------------------------------------------------------------------
(config_file
(body
(attribute
(identifier)
(expression
(template_expr
(quoted_template
(quoted_template_start)
(template_interpolation
(template_interpolation_start)
(expression
(variable_expr
(identifier))
(get_attr
(identifier)))
(template_interpolation_end))
(quoted_template_end)))))))
================================================================================
empty template interpolation
================================================================================
foo = "${}"
--------------------------------------------------------------------------------
(config_file
(body
(attribute
(identifier)
(expression
(template_expr
(quoted_template
(quoted_template_start)
(template_interpolation
(template_interpolation_start)
(template_interpolation_end))
(quoted_template_end)))))))
================================================================================
empty heredoc template
================================================================================
foo = <<END
END
--------------------------------------------------------------------------------
(config_file
(body
(attribute
(identifier)
(expression
(template_expr
(heredoc_template
(heredoc_start)
(heredoc_identifier)
(heredoc_identifier)))))))
================================================================================
heredoc with fake ending
================================================================================
foo = <<END
END not!
END
--------------------------------------------------------------------------------
(config_file
(body
(attribute
(identifier)
(expression
(template_expr
(heredoc_template
(heredoc_start)
(heredoc_identifier)
(template_literal)
(heredoc_identifier)))))))
================================================================================
quoted template expression with escaped strings and fake strip marker
================================================================================
foo = "${ " ~ " }"
--------------------------------------------------------------------------------
(config_file
(body
(attribute
(identifier)
(expression
(template_expr
(quoted_template
(quoted_template_start)
(template_interpolation
(template_interpolation_start)
(expression
(literal_value
(string_lit
(quoted_template_start)
(template_literal)
(quoted_template_end))))
(template_interpolation_end))
(quoted_template_end)))))))
================================================================================
quoted template with nested quoted template
================================================================================
foo = "p-${ foo("v-${a.b}") }"
--------------------------------------------------------------------------------
(config_file
(body
(attribute
(identifier)
(expression
(template_expr
(quoted_template
(quoted_template_start)
(template_literal)
(template_interpolation
(template_interpolation_start)
(expression
(function_call
(identifier)
(function_arguments
(expression
(template_expr
(quoted_template
(quoted_template_start)
(template_literal)
(template_interpolation
(template_interpolation_start)
(expression
(variable_expr
(identifier))
(get_attr
(identifier)))
(template_interpolation_end))
(quoted_template_end)))))))
(template_interpolation_end))
(quoted_template_end)))))))
================================================================================
quoted template interpolation with strip markers
================================================================================
foo = "hello ${~ "world" ~} hello"
--------------------------------------------------------------------------------
(config_file
(body
(attribute
(identifier)
(expression
(template_expr
(quoted_template
(quoted_template_start)
(template_literal)
(template_interpolation
(template_interpolation_start)
(strip_marker)
(expression
(literal_value
(string_lit
(quoted_template_start)
(template_literal)
(quoted_template_end))))
(strip_marker)
(template_interpolation_end))
(template_literal)
(quoted_template_end)))))))
================================================================================
quoted template object expression in template
================================================================================
foo = "${ {a=b}[a] }"
--------------------------------------------------------------------------------
(config_file
(body
(attribute
(identifier)
(expression
(template_expr
(quoted_template
(quoted_template_start)
(template_interpolation
(template_interpolation_start)
(expression
(collection_value
(object
(object_elem
(expression
(variable_expr
(identifier)))
(expression
(variable_expr
(identifier))))))
(index
(new_index
(expression
(variable_expr
(identifier))))))
(template_interpolation_end))
(quoted_template_end)))))))
================================================================================
escaped template interpolation start
================================================================================
foo = "hello $${ world"
--------------------------------------------------------------------------------
(config_file
(body
(attribute
(identifier)
(expression
(literal_value
(string_lit
(quoted_template_start)
(template_literal)
(quoted_template_end)))))))
================================================================================
tricky heredoc
================================================================================
foo = <<END
contains fake endings
END (ineligible) END
END
--------------------------------------------------------------------------------
(config_file
(body
(attribute
(identifier)
(expression
(template_expr
(heredoc_template
(heredoc_start)
(heredoc_identifier)
(template_literal)
(heredoc_identifier)))))))
================================================================================
heredoc with identifier that does not fit into the serialization buffer (should not crash)
================================================================================
foo = <<XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
--------------------------------------------------------------------------------
(config_file
(body
(attribute
(identifier)
(expression
(template_expr
(heredoc_template
(heredoc_start)
(heredoc_identifier)
(heredoc_identifier)))))))