pygments / pygments

Pygments is a generic syntax highlighter written in Python
http://pygments.org/
BSD 2-Clause "Simplified" License
1.77k stars 646 forks source link

tcl variable name dash #1720

Open Akuli opened 3 years ago

Akuli commented 3 years ago
set foo lol
puts a-$foo-b

This prints a-lol-b, treating foo as a variable name, but Pygments highlight this as if foo-b was a variable name:

ffff

birkenfeld commented 3 years ago

can variable names contain dashes in other situations?

Akuli commented 3 years ago

Not when accessed with $var notation, but they can be used in other ways. If you have a variable named foo-bar, you can access it with set foo-bar or ${foo-bar}:

$ tclsh
% set foo-bar 123
123
% puts $foo-bar             
can't read "foo": no such variable
% puts ${foo-bar}
123
% set foo-bar
123