[TxMt] Re: Best approach to add new Scoping rules to grammar

Charilaos Skiadas skiadas at hanover.edu
Mon Feb 12 07:21:42 UTC 2007


On Feb 12, 2007, at 2:00 AM, Steve Lianoglou wrote:

> When I hit the Text button (to activate it), it blows hoses the  
> Python source ... it's all colored as if it were one long string.
>
All of it, or everything starting from the first """ ?
> Lines with text, however, (not just whitespace) now all get an  
> addition scope:
> meta.paragraph.restructuredtext
>
> which I guess is why its coloring everything like a string, but I  
> wonder why it doesn't stop doing that outside of the double quoted  
> blocks """ """, where I do the include = 'text.restructuredtext'?

Presumably the rules in text.restructuredtext are such that they  
absorb the closing """ . I would venture to guess (though perhaps I  
am wrong) that the restructuredtext grammar is not ready for  
inclusion to Python. Go to the closing """ and see what the scope is  
there. It might include: markup.heading.restructuredtext, which would  
mean that it would be absorbed by the restructuredtext rule, instead  
of being considered as losing the first """.

Is any restructuredtext text allowed in python's """ """ ? If not,  
then perhaps you need to first break the restructuredtext grammar in  
two parts, a root grammar and an extension grammar, and then include  
only the root one in python.

> -steve

Haris





More information about the textmate mailing list