Permalink
Browse files

escapes for strings

  • Loading branch information...
itod committed Aug 28, 2012
1 parent 9b2f6dc commit 2c9ea4e9e24b08aa868fc4ec179958d92606742e
Showing with 90 additions and 23 deletions.
  1. +90 −23 Syntaxes/ParseKit Grammar.tmLanguage
@@ -15,7 +15,7 @@
<array>
<dict>
<key>match</key>
- <string>\b(foo|if|while|for|return)\b</string>
+ <string>\b(if|while|for|return)\b</string>
<key>name</key>
<string>keyword.control.parsekit-grammar</string>
</dict>
@@ -50,6 +50,54 @@
<key>name</key>
<string>constant.numeric.parsekit-grammar</string>
</dict>
+ <dict>
+ <key>include</key>
+ <string>#string-double</string>
+ </dict>
+ <dict>
+ <key>include</key>
+ <string>#string-single</string>
+ </dict>
+ </array>
+ <key>repository</key>
+ <dict>
+ <key>escape</key>
+ <dict>
+ <key>match</key>
+ <string>(?x: # turn on extended mode
+ \\ # a literal backslash
+ (?: # ...followed by...
+ [\\/bfnrt] # one of these characters
+ | # ...or...
+ u # a u
+ [0-9a-fA-F]{4} # and four hex digits
+ )
+ )</string>
+ <key>name</key>
+ <string>constant.character.escape.parsekit-grammar</string>
+ </dict>
+ <key>escape-double</key>
+ <dict>
+ <key>match</key>
+ <string>\\"</string>
+ <key>name</key>
+ <string>constant.character.escape.parsekit-grammar</string>
+ </dict>
+ <key>escape-single</key>
+ <dict>
+ <key>match</key>
+ <string>\\'</string>
+ <key>name</key>
+ <string>constant.character.escape.parsekit-grammar</string>
+ </dict>
+ <key>invalid-escape</key>
+ <dict>
+ <key>match</key>
+ <string>\\.</string>
+ <key>name</key>
+ <string>invalid.illegal.unrecognized-string-escape.parsekit-grammar</string>
+ </dict>
+ <key>string-double</key>
<dict>
<key>begin</key>
<string>"</string>
@@ -79,36 +127,55 @@
<key>include</key>
<string>#escape</string>
</dict>
+ <dict>
+ <key>include</key>
+ <string>#escape-double</string>
+ </dict>
<dict>
<key>include</key>
<string>#invalid-escape</string>
</dict>
</array>
</dict>
- </array>
- <key>repository</key>
- <dict>
- <key>escape</key>
- <dict>
- <key>match</key>
- <string>(?x: # turn on extended mode
- \\ # a literal backslash
- (?: # ...followed by...
- ["\\/bfnrt] # one of these characters
- | # ...or...
- u # a u
- [0-9a-fA-F]{4} # and four hex digits
- )
- )</string>
- <key>name</key>
- <string>constant.character.escape.parsekit-grammar</string>
- </dict>
- <key>invalid-escape</key>
+ <key>string-single</key>
<dict>
- <key>match</key>
- <string>\\.</string>
+ <key>begin</key>
+ <string>'</string>
+ <key>beginCaptures</key>
+ <dict>
+ <key>0</key>
+ <dict>
+ <key>name</key>
+ <string>punctuation.definition.string.begin.parsekit-grammar</string>
+ </dict>
+ </dict>
+ <key>end</key>
+ <string>'</string>
+ <key>endCaptures</key>
+ <dict>
+ <key>0</key>
+ <dict>
+ <key>name</key>
+ <string>punctuation.definition.string.end.parsekit-grammar</string>
+ </dict>
+ </dict>
<key>name</key>
- <string>invalid.illegal.unrecognized-string-escape.parsekit-grammar</string>
+ <string>string.quoted.single.parsekit-grammar</string>
+ <key>patterns</key>
+ <array>
+ <dict>
+ <key>include</key>
+ <string>#escape</string>
+ </dict>
+ <dict>
+ <key>include</key>
+ <string>#escape-single</string>
+ </dict>
+ <dict>
+ <key>include</key>
+ <string>#invalid-escape</string>
+ </dict>
+ </array>
</dict>
</dict>
<key>scopeName</key>

0 comments on commit 2c9ea4e

Please sign in to comment.