I want to get one or more ->func(xxx,xxx)
at the end of a piece of code.
Their could be like this:
any code any code ->func(xxx)
or
any code any code
->func()
or
any code any code
-funcA()->funcB(xxx)
or
any code any code
->funcA()
->funcB(xxx)
or mix them:
o.start_time = obj.s;
o.repair_type -> obj.r;
o.limit -> obj.l;->god("('\"\"')") ->fox(,'->')
->egg()->dog(,'c')
->cat(,'b')-> banana(,'a"\'\(\)\'->"()') -> apple(,'a')
In this code, i want to :
plan A
- get substring
apple(,'a')
- remove
-> apple(,'a')
- get substring
banana(,'a"\'\(\)\'->"()')
- remove
-> banana(,'a"\'\(\)\'->"()')
- get substring
cat(,'b')
- remove
->cat(,'b')
- get substring
dog(,'c')
- remove
->dog(,'c')
- get
egg()
- remove
->egg()
- get
fox(,'->')
- remove
->fox(,'->')
- get
god("('\"\"')")god("('\"\"')")
- remove
->god("('\"\"')")
- OVER
- get substring
plan B:
- get and remove
->cat(,'b')-> banana(,'a"\'\(\)\'->"()') -> apple(,'a')
- get substring
apple(,'a')
- remove
-> apple(,'a')
- get substring
banana(,'a"\'\(\)\'->"()')
- remove
-> banana(,'a"\'\(\)\'->"()')
- get substring
cat(,'b')
- remove
->cat(,'b')
- get substring
- get and remove
->egg()->dog(,'c')
- get substring
dog(,'c')
- remove
->dog(,'c')
- get
egg()
- remove
->egg()
- get substring
- get and remove
->god("('\"\"')") ->fox(,'->')
- get
fox(,'->')
- remove
->fox(,'->')
- get
god("('\"\"')")god("('\"\"')")
- remove
->god("('\"\"')")
- get
- OVER
- get and remove
Now, I am trying planB by this two RegEx, but not good enough:
loop
if match "\R\s*->\s*(.+)$"
get substring and remove
loop substring
if match "(?:(?<=\)).)*\s*->\s*(((?!->).)*)$"
push substring2 to arr
remove substring2
else
break
else
break