Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tcl lexer: no error for @ or , #1834

Merged
merged 3 commits into from Jun 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion pygments/lexers/tcl.py
Expand Up @@ -85,7 +85,7 @@ def _gen_command_rules(keyword_cmds_re, builtin_cmds_re, context=""):
(r'\d+\.\d+', Number.Float),
(r'\d+', Number.Integer),
(r'\$([\w.:-]+)', Name.Variable),
(r'([\w.:-]+)', Text),
(r'([\w.,@:-]+)', Text),
],
'params': [
(r';', Keyword, '#pop'),
Expand Down
131 changes: 131 additions & 0 deletions tests/snippets/tcl/test_comma_and_at.txt
@@ -0,0 +1,131 @@
---input---
# Alt and arrow keys to scroll
set scroll_amount 2
bind Text <Alt-Up> {
%W yview scroll -$scroll_amount units
%W mark set insert @0,[expr [winfo height %W] / 2]
}
bind Text <Alt-Down> {
%W yview scroll $scroll_amount units
%W mark set insert @0,[expr [winfo height %W] / 2]
}

---tokens---
'#' Comment
' Alt and arrow keys to scroll\n' Comment

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

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

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

'}' Keyword
'\n' Text

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

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

'}' Keyword
'\n' Text