[SVN] Re: Any chance of a little help sorting this language regexp to make php coding less painful in textmate?

Gabriel Gilder gabriel at gabrielgilder.com
Tue Dec 14 20:06:14 UTC 2010


I took a look and I can't make it work either... I also noticed that none of
the built-in folding markers besides curly brackets are working. From the
definition it looks like folding should be applied to multiline comments and
heredoc strings, but neither of those is triggering folding for me.

-Gabriel



On Tue, Dec 14, 2010 at 11:32 AM, Chris Adams <wave at chrisadams.me.uk> wrote:

> Hi there,
>
> I'm been trying for the last few hours to understand how Textmate's
> handling of language syntaxes works, and more specifically how it
> handles code foldings, and I can't for the life of me work out how to
> do something that sounds embarrassingly simple.
>
> I'm trying to make the php language declaration treat 'array()' the
> same way as it treats '{}' or '()', where the contents of the closure
> can be folded down for greater readability, using the normal text
> folding commands available in Textmate.
>
> Here are the standard folding stop and start markers for php:
>
>        foldingStartMarker = '(/\*|\{\s*$|<<<HTML)';
>        foldingStopMarker = '(\*/|^\s*\}|^HTML;)';
>
> Based on these regular expressions, I'd expect to need something like this:
>
>        foldingStartMarker = '(/\*|\{\s*$|<<<HTML|array\(\s*$)';
>        foldingStopMarker = '(\*/|^\s*\}|^HTML;|^\s*\),)';
>
> Taken more slowly, for the foldingStartMarker, as in:
>
> array\(\s*$
>
> I mean
>
> any pattern starting with 'array(' that then ends then ends with a
> linebreak, allowing for any amount of whitespace beforehand
>
> And then ends with
>
> ^\s*\),
>
> Or in something closer to english:
>
> Any amount of whitespace from the beginning of a line, ending with a
> closing parenthesis and a comma
>
> Yet none of the approaches or variants I have tried now seem to work,
> and I'm now reduced to guessing at the right regular expression here.
>
> I can't be the only textmate user who has to use php sometimes, and
> being able to fold arrays would make a lot of php code much less
> unpleasant to read.
>
> Can a charitable soul help put me right here?
>
> I've put together a sample gist here, to test any working regular
> expressions against.
>
>
> https://gist.github.com/736311
>
>
> --
> Chris Adams
> mob: 07974 368 229
> tel: 0207 558 8971
> skype: chris.d.adams
> twitter: mrchrisadams
>
>
>
> --
> Chris Adams
> mob: 07974 368 229
> tel: 0207 558 8971
> skype: chris.d.adams
> twitter: mrchrisadams
> _______________________________________________
> textmate-dev mailing list
> textmate-dev at lists.macromates.com
> http://lists.macromates.com/listinfo/textmate-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macromates.com/textmate-dev/attachments/20101214/d9586377/attachment.html>


More information about the textmate-dev mailing list