Browse files

Added modules to the Textmate Language definition.

  • Loading branch information...
1 parent fa5aebb commit 6ec8187dff7cc4b57313fdd9c09a90c44289b1e4 @chrislloyd chrislloyd committed Jan 27, 2011
Showing with 147 additions and 86 deletions.
  1. +147 −86 Treetop.tmbundle/Syntaxes/Treetop Grammar.tmLanguage
View
233 Treetop.tmbundle/Syntaxes/Treetop Grammar.tmLanguage
@@ -5,9 +5,10 @@
<key>fileTypes</key>
<array>
<string>treetop</string>
+ <string>tt</string>
</array>
<key>foldingStartMarker</key>
- <string>(grammer|rule).*$</string>
+ <string>(module|grammer|rule).*$</string>
<key>foldingStopMarker</key>
<string>^\s*end</string>
<key>keyEquivalent</key>
@@ -22,25 +23,61 @@
</dict>
<dict>
<key>begin</key>
- <string>^(grammar) ([A-Z]\w+)</string>
+ <string>^(\s*)(module) ([A-Z]\w+)</string>
<key>beginCaptures</key>
<dict>
+ <key>2</key>
+ <dict>
+ <key>name</key>
+ <string>keyword.begin.module.treetop</string>
+ </dict>
+ <key>3</key>
+ <dict>
+ <key>name</key>
+ <string>entity.name.module.treetop</string>
+ </dict>
+ </dict>
+ <key>end</key>
+ <string>^\1(end)$</string>
+ <key>endCaptures</key>
+ <dict>
<key>1</key>
<dict>
<key>name</key>
- <string>keyword.begin.grammar.treetop</string>
+ <string>keyword.end.module.treetop</string>
+ </dict>
+ </dict>
+ <key>name</key>
+ <string>meta.module.treetop</string>
+ <key>patterns</key>
+ <array>
+ <dict>
+ <key>include</key>
+ <string>$self</string>
</dict>
+ </array>
+ </dict>
+ <dict>
+ <key>begin</key>
+ <string>^(\s*)(grammar) ([A-Z]\w+)</string>
+ <key>beginCaptures</key>
+ <dict>
<key>2</key>
<dict>
<key>name</key>
+ <string>keyword.begin.grammar.treetop</string>
+ </dict>
+ <key>3</key>
+ <dict>
+ <key>name</key>
<string>entity.name.grammar.treetop</string>
</dict>
</dict>
<key>end</key>
- <string>^end$</string>
+ <string>^\1(end)$</string>
<key>endCaptures</key>
<dict>
- <key>0</key>
+ <key>1</key>
<dict>
<key>name</key>
<string>keyword.end.grammar.treetop</string>
@@ -52,101 +89,101 @@
<array>
<dict>
<key>include</key>
+ <string>$self</string>
+ </dict>
+ </array>
+ </dict>
+ <dict>
+ <key>captures</key>
+ <dict>
+ <key>1</key>
+ <dict>
+ <key>name</key>
+ <string>keyword.include.treetop</string>
+ </dict>
+ <key>2</key>
+ <dict>
+ <key>name</key>
+ <string>entity.name.include.treetop</string>
+ </dict>
+ </dict>
+ <key>match</key>
+ <string>(include)\s+(\w+)</string>
+ <key>name</key>
+ <string>meta.include.treetop</string>
+ </dict>
+ <dict>
+ <key>begin</key>
+ <string>\b(rule)\b (\w+)</string>
+ <key>beginCaptures</key>
+ <dict>
+ <key>1</key>
+ <dict>
+ <key>name</key>
+ <string>keyword.begin.rule.treetop</string>
+ </dict>
+ <key>2</key>
+ <dict>
+ <key>name</key>
+ <string>entity.name.rule.treetop</string>
+ </dict>
+ </dict>
+ <key>end</key>
+ <string>^\s+\bend\b\s*$</string>
+ <key>endCaptures</key>
+ <dict>
+ <key>0</key>
+ <dict>
+ <key>name</key>
+ <string>keyword.end.rule.treetop</string>
+ </dict>
+ </dict>
+ <key>name</key>
+ <string>meta.rule.treetop</string>
+ <key>patterns</key>
+ <array>
+ <dict>
+ <key>include</key>
<string>#comment</string>
</dict>
<dict>
- <key>captures</key>
- <dict>
- <key>1</key>
- <dict>
- <key>name</key>
- <string>keyword.include.treetop</string>
- </dict>
- <key>2</key>
- <dict>
- <key>name</key>
- <string>entity.name.include.treetop</string>
- </dict>
- </dict>
+ <key>include</key>
+ <string>#strings</string>
+ </dict>
+ <dict>
+ <key>include</key>
+ <string>#character-class</string>
+ </dict>
+ <dict>
<key>match</key>
- <string>(include)\s+(\w+)</string>
+ <string>\/</string>
<key>name</key>
- <string>meta.include.treetop</string>
+ <string>keyword.operator.or.treetop</string>
+ </dict>
+ <dict>
+ <key>match</key>
+ <string>&lt;\w+?&gt;</string>
+ <key>name</key>
+ <string>variable.class-instance.treetop</string>
+ </dict>
+ <dict>
+ <key>match</key>
+ <string>\w+?:</string>
+ <key>name</key>
+ <string>support.operand.treetop</string>
</dict>
<dict>
<key>begin</key>
- <string>\b(rule)\b (\w+)</string>
- <key>beginCaptures</key>
- <dict>
- <key>1</key>
- <dict>
- <key>name</key>
- <string>keyword.begin.rule.treetop</string>
- </dict>
- <key>2</key>
- <dict>
- <key>name</key>
- <string>entity.name.rule.treetop</string>
- </dict>
- </dict>
+ <string>\{</string>
<key>end</key>
- <string>^\s+\bend\b\s*$</string>
- <key>endCaptures</key>
- <dict>
- <key>0</key>
- <dict>
- <key>name</key>
- <string>keyword.end.rule.treetop</string>
- </dict>
- </dict>
+ <string>\}</string>
<key>name</key>
- <string>meta.rule.treetop</string>
+ <string>meta.embedded-ruby.treetop</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
- <string>#comment</string>
- </dict>
- <dict>
- <key>include</key>
- <string>#strings</string>
- </dict>
- <dict>
- <key>include</key>
- <string>#character-class</string>
- </dict>
- <dict>
- <key>match</key>
- <string>\/</string>
- <key>name</key>
- <string>keyword.operator.or.treetop</string>
- </dict>
- <dict>
- <key>match</key>
- <string>&lt;\w+?&gt;</string>
- <key>name</key>
- <string>variable.class-instance.treetop</string>
- </dict>
- <dict>
- <key>match</key>
- <string>\w+?:</string>
- <key>name</key>
- <string>support.operand.treetop</string>
- </dict>
- <dict>
- <key>begin</key>
- <string>\{</string>
- <key>end</key>
- <string>\}</string>
- <key>name</key>
- <string>meta.embedded-ruby.treetop</string>
- <key>patterns</key>
- <array>
- <dict>
- <key>include</key>
- <string>source.ruby</string>
- </dict>
- </array>
+ <string>source.ruby</string>
</dict>
</array>
</dict>
@@ -286,6 +323,30 @@
</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.treetop</string>
+ </dict>
+ </dict>
+ <key>end</key>
+ <string>"</string>
+ <key>endCaptures</key>
+ <dict>
+ <key>0</key>
+ <dict>
+ <key>name</key>
+ <string>punctuation.definition.string.end.treetop</string>
+ </dict>
+ </dict>
+ <key>name</key>
+ <string>string.quoted.double.treetop</string>
+ </dict>
</array>
</dict>
</dict>

0 comments on commit 6ec8187

Please sign in to comment.