[TxMt] Reuse of language grammar patterns

Jacob Carlborg doob at me.com
Thu Jul 16 06:46:10 UTC 2015


Is it possible in a language grammar to create a pattern that is based 
on another pattern? I know that you can create a pattern which matches 
some text and inserts another pattern in a capture group. But I would 
like to reuse the actual regular expression from another pattern.

It's a bit hard to explain but the equivalent in Ruby would look 
something like this:

identifier = /\w+/
mod = /module #{identifier};/

The point here is to avoid duplicating the "identifier" pattern in the 
"mod" pattern.

-- 
/Jacob Carlborg



More information about the textmate mailing list