PHP Alternate Syntax & Folding

View: New views
3 Messages — Rating Filter:   Alert me  

PHP Alternate Syntax & Folding

by Peter Bonnell :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi there,
  I'm using build 1509 (Cutting Edge).
I'm experimenting with PHP alternate syntax (no curly braces) and  
can't get the blocks to fold.
My PHP language bundle contains the following:
foldingStartMarker = '(/\*|\{\s*$|<<<HTML)';
foldingStopMarker = '(\*/|^\s*\}|^HTML;)';

Can anybody point me in the right direction to get my alternate syntax  
to play nice ?

PHP alt syntax looks like this:
if ($high < 11):
        return $high;
        else : return false;
endif;

-Peter

_______________________________________________
textmate mailing list
textmate@...
http://lists.macromates.com/listinfo/textmate

Re: PHP Alternate Syntax & Folding

by Allan Odgaard-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 22 Oct 2009, at 18:54, Peter Bonnell wrote:

> I'm experimenting with PHP alternate syntax (no curly braces) and
> can't get the blocks to fold.
> My PHP language bundle contains the following:
> foldingStartMarker = '(/\*|\{\s*$|<<<HTML)';
> foldingStopMarker = '(\*/|^\s*\}|^HTML;)';
>
> Can anybody point me in the right direction to get my alternate syntax
> to play nice ?

The problem here is that folding patterns are only taken from the root  
grammar, which I assume is HTML (which include your PHP grammar). So  
you will (unfortunately) need to add these patterns to the HTML grammar.


_______________________________________________
textmate mailing list
textmate@...
http://lists.macromates.com/listinfo/textmate

Re: PHP Alternate Syntax & Folding

by Catalin Ivan :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

this seems to work:
        foldingStartMarker = '(/\*|\{[^}]*$|<<<HTML|if.*\(|switch.*\()';
        foldingStopMarker = '(\*/|^\s*\}|^HTML;|endif;|endswitch;)';

...when the markers are indented at the same level.

cat