Hi,
I have a grammar where a definition starts with a certain sequence, and the definition is ended with an empty line (optionally containing whitespace):
{ begin = 'PATTERN'; end = '^\s*$'; patterns = ( { include = '#some-stuff'; } ); },
My problem is that some of the repository rules in '#some-stuff' define blocks (eg { ... } ), and these blocks seem to 'escape' the frame set by the rule above and eat up empty lines. Example:
PATTERN my first rule
PATTERN my second rule
PATTERN { not actually starting a block because followed by empty line
PATTERN } not actually the end of the block because preceded by empty line
So here the problem is that TM interprets the { } as block, even though the 'outer' rule should limit the part parsed by the repository rules to the empty lines between the last two definitions.
Any way to fix this?
Thanks
Gerd
On Mar 8, 2013, at 12:17 PM, Gerd Knops gerti-textmate@bitart.com wrote:
I have a grammar where a definition starts with a certain sequence, and the definition is ended with an empty line (optionally containing whitespace):
When you enter a begin/end only those rules inside the pattern block and the end pattern are active. So when you enter the second one in your example the end pattern isn't being checked anymore. It's not possible to directly do what you want, no. The workaround is to have special end rules in the sub-patterns that check for the normal end and the parents end in a look-ahead. Of course this makes them not as reusable.