Skip to content

Commit

Permalink
Add a syntax definition for RSpec keywords highlighting
Browse files Browse the repository at this point in the history
  • Loading branch information
mitio committed Jan 3, 2012
1 parent 865cf58 commit 4402815
Showing 1 changed file with 142 additions and 0 deletions.
142 changes: 142 additions & 0 deletions RSpec.tmLanguage
@@ -0,0 +1,142 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>fileTypes</key>
<array>
<string>spec.rb</string>
</array>
<key>foldingStartMarker</key>
<string>(?x)^
(\s*+
(module|class|def
|unless|if
|case
|begin
|for|while|until
|^=begin
|( "(\\.|[^"])*+" # eat a double quoted string
| '(\\.|[^'])*+' # eat a single quoted string
| [^#"'] # eat all but comments and strings
)*
( \s (do|begin|case)
| (?&lt;!\$)[-+=&amp;|*/~%^&lt;&gt;~] \s*+ (if|unless)
)
)\b
(?! [^;]*+ ; .*? \bend\b )
|( "(\\.|[^"])*+" # eat a double quoted string
| '(\\.|[^'])*+' # eat a single quoted string
| [^#"'] # eat all but comments and strings
)*
( \{ (?! [^}]*+ \} )
| \[ (?! [^\]]*+ \] )
)
).*$
| [#] .*? \(fold\) \s*+ $ # Sune’s special marker
</string>
<key>foldingStopMarker</key>
<string>(?x)
( (^|;) \s*+ end \s*+ ([#].*)? $
| (^|;) \s*+ end \. .* $
| ^ \s*+ [}\]] \s*+ ([#].*)? $
| [#] .*? \(end\) \s*+ $ # Sune’s special marker
| ^=end
)</string>
<key>keyEquivalent</key>
<string>^~R</string>
<key>name</key>
<string>RSpec</string>
<key>patterns</key>
<array>
<dict>
<key>match</key>
<string>(?&lt;!\.)\b(before|after)\b(?![?!])</string>
<key>name</key>
<string>keyword.other.special-method.ruby.rspec</string>
</dict>
<dict>
<key>include</key>
<string>#behaviour</string>
</dict>
<dict>
<key>include</key>
<string>#example</string>
</dict>
<dict>
<key>include</key>
<string>source.ruby</string>
</dict>
</array>
<key>repository</key>
<dict>
<key>behaviour</key>
<dict>
<key>begin</key>
<string>^\s*(describe)\b</string>
<key>beginCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>keyword.other.behaviour.ruby.rspec</string>
</dict>
</dict>
<key>end</key>
<string>\b(do)\s*$</string>
<key>endCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>keyword.control.start-block.ruby.rspec</string>
</dict>
</dict>
<key>name</key>
<string>meta.behaviour.ruby.rspec</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>source.ruby</string>
</dict>
</array>
</dict>
<key>example</key>
<dict>
<key>begin</key>
<string>^\s*(it)\b</string>
<key>beginCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>keyword.other.example.ruby.rspec</string>
</dict>
</dict>
<key>end</key>
<string>\b(do)\s*$</string>
<key>endCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>keyword.control.start-block.ruby.rspec</string>
</dict>
</dict>
<key>name</key>
<string>meta.example.ruby.rspec</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>source.ruby</string>
</dict>
</array>
</dict>
</dict>
<key>scopeName</key>
<string>source.ruby.rspec</string>
<key>uuid</key>
<string>923F0A10-96B9-4792-99A4-94FEF66E0B8C</string>
</dict>
</plist>

0 comments on commit 4402815

Please sign in to comment.