<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Aug 18, 2012, at 4:16 AM, Allan Odgaard <<a href="mailto:odgaard@macromates.com">odgaard@macromates.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">On Aug 18, 2012, at 6:53 AM, Gerd Knops <<a href="mailto:gerti@bitart.com">gerti@bitart.com</a>> wrote:<br><br><blockquote type="cite">- Right now it seems injection appends to the patterns. Would it be possible to also have 'early injection' where the new patterns are prepended to the patterns? I am experimenting with special comment sections like /*H:   */, and can't seem to do this with injection. (Another example application: Headerdoc/Docbook comments /** */ etc).<br></blockquote><br>I am not following why this would work for appending but not prepending… this is because you want to replace the _entire_ comment rule? As opposed to inject the grammar into the comment?<br><br></blockquote><div>Right. Here is a simple example: I like to use line comments '//' that begin at the start of the line as code separators, so I draw the line background in a different color, so basically</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">      </span>match = "^//.*\n?";</div><div><br></div><div>This doesn't work with injections, because the 'regular' grammar already gobbles up any '//', so the injected grammar never sees it.</div><div><br></div><div>Similar for docbook comments: an injected grammar never sees the '/**' comments.</div><div><br></div><div>Another example is leading whitespace: I like to have leading tabs highlighted with alternating light backgrounds, like so:</div><div><br></div><div><img id="fe1a756b-95a6-46b4-908c-dbbed510277b" height="261" width="620" apple-width="yes" apple-height="yes" src="cid:828FED91-5403-4737-BA93-B286754DCBE4"></div><div><br></div><div>I would LOVE to use injection for that, unfortunately many definitions eat up leading space. So my only recourse is to write custom language grammars for ALL languages I want to have this feature (eg ALL languages I use), start with my rules (so they get first dib), then include the actual language.</div><div><br></div><div><br></div><br><blockquote type="cite">Though we definitely do need more flexibility wrt. injection, I think I did the append because then an injected grammar will not screw up the parent grammar, with our current grammars though, I think none of them would. I.e. this is only when you inject fallback matches.<br><br>I think both Joachim and Michael sheets have input on these things, why not use the mailing list for this?<br><br></blockquote><div>Done.</div><div><br></div><br><blockquote type="cite"><blockquote type="cite">- Would it be possible to access other grammars repositories? I could imagine something like<br><br><span class="Apple-tab-span" style="white-space:pre">      </span>{ include = 'source.objc.#interface_innards'; }, <br></blockquote><br>This should already be possible, but without the dot, so simply ‘source.objc#interface_innards’.<br><br></blockquote><div>Oh, that made my day!!! Thanks!</div><div><br></div><div>Gerd</div><div><br></div></div></body></html>