This repository has been archived on 2024-06-20. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
coffee.pygments/tests/examplefiles/c
amitkummer 62dd19e9d3
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
2022-03-12 15:00:31 +01:00
..
ceval.c Also add auto-updatable output-based tests to examplefiles (#1689) 2021-01-20 10:48:45 +01:00
ceval.c.output CFamily: Lex identifiers after case as constants (#2084) 2022-03-12 15:00:31 +01:00
example.c Also add auto-updatable output-based tests to examplefiles (#1689) 2021-01-20 10:48:45 +01:00
example.c.output CFamily: Lex identifiers after case as constants (#2084) 2022-03-12 15:00:31 +01:00
labels.c CFamily: Lex identifiers after case as constants (#2084) 2022-03-12 15:00:31 +01:00
labels.c.output CFamily: Lex identifiers after case as constants (#2084) 2022-03-12 15:00:31 +01:00
numbers.c Also add auto-updatable output-based tests to examplefiles (#1689) 2021-01-20 10:48:45 +01:00
numbers.c.output Use the correct whitespace token for the C family. 2021-06-20 11:42:04 +02:00