File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ open System.IO
99open System.Threading
1010open System.Collections .Generic
1111
12+ open FSharp.Compiler .Parser
1213open Internal.Utilities .Collections
1314open Internal.Utilities .Library
1415open Internal.Utilities .Library .Extras
@@ -509,9 +510,23 @@ type Tokenizer = unit -> Parser.token
509510
510511// Show all tokens in the stream, for testing purposes
511512let ShowAllTokensAndExit ( tokenizer : Tokenizer , lexbuf : LexBuffer < char >, exiter : Exiter ) =
513+ let mutable indent = 0
514+
512515 while true do
513516 let t = tokenizer ()
514- printfn $" {Parser.token_to_string t} {lexbuf.LexemeRange}"
517+
518+ indent <-
519+ match t with
520+ | OBLOCKEND_ IS_ HERE -> max ( indent - 1 ) 0
521+ | _ -> indent
522+
523+ let indentStr = String.replicate indent " "
524+ printfn $" {indentStr}{token_to_string t} {lexbuf.LexemeRange}"
525+
526+ indent <-
527+ match t with
528+ | OBLOCKBEGIN -> indent + 1
529+ | _ -> indent
515530
516531 match t with
517532 | Parser.EOF _ -> exiter.Exit 0
You can’t perform that action at this time.
0 commit comments