* add field names to object elements

* dont hide template interpolation start/end and quoted template start/end tokens
This commit is contained in:
mhoffm
2021-07-01 23:57:52 +02:00
parent 7cf85f1046
commit 380571cc1a
15 changed files with 696 additions and 429 deletions

View File

@@ -13,7 +13,9 @@ foo = "bar"
(expression
(literal_value
(string_lit
(template_literal)))))))
(quoted_template_start)
(template_literal)
(quoted_template_end)))))))
================================================================================
attribute with variable

View File

@@ -40,16 +40,22 @@ block_1 "strlit1" "strlit2" {
(block
(identifier)
(string_lit
(template_literal))
(quoted_template_start)
(template_literal)
(quoted_template_end))
(string_lit
(template_literal))
(quoted_template_start)
(template_literal)
(quoted_template_end))
(body
(attribute
(identifier)
(expression
(literal_value
(string_lit
(template_literal)))))))))
(quoted_template_start)
(template_literal)
(quoted_template_end)))))))))
================================================================================
nested block
@@ -135,7 +141,11 @@ locals { timestamp = regex_replace(timestamp(), "[- TZ:]", "") }
(expression
(literal_value
(string_lit
(template_literal))))
(quoted_template_start)
(template_literal)
(quoted_template_end))))
(expression
(template_expr
(quoted_template)))))))))))
(quoted_template
(quoted_template_start)
(quoted_template_end))))))))))))

View File

@@ -22,7 +22,9 @@ foo = [1, 2, "foo"]
(expression
(literal_value
(string_lit
(template_literal))))))))))
(quoted_template_start)
(template_literal)
(quoted_template_end))))))))))
================================================================================
multiline tuple
@@ -52,7 +54,9 @@ foo = [
(expression
(literal_value
(string_lit
(template_literal))))))))))
(quoted_template_start)
(template_literal)
(quoted_template_end))))))))))
================================================================================
empty tuple
@@ -113,11 +117,15 @@ foo = {1: 2, "foo"="bar"}
(expression
(literal_value
(string_lit
(template_literal))))
(quoted_template_start)
(template_literal)
(quoted_template_end))))
(expression
(literal_value
(string_lit
(template_literal)))))))))))
(quoted_template_start)
(template_literal)
(quoted_template_end)))))))))))
================================================================================
multiline object
@@ -148,11 +156,15 @@ foo = {
(expression
(literal_value
(string_lit
(template_literal))))
(quoted_template_start)
(template_literal)
(quoted_template_end))))
(expression
(literal_value
(string_lit
(template_literal)))))))))))
(quoted_template_start)
(template_literal)
(quoted_template_end)))))))))))
================================================================================
empty object
@@ -216,11 +228,15 @@ foo = { 1: 2,
(expression
(literal_value
(string_lit
(template_literal))))
(quoted_template_start)
(template_literal)
(quoted_template_end))))
(expression
(literal_value
(string_lit
(template_literal)))))))))))
(quoted_template_start)
(template_literal)
(quoted_template_end)))))))))))
================================================================================
complex object
@@ -247,7 +263,9 @@ foo = {
(expression
(literal_value
(string_lit
(template_literal)))))
(quoted_template_start)
(template_literal)
(quoted_template_end)))))
(object_elem
(expression
(variable_expr
@@ -255,7 +273,9 @@ foo = {
(expression
(literal_value
(string_lit
(template_literal)))))))))))
(quoted_template_start)
(template_literal)
(quoted_template_end)))))))))))
================================================================================
complex from real world
@@ -295,7 +315,9 @@ worker_groups = [
(expression
(literal_value
(string_lit
(template_literal)))))
(quoted_template_start)
(template_literal)
(quoted_template_end)))))
(object_elem
(expression
(variable_expr
@@ -303,7 +325,9 @@ worker_groups = [
(expression
(literal_value
(string_lit
(template_literal)))))
(quoted_template_start)
(template_literal)
(quoted_template_end)))))
(object_elem
(expression
(variable_expr
@@ -335,7 +359,9 @@ worker_groups = [
(expression
(literal_value
(string_lit
(template_literal)))))
(quoted_template_start)
(template_literal)
(quoted_template_end)))))
(object_elem
(expression
(variable_expr
@@ -343,7 +369,9 @@ worker_groups = [
(expression
(literal_value
(string_lit
(template_literal)))))
(quoted_template_start)
(template_literal)
(quoted_template_end)))))
(object_elem
(expression
(variable_expr
@@ -365,4 +393,3 @@ worker_groups = [
(expression
(literal_value
(numeric_lit)))))))))))))

View File

