Skip to content

Commit

Permalink
tcl lexer: no error for @ or , (#1834)
Browse files Browse the repository at this point in the history
* tcl lexer: no error for @ or ,

* examplefiles --> snippets

* rename test file to convention
  • Loading branch information
Akuli committed Jun 20, 2021
1 parent dae7bf0 commit 179bad8
Show file tree
Hide file tree
Showing 2 changed files with 132 additions and 1 deletion.
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

0 comments on commit 179bad8

Please sign in to comment.