| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This fixes an issue where in code like this:
```
int foo(float bar) // hello() {}
```
The lexer would match `(float bar) // hello()`
as the parameters of the function `foo`, instead
of just `(float bar)`.
In addition, a similar test case to what was originally
reported in #2208 is added.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
| |
Co-authored-by: Jean Abou Samra <jean@abou-samra.fr>
|
|
|
|
|
|
|
|
| |
This commit adds a new url field to a lexer, which can be used to link
to the language website, instead of relying on having the link in either
languages.rst or the docstring of the lexer. Additionally, it changes the
languages.rst file to auto-generate the list of lexers from the actual
source code, using the provided URL.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Remove unused variable
This variable is unused since the first commit to this file
in the commit history, so it's probably safe to remove it.
* Lex identifier as label only if it's at line start
* Stop matching identifiers that begin with a digit
This is so we don't match numbers as labels with the new labels rule.
* Add label tests
* Fix existing tests
|
|
|
|
| |
Detect function with return types of more than a single word length
(like `unsigned int` or `long long`).
|
| |
|
| |
|
|
|
|
|
| |
* Fix #1237 cpp whitespace token usage expanded
* Adapt tests change to 3eff56f5
|
|
|
|
| |
The CFamilyLexer was matching whitespace as Text instead of Whitespace.
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Remove duplicate lines in state
* Refactor ident regex for readability
Refactor ident regex changed in c1a0d82 to improve readability.
Refactor namespaced_ident regex added in c1a0d82 to improve readability.
* Fix inline keword lexing
* Fix indentation
* Refactor CLexer keywords to 'keywords' state
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Fix lexing of function names
This fixes #1561.
Add a keywords state that matches inside and outside functions for
keywords.
Before this, when a keyword would appear the lexer would go to the
statements state, in which functions were not matched.
* Add tests for lexing of function names
* Unbreak previous tests
* Allow namespaced names in function statements
Add a second identifiers regex that matces all the previous identifiers
and also '::'.
I took the decision to create a second identifiers regex with '::'
inside, simply because using the old identifiers regex would hurt
performance massively on every solution I tried to craft.
* Add tests for namespaced names in functions
* Unbreak previous tests
* Add support for namespaces in namespace declarations
Add a namespace state that is entered each time the namespace keyword
is matched and lexes all name matches as namespaces.
Cases this approach doesn't cover:
* Namespaces in using declarations.
* Namespaces that prefix names in random code.
Unfortunately, in both of these cases the names before and after '::'
are not always namespaces.
* Add tests for namespace declartions
* Unbreak previous tests
* Tidy functions regex
Remove group nesting that became unneeded after fc56ab8 (the last big
refactor).
* Remove f string usage I introduced by mistake
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
pyupgrade is a tool to automatically upgrade syntax for newer versions
of the Python language.
The project has been Python 3 only since
35544e2fc6eed0ce4a27ec7285aac71ff0ddc473, allowing for several cleanups:
- Remove unnecessary "-*- coding: utf-8 -*-" cookie. Python 3 reads all
source files as utf-8 by default.
- Replace IOError/EnvironmentError with OSError. Python 3 unified these
exceptions. The old names are aliases only.
- Use the Python 3 shorter super() syntax.
- Remove "utf8" argument form encode/decode. In Python 3, this value is
the default.
- Remove "r" from open() calls. In Python 3, this value is the default.
- Remove u prefix from Unicode strings. In Python 3, all strings are
Unicode.
- Replace io.open() with builtin open(). In Python 3, these functions
are functionally equivalent.
Co-authored-by: Matthäus G. Chajdas <Anteru@users.noreply.github.com>
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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>
|
|
|
| |
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...
|
|
|
|
|
|
|
|
|
|
| |
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
|
| |
|
|
|
|
| |
Also, raise on warnings from Pygments only.
|
| |
|
|
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.
|