[TxMt] Use PPI for Perl parsing?

Allan Odgaard throw-away-1 at macromates.com
Sun Sep 3 10:12:54 UTC 2006


On 3/9/2006, at 1:19, Joshua Keroes wrote:

> The PPI module[1] on CPAN is designed to parse Perl (no small task
> there). It was designed for projected /exactly/ like TextMate.

TextMate needs a name assigned to each parsed entity so that scope  
selectors can be used (used to abstract visual styles away from the  
parser, apply settings to subsets of the document, limit key  
bindings, etc.).

It needs grammars to be able to include each other, e.g. Perl here- 
docs include the HTML grammar when the token is HTML, the HTML  
(Mason) grammar includes Perl inside <% … %> etc.

If each language had its own custom parser, this would not be  
feasible, and it would significantly lower the barrier to language  
grammar hacking.

Not to mention that TM needs to constantly re-parse the document when  
it is being edited, but only the part of the document actually  
changed. E.g. if you add a keyword at line 10,325 then only that line  
should be re-parsed, though had you added ‘=begin’ then it needs to  
re-parse until it sees ‘=end’ -- stand-alone parsers like PPI are not  
made for these things.




More information about the textmate mailing list