-
Notifications
You must be signed in to change notification settings - Fork 750
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reimplement PowerShell lexer (#1213)
The existing PowerShell lexer subclasses the Shell lexer and extends/modifies its rules. However, while PowerShell is a shell, its syntax and grammar is far richer than other shells. This commit replaces the existing lexer with a new lexer that is independent of the Shell lexer.
- Loading branch information
Showing
3 changed files
with
352 additions
and
721 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,13 @@ | ||
Function Get-IPv4Scopes | ||
<# | ||
.SYNOPSIS | ||
Read IPv4Scopes from an array of servers | ||
.PARAMETER Servers | ||
Specifies an array of servers | ||
.EXAMPLE | ||
Get-IPv4Scopes | ||
|
||
Will prompt for all inputs | ||
#> | ||
function Verb-Noun | ||
{ | ||
[CmdletBinding()] | ||
Param( | ||
# 1 | ||
[parameter( | ||
Mandatory=$true, | ||
Position=0, | ||
ValueFromPipelineByPropertyName=$true, | ||
HelpMessage="Server List" | ||
)] | ||
[string[]]$Servers, | ||
#2 | ||
[parameter(Mandatory=$false,ValueFromPipeline=$false)] | ||
[bool]$Unique=$false | ||
) #EndParam | ||
|
||
Begin {} | ||
|
||
Process { | ||
$arrayJobs=@() | ||
foreach ($server in $Servers) { | ||
$arrayJobs+=Invoke-Command -ComputerName $server -scriptblock {Get-DhcpServerv4Scope} -AsJob | ||
} | ||
$complete=$false | ||
while (-not $complete) { | ||
$arrayJobsInProgress= $arrayJobs | Where-Object { $_.State -match 'running' } | ||
if (-not $arrayJobsInProgress) { $complete=$true } | ||
} | ||
$Scopes=$arrayJobs|Receive-Job | ||
$UniqueScopes=$Scopes|Sort-Object -Property ScopeId -Unique | ||
} | ||
|
||
End { | ||
if ($Unique) { return $UniqueScopes } | ||
else { return $Scopes } | ||
} | ||
|
||
} #end function | ||
<# | ||
.SYNOPSIS | ||
Tells you what it does | ||
|
||
.DESCRIPTION | ||
Tells you what it does with more detail. | ||
#> | ||
param ([string]$Name, [string]$Extension = "txt", [string]$foo="bar") | ||
$name = $name + "." + $extension | ||
$name | ||
} |
Oops, something went wrong.