1
0
mirror of https://github.com/alecthomas/chroma.git synced 2025-02-09 13:23:51 +02:00

516 Commits

Author SHA1 Message Date
Siavash Askari Nasr
d4eca2a5b3
Svelte Lexer Improvements (#478) 2021-04-28 17:34:34 +10:00
Alec Thomas
3626d89d3e Fix lint. 2021-04-28 09:59:01 +10:00
Vukašin Manojlović
575caac139 Improve lexer for Solidity 2021-04-28 09:56:06 +10:00
Vukašin Manojlović
cab6ebcf1b Add basic lexer for Svelte 2021-04-28 09:54:44 +10:00
Zhangyuan Nie
e86123a191 better markdown lexer 2021-04-28 08:56:27 +10:00
Siavash Askari Nasr
9de08fc6c8
Add Raku lexer (#476) 2021-04-28 08:55:14 +10:00
Pablo Seminario
9866a75161 Fix a typo into the lables regex for PromQL lexer
The correct label matching operator is `!~` instead of `~!`.
2021-04-25 08:01:36 +10:00
Pablo Seminario
b790655195 Fix PromQL lexer to support values enclosed within single quotes
Values for labels could now be enclosed within single or double quotes.
2021-04-25 08:01:36 +10:00
Guillermo León
d11bdacff4 Add AL lexer 2021-04-24 08:00:45 +10:00
jmert
f4cddf039f
Update Julia syntax highlighting from pygments (#472) 2021-04-18 14:00:13 +10:00
Lee Holmes
41b886a7fd Simplify the cmdlet ("NameBuiltin") rule
This change simplifies the NameBuiltin pattern for cmdlets so that it highlights all cmdlets (i.e.: Invoke-Foobar) and not just ones built into PowerShell. It also places these as higher priority than language keywords, so you don't get odd formatting for Foreach-Object and similar.
2021-04-10 12:50:44 +10:00
Carl Gay
eb257ed1bb Add a Dylan lexer 2021-04-07 15:27:41 +10:00
Steven Penny
7a68f3e25d LiteralNumberHex: underscore support
Most languages allow for underscore in number literals. Fix support for a few
languages. References:

- https://docs.python.org/reference/lexical_analysis.html#integer-literals
- https://golang.org/ref/spec#Integer_literals
- https://php.net/language.types.integer
2021-03-03 12:57:43 +11:00
Alec Thomas
e6d871d955 Support lone '$' in Go templates. 2021-02-08 12:24:52 +11:00
Koki Fukuda
c49d52b472 Add mcfunction lexer 2021-02-08 12:17:35 +11:00
Cameron Moore
59126c5b32
Add NewLazyLexer to defer rules definitions and reduce init costs (#449)
Add NewLazyLexer and MustNewLazyLexer which accept a function that
returns the rules for the lexer.  This allows us to defer the rules
definitions until they're needed.

Lexers in a, g, s, and x packages have been updated to use the new lazy
lexer.
2021-02-08 12:16:49 +11:00
Alec Thomas
5da831672d Fix a few bugs including sub-lexers adding additional newlines when
EnsureNL is true.
2021-02-06 20:13:50 +11:00
Alec Thomas
2a1e1a1bf4 Add EnsureNL to C/Java lexers.
Fixes #396.
2021-02-06 11:56:46 +11:00
Kenneth Shaw
7dbcddc70e Change Text token to TextWhitespace token in SQL lexers
For consistency with other lexers, convert the Text token on whitespace
to TextWhitespace.
2021-01-26 17:02:28 +11:00
Carlos Henrique Guardão Gandarez
898761d8ab Move lexers to correct folders 2021-01-05 06:26:36 +11:00
nocd5
5b9087ac14 Fix CSS lexer
Fix function that include parenthesis shows a wrong error
2020-12-24 06:54:06 +11:00
silverwind
b351ea7b29 Add various alternate file extensions to lexers
These should be pretty clear cases.
2020-12-03 10:47:43 +11:00
Steven Penny
881d54f096 Improve number literals for several languages
Using these examples:

~~~
0x21
1_000
1e3
~~~

Several languages failed that support these syntax. Here are ones I found:

Lexer      | 0x21 | 1_000 | 1e3
-----------|------|-------|-----
C#         | fail | fail  | fail
Go         |      | fail  |
JavaScript |      | fail  | fail
PHP        |      | fail  |
Python     |      | fail  |
Ruby       |      |       | fail

I fixed these issues, and added tests.
2020-11-22 08:30:29 +11:00
Pablo SEMINARIO
eb0e31fc05 Add PromQL lexer
It also includes several test examples
2020-11-11 17:15:50 +11:00
Steven Penny
552ad244cf Rust multi-line strings
Quoting Rust documentation

> Line-breaks are allowed in string literals. A line-break is either a newline
> (U+000A) or a pair of carriage return and newline (U+000D, U+000A).

https://doc.rust-lang.org/reference/tokens.html#string-literals
2020-11-07 07:49:09 +11:00
Yuki Okushi
9eb358bc3f
Update Rust keywords/types (#419)
* Remove unreserved keywords

* Add some newer keywords and types

* Harden Rust lexer test
2020-10-31 08:01:35 +11:00
nyaayaya
9b3cf51c84 zig: Detect visual separators in integer literals
Zig docs: "// underscores may be placed between two digits as a visual
separator"
2020-10-30 22:50:45 +11:00
Alec Thomas
05ac2f71fd Revert "Zig: Detect visual separators in integer literals"
This reverts commit d2a1cc462b640250dac9280a009269e8a8bbf917.
2020-10-29 19:23:01 +11:00
nyaayaya
d2a1cc462b Zig: Detect visual separators in integer literals
Zig docs: "// underscores may be placed between two digits as a visual
separator"
2020-10-29 14:01:03 +11:00
Steven Penny
639fa3adc4
JavaScript: String Single Character Escape Sequences (#415)
https://tc39.es/ecma262#table-string-single-character-escape-sequences
2020-10-25 12:48:00 +11:00
Jeremy Bolding
4453913798 Rewote Lexer & Added Stylus Tests 2020-10-23 11:06:37 +11:00
Jeremy Bolding
ab89a09e29 Added Stylus Language Support 2020-10-23 11:06:37 +11:00
silverwind
e79405b3cd add *.env to bash lexer 2020-10-06 11:10:49 +11:00
Carl Schwan
c88ec01ff7 Add QML lexer 2020-09-29 04:41:36 -07:00
Alberto Marchetti
42e9638ed4 Support comma in go template (e.g. for range)
```
{{ range $idx, $value := $variable }}
Hello {{ $idx }}
{{ end }}
```
2020-09-22 23:22:36 -07:00
Alberto Marchetti
6665753f98
Improved support for Go templates (#401) 2020-09-23 09:27:49 +10:00
thomas
290ff860b9 yaml: block scalar multiline improvements. 2020-09-09 19:43:07 -07:00
thomas
d65f279810 yaml: inline comments after literals 2020-09-05 15:28:49 -07:00
Tiemen Waterreus
2365845022 Improve Elixir lexer based on Pygments
It appears that not all the rules from the Pygments Elixir lexer were
correctly ported over to Chroma. It was missing mostly the keywords and
declarations that are processed in the `get_tokens_unprocessed` function of the
Pygments Elixir lexer.

This commit adds the missing lines to the Elixir lexer and updates the
tests accordingly.
2020-09-03 01:57:33 -07:00
Jean-Philippe Guérard
6d6e9cd020 Update the awk lexer to better support gawk
- Add the missing keywords (see
   https://www.gnu.org/software/gawk/manual/gawk.html#POSIX_002fGNU ).
 - Add support for indirect functions ("@x()").
 - Add support for the bidirectional pipe ("|&").
2020-08-30 03:36:18 -07:00
Pedro Loureiro
fb0b720d14
Kotlin improvements around string interpolation, escaping, and generics (#392) 2020-08-28 10:26:29 +10:00
Pedro Loureiro
86ebaf326b Remove unintended changes 2020-08-12 09:04:18 +10:00
Pedro Loureiro
aac329441b Fix regex from as? to as\?; add one more test case for !== 2020-08-12 09:04:18 +10:00
Pedro Loureiro
8a54f9ea89 add many operators to kotlin 2020-08-12 09:04:18 +10:00
Pedro Loureiro
8d0d2b8e55 Add more keywords to kotlin lexer 2020-08-12 09:04:18 +10:00
Joe Mooring
477ad4aefd Add await and async keywords to jsx and javascript
Closes #385
2020-07-28 22:57:04 +10:00
mrsdizzie
4da591c8f6 Use EnsureNL for go lexer
To allow proper detection of single line comments when there is no \n

Fixes #380
2020-07-16 08:45:39 +10:00
silverwind
5756434ec2 Add .editorconfig to ini lexer
`.editorconfig` files [are ini](https://editorconfig.org/#file-format-details). Also tested on the playground and looks well.
2020-07-03 08:17:32 +10:00
thargor
bac6996317 added curly braces to toml lexer 2020-06-30 21:01:17 +10:00
Alec Thomas
2b9ea60d89 Split PHP into two lexers - PHP and PHTML.
The former is pure PHP code while the latter is PHP code in <? ?> tags,
within HTML.

Fixes #210.
2020-06-30 21:00:09 +10:00