Community
    • Login

    Powershell 5 parser

    Scheduled Pinned Locked Moved General Discussion
    1 Posts 1 Posters 306 Views
    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.
    • Paul LewisP Offline
      Paul Lewis
      last edited by

      I was working on a project that utilised Powershell 5 classes. I made this modification to my functionList.xml. I jumbly submit it here for those it may help (and for anyone that has improvements)

      <!-- ================================================== [ PowerShell 5 ] -->
      
      			<parser
      				displayName="PowerShell"
      				id         ="powershell_syntax"
      				commentExpr="(?x)                                               # Utilize inline comments (see `RegEx - Pattern Modifiers`)
      								(?s:\x3C\x23(?:[^\x23]|\x23[^\x3E])*\x23\x3E)   # Multi Line Comment
      							|	(?m-s:\x23.*$)                                  # Single Line Comment
      							"
      			>
                      <classRange
      					mainExpr    ="(?ms)class\s+[A-Za-z_0-9\-]+[^{]*({(((?>[^{}]+)|(?1))*)})"
      
      				>
      					<className>
      						<nameExpr expr="(?:class\s+)([^{]*)" />
      					</className>
      					<function
      						mainExpr="(?xmi)(?:\[[A-Za-z:\.\[\]]*\])
      							\s*
      							[A-Za-z_\-]+
      							[^{]+"
      					>
      						<functionName>
      							<funcNameExpr expr=".*" />
      						</functionName>
      					</function>
      				</classRange>            
                  
      				<function
      					mainExpr="(?xmi)(?:function|filter)
      							\s*
      							[A-Za-z_\-]+							
      							[^{]+
      						"
      				>
      					<functionName>
      						<nameExpr expr="(?i)[A-Za-z_\-]*\s*[^{]+" />
      					</functionName>
      				</function>
      			</parser>
      
      1 Reply Last reply Reply Quote 1

      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