1
0
mirror of https://github.com/alecthomas/chroma.git synced 2025-02-21 19:06:18 +02:00

102 Commits

Author SHA1 Message Date
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
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
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
Pedro Loureiro
fb0b720d14
Kotlin improvements around string interpolation, escaping, and generics (#392) 2020-08-28 10:26:29 +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
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
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
nprindle
11501493c9 Fix TypeScript keywords
strict mode keywords to highlight:

- yield
- package

contextual keywords to highlight:

- Keyword:
    - asserts
    - await
    - infer
    - is
    - keyof
    - of
- KeywordReserved:
    - async
    - get
    - namespace
    - readonly
    - require
    - set
    - type
    - from
    - global
- KeywordType:
    - any
    - never
    - object
    - symbol
    - unique
    - unknown
    - bigint

stop highlighting:

- AS
- char
- byte
- native
- short
- synchronized
- throws
- transient
- volatile
- sun
- netscape
- int
- float
- long
- double

Fix tsx test data for new 'from' highlighting
2020-06-24 10:36:27 +10:00
Thomas Tay
57c1bd941c
Added pony lexer (#372) 2020-06-12 14:05:39 +10:00
Francis Lavoie
8785122ef8 Additional fixes for placeholders 2020-05-17 16:39:13 +10:00
Francis Lavoie
155bdea915 Update Caddyfile lexer to fix edgecases and improve colouring 2020-05-17 16:39:13 +10:00
Robin Thrift
bd463054be Add Zig lexer
Add a lexer for the Zig language (https://ziglang.org) based on the
pygments Zig lexer.
2020-05-16 21:36:07 +10:00
Francis Lavoie
68968043c3
Add Caddyfile lexer (#363) 2020-05-16 19:35:57 +10:00
Daniel G. Taylor
4065717136 feat: support HTTP/2 in HTTP lexer 2020-05-14 14:06:46 +10:00
thomas
2612dee604 add yaml test cases for more bool types and multi-line flow scalars. 2020-05-12 08:40:47 +10:00
thomas
2b9c82d89f yaml parse multiline block scalars as single StringDoc 2020-05-12 08:40:47 +10:00
thomas
684c267d74 yaml parse plan scalar values as literals rather than text. 2020-05-12 08:40:47 +10:00
thomas
705c61c909 yaml parse --- and ... as NameNamespace 2020-05-12 08:40:47 +10:00
thomas
0d4fb389ce yaml parse keys as NameTag rather than Keyword 2020-05-12 08:40:47 +10:00
Cameron Little
8c4fe7e59f Add failing test case for single # in bash 2020-05-11 22:26:13 +10:00
Michael Kohl
6b8ef36ed9 Add ReasonML lexer 2020-05-04 08:51:58 +10:00
Michael Barz
82f38b96ec
add gherkin lexer (#354) 2020-05-02 08:59:58 +10:00
Tristan Menzel
0da4bd1471 Adds support for jsx blocks in typescript lexer
Adds support for jsx tags with a period in their name
Adds support for jsx fragments (<></>)
2020-04-20 12:39:21 +10:00
GRIBOK
28041a86ba
Add YANG lexer (#348)
* add yang lexer. See alecthomas/chroma#347

* Alphabetise all keywords in yang lexer
2020-04-14 18:36:08 +10:00
Alec Thomas
4f3623dce6 Fallback to HTML lexer for Markdown text.
Fixes #321.
2020-03-05 15:06:04 +11:00
Edgar Lee
e5d9650a20
Add hlb lexer (#332) 2020-02-26 21:03:38 +11:00
Adrian Gao
866d0c8fb5
Add lexer for SAS language (#337) 2020-02-26 20:57:32 +11:00
Orhan Hirsch
e54a758d06 Add testdata for terraform 2020-02-22 09:47:32 +11:00
Amos Wenger
0f6a31d4cd rust: support raw identifiers
See https://doc.rust-lang.org/edition-guide/rust-2018/module-system/raw-identifiers.html
2020-01-10 10:04:37 +11:00
Alec Thomas
2d9ac06785 Fix PowerShell error on drive letters.
Fixes #312.
2019-12-07 19:00:42 -08:00
κeen
67fb64311a add SML lexer (#310) 2019-12-01 23:17:22 -08:00
jpienaar
ec2ba48433 Add lexer for LLVM TableGen (#311) 2019-12-01 20:15:03 -08:00
jpienaar
15c7468f37 Add simple MLIR lexer (#308)
* Add simple MLIR lexer

* Add simple MLIR lexer

Use sample.mlir from https://github.com/jpienaar/mlir-grammar
2019-11-30 14:29:49 -08:00
Ghislain Bourgeois
3b4f493cc3 Add basic keyword highlighting for YAML 2019-11-28 10:31:21 +11:00
Alec Thomas
3aaf3e542f Fix Java lexer (synced with latest Pygments).
Fixes #297.
2019-11-05 13:57:51 +11:00
Alec Thomas
bbc59ac372 Emit error tokens when there's a group mismatch.
Also don't panic/recover, as we no longer use panic to report "real"
errors.

Fixes #295.
2019-10-24 17:03:35 +11:00
Sean McGivern
a1c4eaa235 Add J lexer
Generated with _tools/pygments2chroma.py.

Sample `toupper` verb from `stdlib.ijs`:
https://github.com/jsoftware/jsource/blob/j808-release/jlibrary/system/main/stdlib.ijs
2019-10-22 07:23:06 +11:00
Alec Thomas
b618823c9b Add bibtex support.
Fixes #271.
2019-10-06 18:10:54 +11:00
matthias
8eb6aa7fb6 Add Language Igor (#276)
* Add Language Igor

Igor is a scientific language developed by
[WaveMetrics](https://www.wavemetrics.com/).

This lexer was translated directly from the [pygments
lexer](http://pygments.org/docs/lexers/#lexers-for-igor-pro) without any
changes. The pygments lexer is very basic but working properly for most
of the cases.
2019-09-23 09:35:48 +10:00
Jos512
d122d30d7b Add ABAP lexer 2019-09-20 07:52:50 +10:00