[TxMt] Re: ActionScript 3 firstLineMatch

Brenton Simpson brenton at appsforartists.com
Sun May 24 18:14:29 UTC 2009


>> I believe this is the correct firstLineMatch for AS3:
>> package\s?([\w\.]*)\s?{
>
> You need to add a ^ assertion to the beginning of that at least. And
> you need to make sure it can't get triggered in D, Doxygen, Groovy,
> Java, JavaScript, Processing, Scala. (The languages I quickly scanned
> to see have a package keyword that could get tripped up)

I did some quick research:
  - The Java-based languages use a semi-colon, rather than a brace.
  - D uses 'module' to define its packages.
  - Before I added the firstLineMatch, my files were coming up as  
plain-text.  If there's a language this pattern conflicts with,  
TextMate doesn't know about it out-of-the-box.

Here's a slightly-modified version that caps the ends of the string.   
It also makes the { optional (in case someone puts his braces on the  
next line):
^package\s?([\w\.]*)\s?{?$


> I used  \bAS3\b because comments are as likely to be found on the
> first line as package declarations. So, for anyone who wanted to,
> adding 'AS3' would  help TM identify ActionScript 3 over ActionScript
> files.
>
> I've also taken the liberty of adding 'AS3' into the comment header
> for the same reason.

I'd venture a guess that package ... { is the handily the most common  
first line of an AS class; however, why don't we use either method?
(^package\s?([\w\.]*)\s?{?$)|(\bAS3\b)

Note:  I get this as a first line if I do new AS3 class from template:
package .var.folders.NQ.NQfuLuLLE+aVJJfvkTLNwU+++TI.-Tmp- {


I imagine I'll have plenty to contribute in the way of bundlie- 
goodness.  I don't personally use a version control system, and I'm  
not wed to any of them.  Is there any sort of utility that will enable  
me to contribute to any of them, so I could fork somebody on github  
and somebody else on bitbucket without having to mess with git and hg?

Thanks,
B



More information about the textmate mailing list