Open verhovsky opened 2 months ago
We're not trying to be accurate in terms of finding errors; if you provide invalid code, there's no way for us to flag it. The goal of Pygments is to highlight semantically correct code.
Pygments is highlighting the backslashes as errors but they're not errors. It is correct code, it comes from here
# backslash suppresses the special meaning of characters:
set amount \$16.42
# backslash adds special meaning to certain characters:
puts lots\nof\n\n\n\n\n\nnewlines
Ah ok, sorry, misread your initial statement.
What should be the intended output for the \n
characters? Is it TEXT.WHITESPACE
or Literal.String.Escape
. The TcL highlighter in VSCODE marks it as String.Escape.
Below is the output after considering them as Literal.String.Escape
:
None of these are errors
https://pygments.org/demo/?lexer=tcl&style=solarized-light&formatter=html&code=%23+backslash+suppresses+the+special+meaning+of+characters%3A%0Aset+amount+%5C%2416.42%0A%0A%0A%23+backslash+adds+special+meaning+to+certain+characters%3A%0Aputs+lots%5Cnof%5Cn%5Cn%5Cn%5Cn%5Cn%5Cnnewlines%0A%0A%0A%23+A+word+enclosed+in+braces+is+not+subject+to+any+special+interpretation+or%0A%23+substitutions%2C+except+that+a+backslash+before+a+brace+is+not+counted+when%0A%23+looking+for+the+closing+brace%3A%0Aset+somevar+%7B%0A++++This+is+a+literal+%24+sign%2C+and+this+%5C%7D+escaped%0A++++brace+remains+uninterpreted%0A%7D%0A