Community
    • Login

    multiple function types in functionList

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    3 Posts 2 Posters 2.6k Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Kevin CryanK Offline
      Kevin Cryan
      last edited by

      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]*(?&lt;!#)[\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]*&quot;[^&quot;]+&quot;" displayMode="$className->$functionName">
      				<className>
      					<nameExpr expr="Label"/>
      				</className>
      				<functionName>
      					<nameExpr expr="Label[\s]*=[\s]*&quot;\K[^&quot;]+"/>
      				</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.

      Claudia FrankC 1 Reply Last reply Reply Quote 0
      • Claudia FrankC Offline
        Claudia Frank @Kevin Cryan
        last edited by

        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]*(?&lt;!#)[\s]*(((pre|post)processor)|Label)[\s]+([\w-]|=)+[\s]*((\(?[^\)\(]*?\)?[\n\s]*\{)|(&quot;[^&quot;]+&quot;))" >
        				<functionName>
                            <nameExpr expr="((Label[\s]*=[\s]*&quot;\K[^&quot;]+)| ((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

        1 Reply Last reply Reply Quote 0
        • Kevin CryanK Offline
          Kevin Cryan
          last edited by

          Thanks. I will give it try.

          1 Reply Last reply Reply Quote 0

          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
          • First post
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors