diff options
author | amitkummer <49096391+amitkummer@users.noreply.github.com> | 2022-03-27 16:25:34 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-27 15:25:34 +0200 |
commit | f06f6d60c5389d9bd6740a414e322dc439706d28 (patch) | |
tree | 8a44fc1f8890bea05ce2c328f945e6c88cf2d9a9 /tests/snippets | |
parent | 3cc98c9e9e2347a98edf8779d27630ef301497dc (diff) | |
download | pygments-git-f06f6d60c5389d9bd6740a414e322dc439706d28.tar.gz |
Terraform: Fix class name lexing (#2097)
* Merge unneeded state with it's parent rule
The `blockname` state did not have a `#pop` after it's only rule,
which caused outputting errors in #2094.
Instead of adding a `#pop`, I merged the `blockname` state with the
rule that uses it, to achieve the exact same lexing logic, but without
another state in the lexer.
* Add test for #2094
* Regenerate tokens for previous tests
Diffstat (limited to 'tests/snippets')
-rw-r--r-- | tests/snippets/terraform/test_backend.txt | 2 | ||||
-rw-r--r-- | tests/snippets/terraform/test_comment.txt | 20 | ||||
-rw-r--r-- | tests/snippets/terraform/test_functions.txt | 4 | ||||
-rw-r--r-- | tests/snippets/terraform/test_heredoc.txt | 2 | ||||
-rw-r--r-- | tests/snippets/terraform/test_module.txt | 2 | ||||
-rw-r--r-- | tests/snippets/terraform/test_resource.txt | 4 | ||||
-rw-r--r-- | tests/snippets/terraform/test_types.txt | 18 | ||||
-rw-r--r-- | tests/snippets/terraform/test_variable_declaration.txt | 2 | ||||
-rw-r--r-- | tests/snippets/terraform/test_variable_read.txt | 2 |
9 files changed, 38 insertions, 18 deletions
diff --git a/tests/snippets/terraform/test_backend.txt b/tests/snippets/terraform/test_backend.txt index df0586d4..ff02a582 100644 --- a/tests/snippets/terraform/test_backend.txt +++ b/tests/snippets/terraform/test_backend.txt @@ -18,7 +18,7 @@ terraform { '"consul"' Name.Variable ' ' Text.Whitespace '{' Punctuation -'\n' Text +'\n' Text.Whitespace ' ' Text.Whitespace 'address' Name.Attribute diff --git a/tests/snippets/terraform/test_comment.txt b/tests/snippets/terraform/test_comment.txt index 77bc33ad..9f5c1a7c 100644 --- a/tests/snippets/terraform/test_comment.txt +++ b/tests/snippets/terraform/test_comment.txt @@ -6,6 +6,9 @@ comment */ +provider "azurerm" { # (1) + features {} +} ---tokens--- '# Single line comment\n' Comment.Single @@ -42,3 +45,20 @@ '*/' Comment.Multiline '\n' Text.Whitespace + +'provider' Keyword.Reserved +' ' Text.Whitespace +'"azurerm"' Name.Variable +' ' Text.Whitespace +'{' Punctuation +' # (1)\n' Comment.Single + +' ' Text.Whitespace +'features' Name.Builtin +' ' Text.Whitespace +'{' Punctuation +'}' Punctuation +'\n' Text.Whitespace + +'}' Punctuation +' \n' Text.Whitespace diff --git a/tests/snippets/terraform/test_functions.txt b/tests/snippets/terraform/test_functions.txt index 009edc60..b00c7a5e 100644 --- a/tests/snippets/terraform/test_functions.txt +++ b/tests/snippets/terraform/test_functions.txt @@ -13,7 +13,7 @@ provider "aws" { '"aws"' Name.Variable ' ' Text.Whitespace '{' Punctuation -'\n' Text +'\n' Text.Whitespace ' ' Text.Whitespace 'value' Name.Attribute @@ -36,7 +36,7 @@ provider "aws" { '"aws"' Name.Variable ' ' Text.Whitespace '{' Punctuation -'\n' Text +'\n' Text.Whitespace ' ' Text.Whitespace 'value' Name.Attribute diff --git a/tests/snippets/terraform/test_heredoc.txt b/tests/snippets/terraform/test_heredoc.txt index 243087bf..1d73734d 100644 --- a/tests/snippets/terraform/test_heredoc.txt +++ b/tests/snippets/terraform/test_heredoc.txt @@ -13,7 +13,7 @@ resource "local_file" "heredoc" { '"heredoc"' Name.Variable ' ' Text.Whitespace '{' Punctuation -'\n' Text +'\n' Text.Whitespace ' ' Text.Whitespace 'content' Name.Attribute diff --git a/tests/snippets/terraform/test_module.txt b/tests/snippets/terraform/test_module.txt index 132af193..5a5876b0 100644 --- a/tests/snippets/terraform/test_module.txt +++ b/tests/snippets/terraform/test_module.txt @@ -10,7 +10,7 @@ module "consul" { '"consul"' Name.Variable ' ' Text.Whitespace '{' Punctuation -'\n' Text +'\n' Text.Whitespace ' ' Text.Whitespace 'source' Name.Attribute diff --git a/tests/snippets/terraform/test_resource.txt b/tests/snippets/terraform/test_resource.txt index 63e24d8f..7b2815a7 100644 --- a/tests/snippets/terraform/test_resource.txt +++ b/tests/snippets/terraform/test_resource.txt @@ -39,7 +39,7 @@ resource "aws_security_group" "allow_tls" { '"base_igw"' Name.Variable ' ' Text.Whitespace '{' Punctuation -'\n' Text +'\n' Text.Whitespace ' ' Text.Whitespace 'vpc_id' Name.Attribute @@ -81,7 +81,7 @@ resource "aws_security_group" "allow_tls" { '"allow_tls"' Name.Variable ' ' Text.Whitespace '{' Punctuation -'\n' Text +'\n' Text.Whitespace ' ' Text.Whitespace 'name' Name.Attribute diff --git a/tests/snippets/terraform/test_types.txt b/tests/snippets/terraform/test_types.txt index b1a15d74..b6892448 100644 --- a/tests/snippets/terraform/test_types.txt +++ b/tests/snippets/terraform/test_types.txt @@ -17,7 +17,7 @@ variable "set-str" { '"consul"' Name.Variable ' ' Text.Whitespace '{' Punctuation -'\n' Text +'\n' Text.Whitespace 'data' Keyword.Reserved ' ' Text.Whitespace @@ -26,35 +26,35 @@ variable "set-str" { '"example"' Name.Variable ' ' Text.Whitespace '{' Punctuation -'\n' Text +'\n' Text.Whitespace 'module' Keyword.Reserved ' ' Text.Whitespace '"consul"' Name.Variable ' ' Text.Whitespace '{' Punctuation -'\n' Text +'\n' Text.Whitespace 'output' Keyword.Reserved ' ' Text.Whitespace '"instance_ip_addr"' Name.Variable ' ' Text.Whitespace '{' Punctuation -'\n' Text +'\n' Text.Whitespace 'provider' Keyword.Reserved ' ' Text.Whitespace '"aws"' Name.Variable ' ' Text.Whitespace '{' Punctuation -'\n' Text +'\n' Text.Whitespace 'provisioner' Keyword.Reserved ' ' Text.Whitespace '"local-exec"' Name.Variable ' ' Text.Whitespace '{' Punctuation -'\n' Text +'\n' Text.Whitespace 'resource' Keyword.Reserved ' ' Text.Whitespace @@ -63,21 +63,21 @@ variable "set-str" { '"base_igw"' Name.Variable ' ' Text.Whitespace '{' Punctuation -'\n' Text +'\n' Text.Whitespace 'variable' Keyword.Reserved ' ' Text.Whitespace '"aws_region"' Name.Variable ' ' Text.Whitespace '{' Punctuation -'\n' Text +'\n' Text.Whitespace 'variable' Keyword.Reserved ' ' Text.Whitespace '"set-str"' Name.Variable ' ' Text.Whitespace '{' Punctuation -'\n' Text +'\n' Text.Whitespace ' ' Text.Whitespace 'type' Name.Attribute diff --git a/tests/snippets/terraform/test_variable_declaration.txt b/tests/snippets/terraform/test_variable_declaration.txt index abff221a..72e515e1 100644 --- a/tests/snippets/terraform/test_variable_declaration.txt +++ b/tests/snippets/terraform/test_variable_declaration.txt @@ -11,7 +11,7 @@ variable "aws_region" { '"aws_region"' Name.Variable ' ' Text.Whitespace '{' Punctuation -'\n' Text +'\n' Text.Whitespace ' ' Text.Whitespace 'description' Name.Attribute diff --git a/tests/snippets/terraform/test_variable_read.txt b/tests/snippets/terraform/test_variable_read.txt index a90ddcca..25afcf4d 100644 --- a/tests/snippets/terraform/test_variable_read.txt +++ b/tests/snippets/terraform/test_variable_read.txt @@ -9,7 +9,7 @@ provider "aws" { '"aws"' Name.Variable ' ' Text.Whitespace '{' Punctuation -'\n' Text +'\n' Text.Whitespace ' ' Text.Whitespace 'region' Name.Attribute |