@@ -51,11 +51,15 @@ foo = ( true ? false : true ) ? "yes" : "no"
(expression
(literal_value
(string_lit
(template_literal))))
(quoted_template_start)
(template_literal)
(quoted_template_end))))
(expression
(literal_value
(string_lit
(template_literal)))))))))
(quoted_template_start)
(template_literal)
(quoted_template_end)))))))))
================================================================================
nested conditional expression expression without parentheses
@@ -85,8 +89,12 @@ foo = true ? false : true ? "yes" : "no"
(expression
(literal_value
(string_lit
(template_literal))))
(quoted_template_start)
(template_literal)
(quoted_template_end))))
(expression
(literal_value
(string_lit
(template_literal)))))))))
(quoted_template_start)
(template_literal)
(quoted_template_end)))))))))

View File

@@ -21,11 +21,15 @@ foo = [for v in ["a", "b"]: v]
(expression
(literal_value
(string_lit
(template_literal))))
(quoted_template_start)
(template_literal)
(quoted_template_end))))
(expression
(literal_value
(string_lit
(template_literal))))))))
(quoted_template_start)
(template_literal)
(quoted_template_end))))))))
(expression
(variable_expr
(identifier)))))))))
@@ -54,11 +58,15 @@ foo = [for i, v in ["a", "b"]: i]
(expression
(literal_value
(string_lit
(template_literal))))
(quoted_template_start)
(template_literal)
(quoted_template_end))))
(expression
(literal_value
(string_lit
(template_literal))))))))
(quoted_template_start)
(template_literal)
(quoted_template_end))))))))
(expression
(variable_expr
(identifier)))))))))
@@ -87,15 +95,21 @@ foo = [for i, v in ["a", "b", "c"]: v if pred(i)]
(expression
(literal_value
(string_lit
(template_literal))))
(quoted_template_start)
(template_literal)
(quoted_template_end))))
(expression
(literal_value
(string_lit
(template_literal))))
(quoted_template_start)
(template_literal)
(quoted_template_end))))
(expression
(literal_value
(string_lit
(template_literal))))))))
(quoted_template_start)
(template_literal)
(quoted_template_end))))))))
(expression
(variable_expr
(identifier)))
@@ -132,11 +146,15 @@ foo = {for i, v in ["a", "b"]: v => i}
(expression
(literal_value
(string_lit
(template_literal))))
(quoted_template_start)
(template_literal)
(quoted_template_end))))
(expression
(literal_value
(string_lit
(template_literal))))))))
(quoted_template_start)
(template_literal)
(quoted_template_end))))))))
(expression
(variable_expr
(identifier)))
@@ -168,11 +186,15 @@ foo = {for i, v in ["a", "b"]: v => i...}
(expression
(literal_value
(string_lit
(template_literal))))
(quoted_template_start)
(template_literal)
(quoted_template_end))))
(expression
(literal_value
(string_lit
(template_literal))))))))
(quoted_template_start)
(template_literal)
(quoted_template_end))))))))
(expression
(variable_expr
(identifier)))

View File

@@ -33,7 +33,9 @@ foo = bar("foo")
(expression
(literal_value
(string_lit
(template_literal))))))))))
(quoted_template_start)
(template_literal)
(quoted_template_end))))))))))
================================================================================
variadic function call
@@ -79,12 +81,18 @@ foo = bar(
(expression
(literal_value
(string_lit
(template_literal))))
(quoted_template_start)
(template_literal)
(quoted_template_end))))
(expression
(literal_value
(string_lit
(template_literal))))
(quoted_template_start)
(template_literal)
(quoted_template_end))))
(expression
(literal_value
(string_lit
(template_literal))))))))))
(quoted_template_start)
(template_literal)
(quoted_template_end))))))))))

View File

