I am working on a language grammar. I would like to include repository rules from a different language. I have tried including the language itself at the top of my grammar and then including the rule in necessary place in my grammar but it does not appear to work. I am hoping that there is a syntax for doing this and I just haven't discovered it yet. If anyone can point me in the right direction I would appreciate it!
Thanks, Matthew
On May 25, 2012, at 2:26 PM, Matthew Johnson wrote:
I am working on a language grammar. I would like to include repository rules from a different language. I have tried including the language itself at the top of my grammar and then including the rule in necessary place in my grammar but it does not appear to work. I am hoping that there is a syntax for doing this and I just haven't discovered it yet. If anyone can point me in the right direction I would appreciate it!
There should be many examples (eg HTML should include JS and CSS etc), attached a short custom one for Lua that includes the regular Lua syntax at the end.
Gerd
{ patterns = ( { match = '^#!/.*\blua\b'; name = 'variable.other.register'; }, { captures = { 1 = { name = 'comment.line.dashdash.lua'; }; 2 = { name = 'punctuation.definition.comment.lua'; }; }; match = '^((--).*$\n?)'; name = 'meta.comment.full-line.lua'; }, { begin = '^(?=(\t| {4}))'; end = '(?=[^\t\s])'; name = 'meta.leading-tabs'; patterns = ( { captures = { 1 = { name = 'meta.odd-tab'; }; 2 = { name = 'meta.even-tab'; }; }; match = '(\t| {4})(\t| {4})?'; }, ); }, { include = 'source.lua'; }, ); }
There should be many examples (eg HTML should include JS and CSS etc), attached a short custom one for Lua that includes the regular Lua syntax at the end.
This is including the entire language. I am trying to include specific rules from the repository for a language. I haven't seen any examples of that...
Gerd
{ patterns = ( { match = '^#!/.*\blua\b'; name = 'variable.other.register'; }, { captures = { 1 = { name = 'comment.line.dashdash.lua'; }; 2 = { name = 'punctuation.definition.comment.lua'; }; }; match = '^((--).*$\n?)'; name = 'meta.comment.full-line.lua'; }, { begin = '^(?=(\t| {4}))'; end = '(?=[^\t\s])'; name = 'meta.leading-tabs'; patterns = ( { captures = { 1 = { name = 'meta.odd-tab'; }; 2 = { name = 'meta.even-tab'; }; }; match = '(\t| {4})(\t| {4})?'; }, ); }, { include = 'source.lua'; }, ); }
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
I am working on a language grammar. I would like to include repository rules from a different language. I have tried including the language itself at the top of my grammar and then including the rule in necessary place in my grammar but it does not appear to work. I am hoping that there is a syntax for doing this and I just haven't discovered it yet. If anyone can point me in the right direction I would appreciate it!
In case anyone else is wondering about this, I eventually answered my own question. This is possible in TM2 using grammar#repo_rule like this:
{ include = 'source.objc#interface_innards'; },