Hi again, to all,
I am writing this to get a couple of evaluation thoughts together, on the Language Grammar, that I wrote for the TXP Bundle. It is not solely related to that Bundle only, so you may find this useful, if you attempt a similar approach for other Languages.
I have spent the last two days inspecting this Grammar in detail and iterating over the current approach and trying to extract the major mistakes, so I can refactor the Grammar and make it more accessible to TM's Automation Features.
In a nutshell, the Grammar is largely inspired and adapted from the experimental XHTML Bundle, following a modular approach,by referencing repository Items with include rules. The difference is, that in the experimental XHTML Bundle, each repository Item is referenced a in recursive manner, and resolves in one exclusive repository Item that stands for the html tag for html tags as exclusive root node. Textpattern Tags on the other hand do not have this requirement, so each repository Item gets referenced within an include rule,except for their attributes and values, which do not have an include rule at the root.
In order to make those non root included items easily accessible a naming convention was used, so that after reformating the code in the Bundle Editor appears exactly below the Repository Item, that references them, where there is one for each Tag.
Example:
author-tag = { }; author-tagatts = { };
The major difficulty is in the distinction of single, container, plugin and conditional tags, plus to get scopes also for the attribute values. which currently leads to matching conflicts, therefore, the current version of the Grammar doesn't have full distinction for attribute values, mainly on the single plugin tags.
One verification, that I have done about the shortcoming of this Grammar, is that it is wrong not to have a simple include for quoted single and double strings, which is now the case. For instance if I used cntrl shift < and then typed txp:article space and then get the automatic closing quote insertion, the cursor will be in between "". At this point verifying Scope with cntrl shift P, I should have at least a scope of string.quoted.double or any other dist. available. If this is not the case,all the additional automation possibilities are lost since I can not have a snippet insertion conditional.
On the other hand, while including a rule for such a scope left me with the problem of specificity of such rules, making it again difficult to have a distinct scope of attribute.value, that would match only a string, that is in between the quotes, but has another scope then string.quoted.double
To be continued,
regards, marios