I'm having some trouble working out a function string that only finds the actual function definitions, and not the forward declarations as well.
E.g the scripts are like this
My problem is, in the function list Minister_Attack_Bases shows twice.
What I'd like is to just have the actual functions in this list, but I can't work out a regex to do this.
Can anyone give me a hand coming up with a regex to do that please?
I believe the vars part is compulsory for actual functions and doesn't exist for forward declarations.
Perhaps, if the regex could look for the function line, then look for a line starting with vars or end and if it found end without finding vars first it would not be a match? That's way beyond my regex skills though - I can't even get it to search across multiple lines.
So far I got ^[[:blank:]]*function[[:blank:]]+([^[:s:]]+)[[:blank:]]+returns
using the perl regex, but this causes the described problem.
I'm using UES 9 BTW.
E.g the scripts are like this
Code: Select all
// Forward declarations
function Minister_Attack_Bases returns boolean
params
ship_id: long
end
function Minister_Attack_Ships_Normal returns boolean
params
ship_id: long
end
// Actual functions
function Minister_Attack_Bases returns boolean
params
ship_id: long
vars
orders_given: boolean := FALSE
begin
code...
end
function Minister_Attack_Ships_Normal returns boolean
params
ship_id: long
vars
orders_given: boolean := FALSE
begin
code...
end
What I'd like is to just have the actual functions in this list, but I can't work out a regex to do this.
Can anyone give me a hand coming up with a regex to do that please?
I believe the vars part is compulsory for actual functions and doesn't exist for forward declarations.
Perhaps, if the regex could look for the function line, then look for a line starting with vars or end and if it found end without finding vars first it would not be a match? That's way beyond my regex skills though - I can't even get it to search across multiple lines.
So far I got ^[[:blank:]]*function[[:blank:]]+([^[:s:]]+)[[:blank:]]+returns
using the perl regex, but this causes the described problem.
I'm using UES 9 BTW.