multiple function types in functionList
-
Is there a way to have a functionList setup for a language where I have two different types of “functions” that I want to find? For instance I have the following functionList entry:
<parser id="vsoc_function" displayName="VSOC"> <function mainExpr="^[\s]*(?<!#)[\s]*(pre|post)processor[\s]+[\w-]+[\s]*\(?[^\)\(]*?\)?[\n\s]*\{" displayMode="node"> <className> <nameExpr expr="[\w-]+(?=-)"/> </className> <functionName> <nameExpr expr="((pre|post)processor[\s]+)?[\w-]+-\K[\w]+"/> </functionName> </function> </parser>which matches lines like
preprocessor Test-Class-Name-functionName {but I also want to be able to match lines like
Label = "clear_and_exit";Which I use this regex for:
<parser id="vsoc_function2" displayName="VSOC"> <function mainExpr="^[\s]*Label[\s]*=[\s]*"[^"]+"" displayMode="$className->$functionName"> <className> <nameExpr expr="Label"/> </className> <functionName> <nameExpr expr="Label[\s]*=[\s]*"\K[^"]+"/> </functionName> </function> </parser>Independently these both work as I want but I haven’t found any way to have both functionLists to be applied at the same time. Ideally I want to be able to use the function list to quickly go to any specific function or label.
-
Hello Kevin-Cryan,
well, I’m not a regex expert and I used your examples to make it work somehow.
<parser id="vsoc_function" displayName="VSOC"> <function mainExpr="^[\s]*(?<!#)[\s]*(((pre|post)processor)|Label)[\s]+([\w-]|=)+[\s]*((\(?[^\)\(]*?\)?[\n\s]*\{)|("[^"]+"))" > <functionName> <nameExpr expr="((Label[\s]*=[\s]*"\K[^"]+)| ((pre|post)processor[\s]+)?[\w-]+-\K[\w]+)"/> </functionName> </function> </parser>If it doesn’t make sense, then please ignore it. I’m still trying to understand most of the regex secrets.
But if it makes sense I guess you can use it to modify it to your needs.Cheers
Claudia -
Thanks. I will give it try.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login