| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
This is simpler and more reliable than hand-coding the state machine.
Fixes #2411
|
|
|
|
| |
valid (#2410)
|
| |
|
| |
|
| |
|
|
|
| |
callable and aiter.
|
|
|
|
|
| |
Fixes #2329
Fixes #2226
|
|
|
|
|
|
|
|
|
| |
This triggers a new case in the HtmlFormatter, which emits an empty span
at the end of the line for a new line, as those are removed by the
split-by-parts code. This requires separate post-processing.
Doesn't fix all whitespace issues with Python either, but we're done to
360 failing examples with that, from previously >400.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
Disable highlighting of unicode escape codes in python bytes literals,
as described in
https://docs.python.org/3/reference/lexical_analysis.html#string-and-bytes-literals.
So escape codes of the form "\N{name}", "\uxxxx" and "\Uxxxxxxxx" will
no longer be highlighted within bytes literals. Add tests for escape
code highlighting in string and bytes literals.
|
|
|
| |
EncodingWarning was added in 3.10: https://docs.python.org/3/library/exceptions.html#EncodingWarning
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
|\
| |
| | |
Python: lex soft keywords
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Some notes:
- This approach is not perfect, but it's rather simple and I can't
think of an edge case.
- I did not use the `words` function to create the regex matching the
keywords list, because it returns a capturing group (`()`) and it
needs to be non-capturing here (because of `bygroups` usage).
- I chose to go to the 'soft-keywords-inner' state after both
`match` and `case`, even though it's unnecessary for `match`
(the inner state catches the `_` wildcard keyword which appears
only after a `case`).
This is mostly harmless and saves us from writing the 'soft-keywords'
regex twice each for `match` and `case` with the extra inner state
just for `case`.
The only piece of code this will lex incorrectly is `match _:`
(`_` will be lexed as keyword). I doubt though that pattern mathcing
will be used like this.
|
|/
|
|
| |
Since https://github.com/python/cpython/pull/27037, they can include
tildes in addition to the carets.
|
|
|
|
| |
Fixes #1918
|
|
|
|
|
|
|
|
|
|
| |
Support both single carets for syntax errors (Python 2 and 3)
and fine-grained error locations with several carets (Python 3.11+).
Previously, the carets were highlighted as operators. This uses
a new token, Token.Punctuation.Marker. For now, no style supports
it specifically. In the future, styles might start differentiating
it from Token.Punctuation.
[Closes #1850.]
|
|
|
|
|
|
|
|
|
| |
* lexers: python: add test cases for floats
* lexers: python: fix float lexing
* lexer:python:fixed test syntax
Co-authored-by: Aidan Do <giahuydo99@gmail.com>
|
|
|
|
| |
Add bint, Py_ssize_t.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
| |
* introduce and apply rfstringescape
* add unit test for raw f-strings
* add further tests
* fix comment
|
| |
|
| |
|
|
|
|
| |
fixes #1548
|
|
|
|
|
|
|
|
|
|
|
| |
* all: remove "u" string prefix
* util: remove unirange
Since Python 3.3, all builds are wide unicode compatible.
* unistring: remove support for narrow-unicode builds
which stopped being relevant with Python 3.3
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
fixes #1444
|
|\
| |
| | |
Python f-strings: highlight expressions in curly braces
|
| |
| |
| |
| | |
Fixes #1228
|
|/ |
|
|
|
|
|
|
|
| |
- The walrus operator, also known as assignment expressions, was introduced in Python 3.8
- Moves the Token.Operator matching root above Token.Punctuation so the walrus operator takes precedence
- Includes a test to make sure this behavior doesn't regress since it's sensitive to the order of expressions
- Fixes #1381
|
|
|
|
| |
Fixes #1156
|
|
|
|
|
| |
As the language develops further, having to override more and
more of the Python 2 lexer tokens makes no sense anymore.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
Fixes #976
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
Closes #1183.
Testing Done:
- `pygmentize -f html -O full foo.bzl > foo.html`; opened foo.html in a
browser
|
|
|
|
| |
i.e. make it Keyword.Namespace
|
| |
|