[TxMt] Perl language definition: switch, case?

Andy Armstrong andy at hexten.net
Sun Feb 3 12:24:32 UTC 2008


On 3 Feb 2008, at 11:43, Allan Odgaard wrote:
> The switch/case might be the result of initially basing the grammar  
> on the C grammar. So presumably it should be removed.
>
>> Also, because I'm a TM language definition newbie, does anyone have  
>> any tips about how to handle the // (defined or) operator? In some  
>> contexts // is an empty regex; in others it's an operator
>
> In the Ruby grammar we have a list of functions that take regexp  
> arguments to solve the division/regexp ambiguity -- something  
> similar could be done for perl wrt the split case.


I should have been more explicit. In Perl 5.10.0 // could be an empty  
regex or the new 'defined or' operator:

my $foo = $bar // 'not defined';	# new defined-or operator
my @f = split //, $baz;			# empty regex

And yes, "only perl can parse Perl" :)

-- 
Andy Armstrong, Hexten







More information about the textmate mailing list