diff options
| author | amitkummer <49096391+amitkummer@users.noreply.github.com> | 2022-03-12 16:00:31 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-03-12 15:00:31 +0100 |
| commit | 62dd19e9d3e0400fff0aeddabae490797425c87e (patch) | |
| tree | e3883dafbe0fcdce2a9932282ddc07860b55c346 /tests/examplefiles/ragel-cpp | |
| parent | 6e07d3f31654c67881e39f0342d024e12e91a667 (diff) | |
| download | pygments-git-62dd19e9d3e0400fff0aeddabae490797425c87e.tar.gz | |
CFamily: Lex identifiers after `case` as constants (#2084)
* Lex identifiers after `case` as constants
Add a state for marking identifiers preceded by a `case` keyword as
constants.
Additionally, refactor the `label` rule to no longer permit a `case`
keyword before a label.
Consequentially, identifiers after a `case` keyword (like `foo` in
`case foo:`) are no longer wrongly lexed as `Name.Label`, but as
`Name.Constant`.
In addition, this fixes #2076, as multiple `case` keywords in one
line are lexed the same.
* Add test for multiple `case` keywords in one line
* Fix existing tests
* Lex `::` as Operator and not Name.Constant
After a `case`, when lexing a namespaced name, like `foo::bar`, lex the
namespace operator `::` as Operator, and not Name.Constant.
* Regenerate tokens
Diffstat (limited to 'tests/examplefiles/ragel-cpp')
| -rw-r--r-- | tests/examplefiles/ragel-cpp/ragel-cpp_rlscan.output | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/tests/examplefiles/ragel-cpp/ragel-cpp_rlscan.output b/tests/examplefiles/ragel-cpp/ragel-cpp_rlscan.output index 5c22624b..5dfa7b66 100644 --- a/tests/examplefiles/ragel-cpp/ragel-cpp_rlscan.output +++ b/tests/examplefiles/ragel-cpp/ragel-cpp_rlscan.output @@ -94,7 +94,7 @@ "'" Literal.String.Char '<' Literal.String.Char "'" Literal.String.Char -':' Operator +':' Punctuation ' ' Text.Whitespace 'cout' Name ' ' Text.Whitespace @@ -116,7 +116,7 @@ "'" Literal.String.Char '>' Literal.String.Char "'" Literal.String.Char -':' Operator +':' Punctuation ' ' Text.Whitespace 'cout' Name ' ' Text.Whitespace @@ -138,7 +138,7 @@ "'" Literal.String.Char '&' Literal.String.Char "'" Literal.String.Char -':' Operator +':' Punctuation ' ' Text.Whitespace 'cout' Name ' ' Text.Whitespace @@ -227,7 +227,7 @@ "'" Literal.String.Char '<' Literal.String.Char "'" Literal.String.Char -':' Operator +':' Punctuation ' ' Text.Whitespace 'cout' Name ' ' Text.Whitespace @@ -249,7 +249,7 @@ "'" Literal.String.Char '>' Literal.String.Char "'" Literal.String.Char -':' Operator +':' Punctuation ' ' Text.Whitespace 'cout' Name ' ' Text.Whitespace @@ -271,7 +271,7 @@ "'" Literal.String.Char '&' Literal.String.Char "'" Literal.String.Char -':' Operator +':' Punctuation ' ' Text.Whitespace 'cout' Name ' ' Text.Whitespace @@ -392,7 +392,7 @@ "'" Literal.String.Char '<' Literal.String.Char "'" Literal.String.Char -':' Operator +':' Punctuation ' ' Text.Whitespace 'cout' Name ' ' Text.Whitespace @@ -414,7 +414,7 @@ "'" Literal.String.Char '>' Literal.String.Char "'" Literal.String.Char -':' Operator +':' Punctuation ' ' Text.Whitespace 'cout' Name ' ' Text.Whitespace @@ -436,7 +436,7 @@ "'" Literal.String.Char '&' Literal.String.Char "'" Literal.String.Char -':' Operator +':' Punctuation ' ' Text.Whitespace 'cout' Name ' ' Text.Whitespace |
