Turning `header` patterns into `signature` patterns in all syntax files
was a mistake. The two are different things. In almost all syntax files
those patterns are things like shebangs or <?xml ... ?> or
<!DOCTYPE html5> i.e. things that:
1. can be (and should be) used for detecting the filetype when there is
no `filename` match (and that is actually the purpose of those
patterns, so it's a regression that it doesn't work anymore).
2. should only occur in the first line of the file, not in the first
100 lines or so.
In other words, the old `header` semantics was exactly what was needed
for those filetypes, while the new `signature` semantics makes little
sense for them.
So replace `signature` back with `header` in most syntax files. Keep
`signature` only in C++ and Objective-C syntax files, for which it was
actually introduced.
1. Python decorators begin a compound statement, so they only appear
at the start of a line. So match at the line start to avoid giving
decorator colors to matrix multiplication (@) expressions. Source:
https://docs.python.org/3/reference/compound_stmts.html#function-definitions
2. Python decorators go to the end of the line and might not include
parentheses (for example @functools.cache). So instead of matching
everything until an `(`, just match as many non-`(` characters
as possible---which both catches the @functools.cache example and
allows decorator parameters to fall back to the default color.
3. Instead of hardcoding `brightgreen` (which railscast.micro also
complains about), color decorators as `preproc` (otherwise unused
by the python syntax files, and arguably the right colorscheme
group to be using for syntactic sugars anyway). Note this will
change decorator colors---for example from bright green to kinda
brown on monokai, and from yellow to more of a light orange on
railscast.
* Python syntax: multiline string should be comment.string, not comment
''' delimits multiline strings, not comments
* Python syntax: multiline string should be comment.string, not comment
''' delimits multiline strings, not comments
* Update python3.yaml for python3.10 keywords
* Python3: Add built-in object 'cls'
* Python3: Add the bitwise negation operator ~
* Python3: Add support for hexadeximal and binary numerical literals
* Python3: Rewrite '(__foo__|__bar__)' as '__(foo|bar)__', add known '__i.*__' methods
* Python3: Add __iter__ as a magic method, sort the list of magic methods
* Python3: Numerical literals: Add support for '_', disallow leading 0 for decimals
* fixup! Python3: Numerical literals: Add support for '_', disallow leading 0 for decimals
hex oct and bin have different sets of allowed digits
* Python3: Add support for floating point numbers with optional scientific notation
* Python3: stop single-line strings at EOL
* Python3: Add support for TODO and FIXME in comments
* Python3: Add support for the ^ bitwise xor operator
The python3 syntax had "filename" instead of "filetype"
as the header. This commit also makes standard py extensions
use the python3 highlighting and requires .py2 or a python2
env to use python2 highlighting because python3 is the standard
python now.
Fixes#1592
Use the 'regexp2' library for lookahead and lookbehind in region
start and end regular expressions to support things like closing quotes
that aren't preceded by backslashes.