Community
    • Login

    Powershell 5 parser

    Scheduled Pinned Locked Moved General Discussion
    1 Posts 1 Posters 184 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
      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
      • First post
        Last post
      The Community of users of the Notepad++ text editor.
      Powered by NodeBB | Contributors