Hi Pete,

I tried to set up a language module for a project management syntax, where I consider projects beeing functions. My 'functions' look like this:


Project name_of_project
{
        ... here comes all the stuff belonging to the project
        even subprojects should be possible
        {
                ... subproject info here
        }
}


this Function Pattern did the job for me:

<key>Function Pattern</key>
<string>(?P&lt;function&gt;Project (?P&lt;function_name&gt;.+?)\s*{(? s).+?^})</string>


Note 0: I have set the Open/Close-Statement-Blocks-keys to { and }
Note 1: There seems no need to give the function_name back with a (? P=function_name) expression. Note 2: I had to include the whole statement block (all the stuff between the outermost {}-pair) in the expression in order to achieve a recoginition of the whole thing as a function (and therefor being able to fold the whole body function). I don't know, if this is really necessary, but it didn't work for me without that. Perhaps somebody can clarify that?

I also have the problem that folding only works for top-level {}- part. Subproject brackets are not recognized. Perhaps someone has deeper knowledge of the relation between the statement blocks and the folding behavior and wants to share this?

Greets, roland

Am 08.09.2006 um 00:49 schrieb [EMAIL PROTECTED]:

On 2006-09-07, at 21:44, Patrick Woolsey wrote:

[EMAIL PROTECTED] sez:

What's a named subpattern, though? I've not heard of these before.
Also a bit puzzled about those angle brackets...

A named subpattern is one of the form:

(?P<name>...)

Thanks, Patrick. I didn't manage to find this information easily, at least in BBEdit's docs, but I found a Python reference via Google. I also discovered reasonably quickly that the angle brackets should be encoded as &lt; and &gt; otherwise the CLM fails to load. :-)

I assume that the idea is to provide something like this:

<key>Function Pattern</key>
<string>(?P&lt;function_name&gt;(func.*)(?P=function_name)</ string>

where the (func.*) - part of the named pattern definition - is some kind of regex pattern that matches the names of the functions you're using, and that you then refer to the named pattern again after defining it, in order to return it, and then you've got to do two, function_name and function? Is this the basic idea? Would the patterns be in parentheses or not? Or I have got it all wrong...?



--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <[EMAIL PROTECTED]>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to:  <[EMAIL PROTECTED]>



--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <[EMAIL PROTECTED]>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to:  <[EMAIL PROTECTED]>

Reply via email to