forked from microsoft/SqlScriptDOM
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLexerPostProcessing.ps1
More file actions
13 lines (13 loc) · 1.01 KB
/
LexerPostProcessing.ps1
File metadata and controls
13 lines (13 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
# String comparison
$content = [System.IO.File]::ReadAllText($args[0]).Replace("CaseInsensitiveHashCodeProvider.Default,","StringComparer.OrdinalIgnoreCase")
$content = $content.Replace("CaseInsensitiveComparer.Default","")
# We don't want wrapper exceptions - IOException is totally fine!
$content = $content.Replace("using TokenStreamIOException = antlr.TokenStreamIOException;","")
$content = $content.Replace("using CharStreamException = antlr.CharStreamException;","")
$content = $content.Replace("using CharStreamIOException = antlr.CharStreamIOException;","")
# We don't want exceptions wrapping logic!
$content = $content.Replace("catch (CharStreamException cse) {","finally {")
$content = $content.Replace("if ( cse is CharStreamIOException ) {","if (false) {")
$content = $content.Replace("throw new TokenStreamIOException(((CharStreamIOException)cse).io);","")
$content = $content.Replace("throw new TokenStreamException(cse.Message);","")
[System.IO.File]::WriteAllText($args[1], $content)