thanks for your clarifications Allan :-)
On 09/10/06, Allan Odgaard throw-away-1@macromates.com wrote:
On 9. Oct 2006, at 18:39, sam aaron wrote:
This is not how the parser works. When one rule has matched a portion of the text, no other rules can match that text.
ok, so only one scope can be applied to each character of the document?
Only one rule can assign a scope to a particular character, yes. But scopes nest, so if you use a begin/end rule, everything matching inside this, will inherit the scope of the begin/end rule.
but it appears to me that what you want is for the different rules to overlap, i.e. match the same characters in the document.
yes, for some reason i thought that this was possible. For example, consider the following line:
- this is part of a list _here i want italics_
I thought it was possible to have the characters between the underscores to belong to an 'italic scope' and also a 'list item scope'. I guess you kind of achieve this by naming the italics scope as an extention of the list scope: list.italics or is it recommended to just use an italics scope, losing its relationship with the list?
You nest the rules, e.g.:
{ name = 'markup.list'; begin = '^ \* '; // simplified list item start end = '$'; // end list item at end-of-line patterns = ( { name = 'markup.italic'; begin = '_'; end = '_'; } ); }
My next question (which I think I already know the answer to), so if I want to have the equivalent of an underscore italics rule, i have to declare it as an internal pattern to all the patterns I want itallic behaviour inside? I guess this is where you'd use the grammar repository?
Yes.
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate