summaryrefslogtreecommitdiff
path: root/tests/snippets/c
Commit message (Collapse)AuthorAgeFilesLines
* Updates C and C++ lexers (#2422)Christopher Di Bella2023-04-261-0/+13
| | | | | | | | | | | * replaces `restrict` with `__restrict` in C++ `restrict` isn't a C++ keyword, but `__restrict` is recognised by Clang, GCC, and MSVC as a language extension. * adds `_BitInt` and `__int128` as C and C++ types * `_BitInt` is a new C type and an extended integral type for C++. * `__int128` is an extended integral type on both Clang and GCC.
* CFamilyLexer: refuse quotes between parentheses for function definitions and ↵Jean Abou-Samra2022-08-151-0/+41
| | | | | | | | | | | | | | | | | | | | | | | | declarations (#2208) Something like id id2("){ ... }"); is no longer wrongly recognized as a "function" id id2(") { ... } "); As the difference in the tests shows, this has the unfortunate side effect that we no longer highlight something like int f(param="default"); as a function declaration, but it is hard to imagine another way to fix this (cf. “most vexing parse” problem). Fixes #2207
* Fix comments within function declarations in C (#1891) (#2140)lambda-karlculus2022-05-301-0/+409
| | | Co-authored-by: Jean Abou Samra <jean@abou-samra.fr>
* CFamily: Lex identifiers after `case` as constants (#2084)amitkummer2022-03-122-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* Fix #1237 cpp whitespace token usage expanded (#1904)Sebastian Engel2021-10-021-1/+1
| | | | | * Fix #1237 cpp whitespace token usage expanded * Adapt tests change to 3eff56f5
* Use the correct whitespace token for the C family.Matthäus G. Chajdas2021-06-2012-88/+88
| | | | The CFamilyLexer was matching whitespace as Text instead of Whitespace.
* Fix CFamilyLexer preprocessor tokenization errors (#1830)Henrik Lievonen2021-06-203-0/+50
| | | | | | | | | | | | CFamilyLexer failed to tokenize preprocessor macros when they were preceded by line break surrounded by spaces. This was the case because prerpocessor regex rule expected to start at the beginning of the line, but the space regex rule matched also the whitespace after the line break. Now the space rule has been refined not to match the line break. Because of this, the preprocessor regex rule correctly matches prerpocessor tokens even when they are preceded by white spaces, at the cost of adding some more tokens in the token stream in some cases. This change preserves the behavior of invalid preprocessor usage failing to tokenize.
* Support for OMG IDL (#1595)Fred Hornsey2021-05-022-0/+16
| | | | | | | | | | | | | | | | | | * Support for OMG IDL Lexer for [Object Management Group Interface Definition Language](https://www.omg.org/spec/IDL/About-IDL/). * Allow Whitespace Before include in C Preprocessor It wasn't highlighting the included filename the same as if there was no space before the include, but now it is. * Update omg-idl Tests to Latest Requirements * Update omg-idl versionadded to 2.9 Since I just realized this missed the 2.8 release. * Add Missing Operators to omg-idl
* Fix mishandling '*/' in C/C++ and related (fixes #1695)Georg Brandl2021-01-291-0/+31
|
* Rename "tests/lexers" to "tests/snippets" and update the contributionGeorg Brandl2021-01-208-0/+250
docs to point to both snippets and examplefiles.