[TxMt] LaTeX grammer for subscript

Guido Governatori guido at itee.uq.edu.au
Tue Nov 13 08:39:52 UTC 2007


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





More information about the textmate mailing list