diff options
author | Matthäus G. Chajdas <Anteru@users.noreply.github.com> | 2022-09-25 18:22:37 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-25 18:22:37 +0200 |
commit | fafb6d7211722068f5fe42db56437e659142d269 (patch) | |
tree | 395445028293f914942780689bb6c0af327a4af7 | |
parent | f4a5d408c7b9ad9a9b7bd54e398eca06a1222cb6 (diff) | |
download | pygments-git-fafb6d7211722068f5fe42db56437e659142d269.tar.gz |
Improve Clay, Autohotkey lexers. (#2248)
Merge consecutive tokens together where possible.
-rw-r--r-- | CHANGES | 1 | ||||
-rw-r--r-- | pygments/lexers/automation.py | 4 | ||||
-rw-r--r-- | pygments/lexers/c_like.py | 2 | ||||
-rw-r--r-- | tests/examplefiles/ahk/demo.ahk.output | 38 | ||||
-rw-r--r-- | tests/examplefiles/clay/example.clay.output | 70 |
5 files changed, 9 insertions, 106 deletions
@@ -37,6 +37,7 @@ Version 2.14.0 (#2223) - Support more filetypes and compression types in `autopygmentize` (#2219) +- Merge consecutive tokens in Autohotkey, Clay Version 2.13.0 -------------- diff --git a/pygments/lexers/automation.py b/pygments/lexers/automation.py index 00f448ea..8730226e 100644 --- a/pygments/lexers/automation.py +++ b/pygments/lexers/automation.py @@ -50,8 +50,8 @@ class AutohotkeyLexer(RegexLexer): ], 'incomment': [ (r'^\s*\*/', Comment.Multiline, '#pop'), - (r'[^*/]', Comment.Multiline), - (r'[*/]', Comment.Multiline) + (r'[^*]+', Comment.Multiline), + (r'\*', Comment.Multiline) ], 'incontinuation': [ (r'^\s*\)', Generic, '#pop'), diff --git a/pygments/lexers/c_like.py b/pygments/lexers/c_like.py index fb09ca8d..7e44270a 100644 --- a/pygments/lexers/c_like.py +++ b/pygments/lexers/c_like.py @@ -126,7 +126,7 @@ class ClayLexer(RegexLexer): ], 'strings': [ (r'(?i)\\(x[0-9a-f]{2}|.)', String.Escape), - (r'.', String), + (r'[^\\"]+', String), ], 'nl': [ (r'\n', String), diff --git a/tests/examplefiles/ahk/demo.ahk.output b/tests/examplefiles/ahk/demo.ahk.output index 6fd1926f..75508307 100644 --- a/tests/examplefiles/ahk/demo.ahk.output +++ b/tests/examplefiles/ahk/demo.ahk.output @@ -1,41 +1,5 @@ '/*' Comment.Multiline -'\n' Comment.Multiline - -'m' Comment.Multiline -'u' Comment.Multiline -'l' Comment.Multiline -'t' Comment.Multiline -'i' Comment.Multiline -'l' Comment.Multiline -'i' Comment.Multiline -'n' Comment.Multiline -'e' Comment.Multiline -' ' Comment.Multiline -'c' Comment.Multiline -'o' Comment.Multiline -'m' Comment.Multiline -'m' Comment.Multiline -'e' Comment.Multiline -'n' Comment.Multiline -'t' Comment.Multiline -'\n' Comment.Multiline - -'m' Comment.Multiline -'s' Comment.Multiline -'g' Comment.Multiline -'b' Comment.Multiline -'o' Comment.Multiline -'x' Comment.Multiline -'(' Comment.Multiline -'c' Comment.Multiline -'o' Comment.Multiline -'m' Comment.Multiline -'m' Comment.Multiline -'e' Comment.Multiline -'n' Comment.Multiline -'t' Comment.Multiline -')' Comment.Multiline -'\n' Comment.Multiline +'\nmultiline comment\nmsgbox(comment)\n' Comment.Multiline '*/' Comment.Multiline '\n' Text diff --git a/tests/examplefiles/clay/example.clay.output b/tests/examplefiles/clay/example.clay.output index dde5f693..2f108b72 100644 --- a/tests/examplefiles/clay/example.clay.output +++ b/tests/examplefiles/clay/example.clay.output @@ -204,18 +204,7 @@ 'assert' Name '[' Punctuation '"' Literal.String -'b' Literal.String -'o' Literal.String -'u' Literal.String -'n' Literal.String -'d' Literal.String -'s' Literal.String -'C' Literal.String -'h' Literal.String -'e' Literal.String -'c' Literal.String -'k' Literal.String -'s' Literal.String +'boundsChecks' Literal.String '"' Literal.String ']' Punctuation '(' Punctuation @@ -239,42 +228,7 @@ ',' Punctuation ' ' Text.Whitespace '"' Literal.String -'S' Literal.String -'t' Literal.String -'r' Literal.String -'i' Literal.String -'n' Literal.String -'g' Literal.String -'L' Literal.String -'i' Literal.String -'t' Literal.String -'e' Literal.String -'r' Literal.String -'a' Literal.String -'l' Literal.String -'R' Literal.String -'e' Literal.String -'f' Literal.String -' ' Literal.String -'i' Literal.String -'n' Literal.String -'d' Literal.String -'e' Literal.String -'x' Literal.String -' ' Literal.String -'o' Literal.String -'u' Literal.String -'t' Literal.String -' ' Literal.String -'o' Literal.String -'f' Literal.String -' ' Literal.String -'b' Literal.String -'o' Literal.String -'u' Literal.String -'n' Literal.String -'d' Literal.String -'s' Literal.String +'StringLiteralRef index out of bounds' Literal.String '"' Literal.String ')' Punctuation ';' Punctuation @@ -307,25 +261,9 @@ '=' Operator ' ' Text.Whitespace '"""' Literal.String -'\n' Literal.String - -'l' Literal.String -'o' Literal.String -'n' Literal.String -'g' Literal.String +'\nlong' Literal.String '\\t' Literal.String.Escape -'l' Literal.String -'o' Literal.String -'n' Literal.String -'g' Literal.String -'\n' Literal.String - -'s' Literal.String -'t' Literal.String -'o' Literal.String -'r' Literal.String -'y' Literal.String -'\n' Literal.String +'long\nstory\n' Literal.String '"""' Literal.String '\n' Text.Whitespace |