Hey guys I’m working with a custom scripting language and I am making a sort of IDE for this language in C#. In this language the functions are defined like this:
yourfunctionhere(possiblepararmhere)
{
yourcodehere;
}
I’ve been trying to figure out the best way to get a list of all the functions via regex and couldn’t find a working way to get a list of all the defined functions. Could somebody tell me of a better way or a way to do it with regex? Thanks a lot!
EDIT:
Would something like this work in C#? %[a-z_0-9^[^]*]++ [a-z_0-9*^[^]]+[ ^t]++[a-z_0-9*^[^]]+[ ^t]++^([*a-z_0-9]+^)[ ^t]++([^p*&, ^t^[^]a-z_0-9./(!]++)[~;]
If you just want a list of function names something like this might work:
Basically, that regex is looking for any group of alphanumeric characters, followed by optional white space, followed an open parenthesis, followed by zero or more non-parentheses, followed by a close parenthesis, followed by optional white space, and then an open curly brace.
Then from there you extract just the beginning portion, and create a list. Assuming the language does not otherwise allow a close parenthesis to be followed by an open curly bracket, then the above should work. Otherwise more details would be needed.