@@ -15,7 +15,9 @@ provider "kubernetes" {
(block
(identifier)
(string_lit
(template_literal))
(quoted_template_start)
(template_literal)
(quoted_template_end))
(body
(attribute
(identifier)
@@ -122,7 +124,9 @@ resource "azurerm_storage_blob" "proxy_cert" {
(get_attr
(identifier))
(template_expr
(quoted_template)))))
(quoted_template
(quoted_template_start)
(quoted_template_end))))))
(expression
(variable_expr
(identifier))
@@ -152,7 +156,9 @@ resource "azurerm_storage_blob" "proxy_cert" {
(get_attr
(identifier))
(template_expr
(quoted_template)))))
(quoted_template
(quoted_template_start)
(quoted_template_end))))))
(expression
(variable_expr
(identifier))
@@ -173,9 +179,13 @@ resource "azurerm_storage_blob" "proxy_cert" {
(block
(identifier)
(string_lit
(template_literal))
(quoted_template_start)
(template_literal)
(quoted_template_end))
(string_lit
(template_literal))
(quoted_template_start)
(template_literal)
(quoted_template_end))
(body
(attribute
(identifier)
@@ -189,7 +199,9 @@ resource "azurerm_storage_blob" "proxy_cert" {
(get_attr
(identifier))
(template_expr
(quoted_template)))))
(quoted_template
(quoted_template_start)
(quoted_template_end))))))
(expression
(literal_value
(numeric_lit)))
@@ -215,13 +227,19 @@ resource "azurerm_storage_blob" "proxy_cert" {
(expression
(literal_value
(string_lit
(template_literal)))))))
(quoted_template_start)
(template_literal)
(quoted_template_end)))))))
(block
(identifier)
(string_lit
(template_literal))
(quoted_template_start)
(template_literal)
(quoted_template_end))
(string_lit
(template_literal))
(quoted_template_start)
(template_literal)
(quoted_template_end))
(body
(attribute
(identifier)
@@ -235,7 +253,9 @@ resource "azurerm_storage_blob" "proxy_cert" {
(get_attr
(identifier))
(template_expr
(quoted_template)))))
(quoted_template
(quoted_template_start)
(quoted_template_end))))))
(expression
(literal_value
(numeric_lit)))
@@ -261,13 +281,19 @@ resource "azurerm_storage_blob" "proxy_cert" {
(expression
(literal_value
(string_lit
(template_literal)))))))
(quoted_template_start)
(template_literal)
(quoted_template_end)))))))
(block
(identifier)
(string_lit
(template_literal))
(quoted_template_start)
(template_literal)
(quoted_template_end))
(string_lit
(template_literal))
(quoted_template_start)
(template_literal)
(quoted_template_end))
(body
(attribute
(identifier)
@@ -281,7 +307,9 @@ resource "azurerm_storage_blob" "proxy_cert" {
(get_attr
(identifier))
(template_expr
(quoted_template)))))
(quoted_template
(quoted_template_start)
(quoted_template_end))))))
(expression
(literal_value
(numeric_lit)))
@@ -328,13 +356,19 @@ resource "azurerm_storage_blob" "proxy_cert" {
(expression
(literal_value
(string_lit
(template_literal)))))))
(quoted_template_start)
(template_literal)
(quoted_template_end)))))))
(block
(identifier)
(string_lit
(template_literal))
(quoted_template_start)
(template_literal)
(quoted_template_end))
(string_lit
(template_literal))
(quoted_template_start)
(template_literal)
(quoted_template_end))
(body
(attribute
(identifier)
@@ -352,13 +386,17 @@ resource "azurerm_storage_blob" "proxy_cert" {
(get_attr
(identifier))
(template_expr
(quoted_template))))
(quoted_template
(quoted_template_start)
(quoted_template_end)))))
(variable_expr
(identifier))))
(get_attr
(identifier))
(template_expr
(quoted_template)))))
(quoted_template
(quoted_template_start)
(quoted_template_end))))))
(expression
(literal_value
(numeric_lit)))
@@ -405,7 +443,9 @@ resource "azurerm_storage_blob" "proxy_cert" {
(expression
(literal_value
(string_lit
(template_literal)))))))))
(quoted_template_start)
(template_literal)
(quoted_template_end)))))))))
================================================================================
example 3
@@ -460,7 +500,9 @@ locals {
(expression
(template_expr
(quoted_template
(quoted_template_start)
(template_interpolation
(template_interpolation_start)
(expression
(conditional
(expression
@@ -486,4 +528,6 @@ locals {
(get_attr
(identifier))
(get_attr
(identifier))))))))))))))
(identifier)))))
(template_interpolation_end))
(quoted_template_end)))))))))

View File

