On Oct 30, 2006, at 5:36 AM, Fritz Anderson wrote:

The regular expression that works for me in Find is:
        (?s)^([ \t]*)function\s+(?P<function_name>[A-Za-z_:.]+).+?\r\1end\b

The intention is to match an end statement with the same leading whitespace as the function line.

But putting it into lua.plist (substituting &lt; and &gt; for < and >) does not populate the function popup.

Fritz,

I've logged a bug against the documentation so this is made clear in the future.

You are running into the following problem. The function pattern used to scan for functions is based on your pattern. (It also combines the string, comment and skip patterns.) Since you don't know how they patterns are combined (and if you did, shouldn't rely on it is an implementation detail which may change if necessary) you can't use positional backreferences within your pattern.

The solution is to use named backreferences:

      <key>Function Pattern</key>
<string>(?s)^(?P&lt;leading_indent&gt;[ \t]*)function\s+(? P&lt;function_name&gt;[A-Za-z_:.]+).+?\r(?P=leading_indent)end\b</ string>

Jim


--
------------------------------------------------------------------
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