Guido, I think the grammar you should be adding these constructs to is the TeX Math grammar, since that is the main one that takes effect in math mode. The difference between $self and $base is indeed a delicate one, and the choices we've made are perhaps not always the same. In this case, I think the question is: Should we be allowing arbitrary LaTeX syntax rules inside a math environment? For instance, should we recognize a "\begin{document}...\end{document}" block within a math environment? We opted for "no".
Best, Haris Skiadas Department of Mathematics and Computer Science Hanover College
On Nov 13, 2007, at 3:39 AM, Guido Governatori wrote:
On 13/11/2007, at 4:04 PM, Allan Odgaard wrote:
On 12 Nov 2007, at 06:17, Guido Governatori wrote:
[...] Maybe I have not understood how include, but if I write a grammar where patterns contains only an include statement, don't I "create a copy" of the included grammar under a different name?
Well, you include it, yes.
Allan, thanks for the explanation.
But if the included grammar does something like “begin = '('; end = ')'; patterns = ( … );” then the rules you put in the grammar where you include the former, will not be active inside (…).
I did some experiments, and it seems that it depends whether the inner patterns (...) includes itself or not. Better, if it only includes itself (i.e., $self), then the definition external to the include are not considered in the patterns; if it uses includes = '$base' the external definitions are parsed inside the inner patterns.
Since LaTeX does a lot of this nesting of rules, it is generally not possible to add a new rule then include the old grammar, and expect the new rule to work in all contexts.
I see that in some cases text.tex includes with $self. So scopes with $self cannot be extended while scopes with base can.
All the best
Guido
Dr Guido Governatori School of Information Technology and Electrical Engineering The University of Queensland Brisbane, Queensland, 4072, Australia Phone: +61-(0)7-336 52907 Fax: +61-(0)7-336 54999 http://www.governatori.net/TextMate http://www.defeasible.org