summaryrefslogtreecommitdiff
path: root/pygments/lexers/c_cpp.py
Commit message (Collapse)AuthorAgeFilesLines
* Update copyright year (fixes #1514.)Matthäus G. Chajdas2020-08-221-1/+1
|
* General improvement to the C/C++ lexer (#1350)Hubert Gruniaux2020-05-221-35/+126
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * General improvement to the C/C++ lexer * Add missing C11 keywords Add '_Imaginary', '_Static_assert', '_Atomic' keywords. * Highlight C11 std atomic types (#906) Add support for C11 atomic types `atomic_*`. * Extended character literals prefixes for C/C++ Add support for `u'a'`, `U'a'` (C++11, C11), and `u8'a'` (C++17, C2x). [Reference](https://en.cppreference.com/w/cpp/language/character_literal). [Reference](https://en.cppreference.com/w/c/language/character_constant). * Fix bad floating point highlighting in C lexer Fix bad highlighting for `5.`, where `.` was not highlighted. * Fix hex floating literal highlighting in C Hexadecimal floating point literals needs an exponent (`0x5p8`). Before this commit, event floating-point literals without an exponent were accepted (e.g. `0x5.5`). * Support '$' in identifiers, C/C++ Some old C/C++ compilers have supported `$` (dollar sign) in identifiers, and some news continue to support this for legacy reasons. That is, some codes may use them, and it is therefore preferable to color them correctly. * Cleaning and fixing some bugs in C/C++ lexer - Add '_Pragma' keyword - Recognize the identifier following 'typename' as Name.Class - Do not tokenize 'class' or 'struct' following 'enum' as Name.Class, but instead as Keyword (C++ lexer) - Move some C++ keywords to the generic lexer (`alignas`, `alignof`, etc...) - Add some C keywords (`noreturn`, `imaginary`, `complex`) - And others things... * Fix building errors in C/C++ lexer * Fix bug in C/C++ Now `class`, `struct`, `enum`, `union`, etc... can be used alone. Previously, the lexer do not recognizes them if they are not followed by an identifier. This regression was introduced in https://github.com/pygments/pygments/pull/1350/commits/013bf6af2777f6ba444e2c8e3a8ca3ad1bb1e674 by me. * Reuse old states names for C/C++ Some lexers depends on the old states names (e.g. `classname` state) to works. This commit, reintroduce these old names. * Improve C/C++ lexer documentation * Correct english errors in C lexer documentation * Cleaning and Unicode literals for C * Move Unicode literals from C++ to generic C * Remove useless 'classname' state in ECLexer * Revert "Remove useless 'classname' state in ECLexer" This reverts commit 89a0c138fbcc70883d8035b0585b7e94e49f73cc. * Revert "Revert "Remove useless 'classname' state in ECLexer"" This reverts commit 2d4734308a813abec6a17ea7fa6eb3a0b6f57939. * Add support for UCNs in C and C++ * Apply correction from #1162 Solves #1162 * Correctly highlights negatives numbers in C++ * Revert some changes from 8fe8ed6 * Add unicode suffixes to C++ raw string literals * Solves #1166 * Fix previous regression in C like lexer * Fix invalid regex in C like lexer * Fix #1396 and now are identifiers support UCNs in C and C++ lexer * Update AUTHORS * Add missing Python raw string prefix Co-authored-by: Hubert Gruniaux <42495291+HubertGruniaux@users.noreply.github.com>
* Update c_cpp.py to adds support for C++20 keywordsHubert Gruniaux2020-01-051-2/+3
| | | The soon C++20 newcomer standard will introduce lots of new keywords like `constinit`, `co_yield` (for courotines), `import` or`module` (for modules, however these are special identifiers instead of real keywords), etc...
* Update project to use modern Python features and idiomsJon Dufresne2019-11-251-6/+6
| | | | | | | | | | Run the pyupgrade tool across the project to use modern language features. - Use set literals - Use dict comprehension - Remove unnecessary numeric indexes in format string - Remove unnecessary extra parentheses
* Fixup all headers and some more minor problems.2.4.2Georg Brandl2019-05-281-1/+1
|
* Fix more instances of invalid string escapesGeorg Brandl2018-11-281-4/+4
| | | | Also, raise on warnings from Pygments only.
* Copyright update.Georg Brandl2017-01-221-1/+1
|
* Add support for partials and path segments for Handlebars.Christian Hammond2016-11-041-0/+252
This introduces support for some missing features to the Handlebars lexer: Partials and path segments. Partials mostly appeared to work before, but the `>` in `{{> ... }}` would appear as a syntax error, as could other components of the partial. This change introduces support for: * Standard partials: `{{> partialName}}` * Partials with parameters: `{{> partialName varname="value"}}` * Ddynamic partials: `{{> (partialFunc)}}` * Ddynamic partials with lookups: `{{> (lookup ../path "partialName")}}` * Partial blocks: `{{> @partial-block}}` * Inline partials: `{{#*inline}}..{{/inline}}` It also introduces support for path segments, which can reference content in the current context or in a parent context. For instance, `this.name`, `this/name`, `./name`, `../name`, `this/name`, etc. These are all now tracked as variables.