我为一种专门的语言创建了一个 tmlanguage 文件。这种语言允许在字符串中使用反斜杠并且它不会转义它们。所以当我创建变量时:
路径 = 'C:\Temp\';
Sublime 认为引号被转义,然后我的语法着色在脚本的其余部分关闭。
我怎样才能防止这种情况发生?
编辑:哎呀!忘记来源(感谢 MattDMo)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>fileTypes</key>
<array>
<string>txt</string>
</array>
<key>name</key>
<string>TM1</string>
<key>patterns</key>
<array>
<dict>
<key>match</key>
<string>(=|<>|>|<|@=|@<>|@>|@<)</string>
<key>name</key>
<string>keyword.operator.tm1</string>
</dict>
<dict>
<key>match</key>
<string>(?i)\b(If|While|Else|ElseIf|End|EndIf)\b</string>
<key>name</key>
<string>keyword.control.tm1</string>
</dict>
<dict>
<key>begin</key>
<string>'</string>
<key>beginCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.begin.tm1</string>
</dict>
</dict>
<key>end</key>
<string>'</string>
<key>endCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.end.tm1</string>
</dict>
</dict>
<key>name</key>
<string>string.quoted.single.tm1</string>
<key>patterns</key>
<array>
<dict>
<key>match</key>
<string>\\(x\h{2}|[0-2][0-7]{,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)</string>
<key>name</key>
<string>constant.character.escape.tm1</string>
</dict>
</array>
</dict>
<dict>
<key>begin</key>
<string>"</string>
<key>beginCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.begin.tm1</string>
</dict>
</dict>
<key>end</key>
<string>"</string>
<key>endCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.end.tm1</string>
</dict>
</dict>
<key>name</key>
<string>string.quoted.double.tm1</string>
<key>patterns</key>
<array>
<dict>
<key>match</key>
<string>\\(x\h{2}|[0-2][0-7]{,2}|3[0-6][0-7]|37[0-7]?|[4-7][0-7]?|.)</string>
<key>name</key>
<string>constant.character.escape.tm1</string>
</dict>
</array>
</dict>
<dict>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.definition.comment.tm1</string>
</dict>
</dict>
<key>match</key>
<string>(#).*$\n?</string>
<key>name</key>
<string>comment.line.double-slash.tm1</string>
</dict>
<dict>
<key>match</key>
<string>\;</string>
<key>name</key>
<string>punctuation.terminator.statement.tm1</string>
</dict>
</array>
<key>scopeName</key>
<string>source.tm1</string>
</dict>
</plist>