-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathCountVariables.ps1
More file actions
25 lines (18 loc) · 1.21 KB
/
Copy pathCountVariables.ps1
File metadata and controls
25 lines (18 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
$output_file = ".\TestOut.txt"
$f = Get-Content ".\Test.txt"
$reg = "^[ ]*(?(?=(?!return|template|struct|private|public|protected|case|default|if|switch|delete|0x|[0-9]+|typedef|using|break|while|for|\[[a-zA-Z\(\)0-9]\]|enum|class|friend|#|\/|\||\n))\s*(?!:)([a-zA-Z0-9_]\s*[*&:]*(\<([a-zA-Z0-9_, *+\/-])*\>)*\s*[*&, \n]*)+[^{]$|(*SKIP)^)"
#"^[ ]*(?!return|template|struct|private|public|protected|case|default|if|switch|delete|0x|[0-9]+|typedef|using|break|while|for|\[[a-zA-Z\(\)0-9]\]|enum|class|friend|#|\/|\||\n)\s*(?!:)([a-zA-Z0-9_]\s*[*&:]*(\<([a-zA-Z0-9_, *+\/-])*\>)*\s*[*&, \n]*)+[^{]$"
#"([a-zA-Z_]+[a-zA-Z0-9_]*(\<[a-zA-Z0-9_]+\>)*[(\:\:) ]+[a-zA-Z_]+[a-zA-Z0-9_]*)+([() ])*;"
#'f = ' + $f
cd "Windows"
$q = (gc (dir -include *.h,*.cpp,*.hlsl,*.hlsli -recurse))
'$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$'
$q
# | % { $_.Matches } | % { $_.Value } > $output_file
#
$c = ($q | select-string -Pattern $reg -AllMatches) #($f | select-string -Pattern $reg -AllMatches).Count
cd ..
'$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$'
'c = ' + $c
'$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$'
'count = ' + $c.Count