File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,26 @@ while ($thisParent) {
2424
2525 </Script >
2626 </ScriptMethod >
27+ <ScriptProperty >
28+ <Name >Tokens</Name >
29+ <GetScriptBlock >
30+ $text = $this.Extent.ToString()
31+
32+ $previousToken = $null
33+ $tokenCount = 0
34+ @(foreach ($token in [Management.Automation.PSParser]::Tokenize($text, [ref]$null)) {
35+ Add-Member NoteProperty Text $text -Force -InputObject $token
36+ Add-Member NoteProperty PreviousToken $previousToken -Force -InputObject $token
37+ if ($token.Type -in 'Variable', 'String') {
38+ $realContent = $text.Substring($token.Start, $token.Length)
39+ Add-Member NoteProperty Content $realContent -Force -InputObject $token
40+ }
41+ $previousToken = $token
42+ $tokenCount++
43+ $token
44+ })
45+ </GetScriptBlock >
46+ </ScriptProperty >
2747 </Members >
2848 </Type >
2949 <Type >
You can’t perform that action at this time.
0 commit comments