Hi! Is there a way to match an expression whose all delimiters are balanced as a regular exprseeion pattern?
For instance, I have a custom defined language where the following syntax is ok:
procedure foo(sequence s,integer n=length(s)+3,integer p=0) -- stuff() end procedure
The issue now is to detect when the parameter list ends, since using a plain \) obviously will stop too early.
TIA CChris
Assuming there's no white space after the last ) the regexp for that is:
)$
Try it in a hand search using regexp.
Whoops! Just tested it. Notepad++ can't find it, but my GNU Grep tool which uses regular expressions found both of them.
See what you come up with.
Here's the output from my command prompt
[code] J:\Temporary>type crap-reg-exp.txt test one test two) test )three) J:\Temporary>grep -r ")$" crap-reg-exp.txt test two) test )three)
J:\Temporary>[/code]
>
Not only there may be whitespace after the last parenthesis, but there might be a comment starting with "--".
And I didn't check what happens when an argument list spans several lines.
Though I didn't find this yet, the following is very acceptable code, and pretty readable as well:
function bar( integer a1, -- the 1st arg integer a2 = foo() -- the second, defaulted arg ) -- calls baz() and validates output
Now the challlenge is to get FunctionList to process that declaration in a sensible way.
CChris
Hi!
Is there a way to match an expression whose all delimiters are balanced as a regular exprseeion pattern?
For instance, I have a custom defined language where the following syntax is ok:
procedure foo(sequence s,integer n=length(s)+3,integer p=0)
-- stuff()
end procedure
The issue now is to detect when the parameter list ends, since using a plain \) obviously will stop too early.
TIA
CChris
Assuming there's no white space after the last ) the regexp for that is:
)$
Try it in a hand search using regexp.
Whoops! Just tested it. Notepad++ can't find it, but my GNU Grep tool which uses regular expressions found both of them.
See what you come up with.
Here's the output from my command prompt
[code]
J:\Temporary>type crap-reg-exp.txt
test one
test two)
test )three)
J:\Temporary>grep -r ")$" crap-reg-exp.txt
test two)
test )three)
J:\Temporary>[/code]
>
Not only there may be whitespace after the last parenthesis, but there might be a comment starting with "--".
And I didn't check what happens when an argument list spans several lines.
Though I didn't find this yet, the following is very acceptable code, and pretty readable as well:
function bar(
integer a1, -- the 1st arg
integer a2 = foo() -- the second, defaulted arg
) -- calls baz() and validates output
Now the challlenge is to get FunctionList to process that declaration in a sensible way.
CChris