@@ -13,7 +13,9 @@ foo = "foo bar"
(expression
(literal_value
(string_lit
(template_literal)))))))
(quoted_template_start)
(template_literal)
(quoted_template_end)))))))
================================================================================
escaped backslash at end
@@ -30,7 +32,9 @@ foo = "foo\\"
(expression
(literal_value
(string_lit
(template_literal)))))))
(quoted_template_start)
(template_literal)
(quoted_template_end)))))))
================================================================================
string literal escaped template interpolation
@@ -47,7 +51,9 @@ foo = "$${foo.bar}"
(expression
(literal_value
(string_lit
(template_literal)))))))
(quoted_template_start)
(template_literal)
(quoted_template_end)))))))
================================================================================
template chars but no template 1
@@ -64,7 +70,9 @@ foo = "$$$"
(expression
(literal_value
(string_lit
(template_literal)))))))
(quoted_template_start)
(template_literal)
(quoted_template_end)))))))
================================================================================
template chars but no template 2
@@ -81,7 +89,9 @@ foo = "100%"
(expression
(literal_value
(string_lit
(template_literal)))))))
(quoted_template_start)
(template_literal)
(quoted_template_end)))))))
================================================================================
template chars but no template 3
@@ -98,7 +108,9 @@ foo = "%\n\t"
(expression
(literal_value
(string_lit
(template_literal)))))))
(quoted_template_start)
(template_literal)
(quoted_template_end)))))))
================================================================================
template chars but no template 4
@@ -115,7 +127,9 @@ foo = "%%\n\t"
(expression
(literal_value
(string_lit
(template_literal)))))))
(quoted_template_start)
(template_literal)
(quoted_template_end)))))))
================================================================================
template chars but no template 5
@@ -132,7 +146,9 @@ foo = "$$"
(expression
(literal_value
(string_lit
(template_literal)))))))
(quoted_template_start)
(template_literal)
(quoted_template_end)))))))
================================================================================
template chars but no template 6
@@ -149,7 +165,9 @@ foo = "%%{\n\t"
(expression
(literal_value
(string_lit
(template_literal)))))))
(quoted_template_start)
(template_literal)
(quoted_template_end)))))))
================================================================================
escaped template
@@ -166,4 +184,6 @@ foo = "$${ var.bar }"
(expression
(literal_value
(string_lit
(template_literal)))))))
(quoted_template_start)
(template_literal)
(quoted_template_end)))))))

View File

@@ -13,12 +13,16 @@ foo = "${ var.bar }"
(expression
(template_expr
(quoted_template
(quoted_template_start)
(template_interpolation
(template_interpolation_start)
(expression
(variable_expr
(identifier))
(get_attr
(identifier))))))))))
(identifier)))
(template_interpolation_end))
(quoted_template_end)))))))
================================================================================
empty template interpolation
@@ -35,7 +39,11 @@ foo = "${}"
(expression
(template_expr
(quoted_template
(template_interpolation)))))))
(quoted_template_start)
(template_interpolation
(template_interpolation_start)
(template_interpolation_end))
(quoted_template_end)))))))
================================================================================
empty heredoc template
@@ -94,11 +102,17 @@ foo = "${ " ~ " }"
(expression
(template_expr
(quoted_template
(quoted_template_start)
(template_interpolation
(template_interpolation_start)
(expression
(literal_value
(string_lit
(template_literal)))))))))))
(quoted_template_start)
(template_literal)
(quoted_template_end))))
(template_interpolation_end))
(quoted_template_end)))))))
================================================================================
quoted template with nested quoted template
@@ -115,8 +129,10 @@ foo = "p-${ foo("v-${a.b}") }"
(expression
(template_expr
(quoted_template
(quoted_template_start)
(template_literal)
(template_interpolation
(template_interpolation_start)
(expression
(function_call
(identifier)
@@ -124,13 +140,19 @@ foo = "p-${ foo("v-${a.b}") }"
(expression
(template_expr
(quoted_template
(quoted_template_start)
(template_literal)
(template_interpolation
(template_interpolation_start)
(expression
(variable_expr
(identifier))
(get_attr
(identifier)))))))))))))))))
(identifier)))
(template_interpolation_end))
(quoted_template_end)))))))
(template_interpolation_end))
(quoted_template_end)))))))
================================================================================
quoted template interpolation with strip markers
@@ -147,15 +169,21 @@ foo = "hello ${~ "world" ~} hello"
(expression
(template_expr
(quoted_template
(quoted_template_start)
(template_literal)
(template_interpolation
(template_interpolation_start)
(strip_marker)
(expression
(literal_value
(string_lit
(template_literal))))
(strip_marker))
(template_literal)))))))
(quoted_template_start)
(template_literal)
(quoted_template_end))))
(strip_marker)
(template_interpolation_end))
(template_literal)
(quoted_template_end)))))))
================================================================================
quoted template object expression in template
@@ -172,7 +200,9 @@ foo = "${ {a=b}[a] }"
(expression
(template_expr
(quoted_template
(quoted_template_start)
(template_interpolation
(template_interpolation_start)
(expression
(collection_value
(object
@@ -187,7 +217,9 @@ foo = "${ {a=b}[a] }"
(new_index
(expression
(variable_expr
(identifier)))))))))))))
(identifier))))))
(template_interpolation_end))
(quoted_template_end)))))))
================================================================================
escaped template interpolation start
@@ -204,7 +236,9 @@ foo = "hello $${ world"
(expression
(literal_value
(string_lit
(template_literal)))))))
(quoted_template_start)
(template_literal)
(quoted_template_end)))))))
================================================================================
tricky heredoc