On 21/5/2006, at 0:23, marios buttner wrote:
You can see the pref snippet that I used to test the above below.:
Sample.: { name = 'keyword.control.txp'; match = '(["|\s]?txp:.+\s/["|\s]?|["|\s]*?txp:.+["|\s]*?|["|\s]?</txp:. +>["|\s]?)'; }, (works, but not with the complex constructs, like mentioned above.)
Problem.: Some of these instances make it difficult to construct the regular expressions. Possible Solution.: Could be excluded with negates whenever occurs (That would be rather hackyish and not elegant)
I don’t have a good sense of the language, but another option is to split up the fragment into multiple parts and use begin/end matches. Similar to how HTML tags are matched, where there is both a name, attributes, and potential embedded Ruby, PHP, etc.
- Furthermore the reason, why I opted for a "source txp.scope"
rather then the other easier and integrable solution and attempt everything from scratch, is that there is not a real hierarchy between html and txp forms and pages, so I thought it would be more expandable and extensible in that way. Question: Is that so ? Or am I terribly wrong ?
There are two types of inheritance in TextMate.
First there is simply including another language grammar in the new one. E.g. C++ includes the C grammar and thereby inherit all the C rules. Here the including grammar can override rules included, simply by matching the same stuff but before doing the include.
The other type is in scope name. This has nothing to do with the actual language grammar matching, but it is instead used in the context of scope selecotrs.
For example there is a `table` snippet which inserts an HTML table. The scope selector for this is `text.html` and all languages which have a scope name starting with `text.html` will provide this snippet (e.g. `text.html.markdown`) -- one can override such inheritance by creating a new item which use the same key equivalent / tab trigger, but give it a more specific scope.
For Textpattern, you do want a scope name of `text.html.textpattern` if the functionality in the HTML bundle is useful in the context of txp (like converting to/from entities, creating tags, inserting HTML snippets, etc.).
Even if only a subset is useful, it still makes sense to inherit the scope name, as one can always override the functionality which is different for the inheriting scope, and/or ignore that it exists.
Though should you decide to keep your new scope, you should inherit from text rather than source, if this is markup.
3)Question: Is the p.list format going to change to a xml format for the Language grammars. ?
Not inside the language editor. It is however stored as XML on-disk (and actually binary plists in the default bundles).
- I made two variants of a preliminary bundle for the Grammar,
would it make sense to submit those to repository, once they reach an acceptable stage ?
If others may find it useful, yes.
- [...] Is it correct to suspect that the element names themselves
are irrelevant for the inner functioning of the language grammar ?
Yes -- only the scope selector means something.