Skip to content

Commit

Permalink
Use Whitespace for whitespace in Tcl.
Browse files Browse the repository at this point in the history
  • Loading branch information
Anteru committed Jun 20, 2021
1 parent 179bad8 commit d421a22
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 41 deletions.
6 changes: 5 additions & 1 deletion CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@ Version 2.10.0
--------------
(not released yet)

- Updated lexers:

* Rust: fix lexing of "break" and "continue" (#1843)
* Tcl: Allow ``,`` and ``@`` in strings (#1834, #1742)

- Fix assert statements in TNT lexer.
- Rust: fix lexing of "break" and "continue" (#1843)
- Token types across all lexers have been unified (using the most common token
type name) (#1816, #1819)

Expand Down
4 changes: 2 additions & 2 deletions pygments/lexers/tcl.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

from pygments.lexer import RegexLexer, include, words
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
Number
Number, Whitespace
from pygments.util import shebang_matches

__all__ = ['TclLexer']
Expand Down Expand Up @@ -79,7 +79,7 @@ def _gen_command_rules(keyword_cmds_re, builtin_cmds_re, context=""):
(r'!=|==|<<|>>|<=|>=|&&|\|\||\*\*|[-+~!*/%<>&^|?:]', Operator),
],
'data': [
(r'\s+', Text),
(r'\s+', Whitespace),
(r'0x[a-fA-F0-9]+', Number.Hex),
(r'0[0-7]+', Number.Oct),
(r'\d+\.\d+', Number.Float),
Expand Down
76 changes: 38 additions & 38 deletions tests/snippets/tcl/test_comma_and_at.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,60 +15,60 @@ bind Text <Alt-Down> {
' Alt and arrow keys to scroll\n' Comment

'set' Keyword
' ' Text
' ' Text.Whitespace
'scroll_amount' Text
' ' Text
' ' Text.Whitespace
'2' Literal.Number.Integer
'\n' Text

'bind' Name.Variable
' ' Text
' ' Text.Whitespace
'Text' Text
' ' Text
' ' Text.Whitespace
'<' Operator
'Alt-Up' Text
'>' Operator
' ' Text
' ' Text.Whitespace
'{' Keyword
'\n ' Text
'\n ' Text.Whitespace
'%' Operator
'W' Name.Variable
' ' Text
' ' Text.Whitespace
'yview' Text
' ' Text
' ' Text.Whitespace
'scroll' Text
' ' Text
' ' Text.Whitespace
'-' Operator
'$scroll_amount' Name.Variable
' ' Text
' ' Text.Whitespace
'units' Text
'\n' Text

' ' Text
' ' Text.Whitespace
'%' Operator
'W' Name.Variable
' ' Text
' ' Text.Whitespace
'mark' Text
' ' Text
' ' Text.Whitespace
'set' Text
' ' Text
' ' Text.Whitespace
'insert' Text
' ' Text
' ' Text.Whitespace
'@0,' Text
'[' Keyword
'expr' Keyword
' ' Text
' ' Text.Whitespace
'[' Keyword
'winfo' Name.Variable
' ' Text
' ' Text.Whitespace
'height' Text
' ' Text
' ' Text.Whitespace
'%' Operator
'W' Text
']' Keyword
' ' Text
' ' Text.Whitespace
'/' Operator
' ' Text
' ' Text.Whitespace
'2' Literal.Number.Integer
']' Keyword
'\n' Text
Expand All @@ -77,52 +77,52 @@ bind Text <Alt-Down> {
'\n' Text

'bind' Name.Variable
' ' Text
' ' Text.Whitespace
'Text' Text
' ' Text
' ' Text.Whitespace
'<' Operator
'Alt-Down' Text
'>' Operator
' ' Text
' ' Text.Whitespace
'{' Keyword
'\n ' Text
'\n ' Text.Whitespace
'%' Operator
'W' Name.Variable
' ' Text
' ' Text.Whitespace
'yview' Text
' ' Text
' ' Text.Whitespace
'scroll' Text
' ' Text
' ' Text.Whitespace
'$scroll_amount' Name.Variable
' ' Text
' ' Text.Whitespace
'units' Text
'\n' Text

' ' Text
' ' Text.Whitespace
'%' Operator
'W' Name.Variable
' ' Text
' ' Text.Whitespace
'mark' Text
' ' Text
' ' Text.Whitespace
'set' Text
' ' Text
' ' Text.Whitespace
'insert' Text
' ' Text
' ' Text.Whitespace
'@0,' Text
'[' Keyword
'expr' Keyword
' ' Text
' ' Text.Whitespace
'[' Keyword
'winfo' Name.Variable
' ' Text
' ' Text.Whitespace
'height' Text
' ' Text
' ' Text.Whitespace
'%' Operator
'W' Text
']' Keyword
' ' Text
' ' Text.Whitespace
'/' Operator
' ' Text
' ' Text.Whitespace
'2' Literal.Number.Integer
']' Keyword
'\n' Text
Expand Down

0 comments on commit d421a22

Please sign in to comment.