Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion src/Compiler/Driver/ParseAndCheckInputs.fs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ open System.IO
open System.Threading
open System.Collections.Generic

open FSharp.Compiler.Parser
open Internal.Utilities.Collections
open Internal.Utilities.Library
open Internal.Utilities.Library.Extras
Expand Down Expand Up @@ -509,9 +510,23 @@ type Tokenizer = unit -> Parser.token

// Show all tokens in the stream, for testing purposes
let ShowAllTokensAndExit (tokenizer: Tokenizer, lexbuf: LexBuffer<char>, exiter: Exiter) =
let mutable indent = 0

while true do
let t = tokenizer ()
printfn $"{Parser.token_to_string t} {lexbuf.LexemeRange}"

indent <-
match t with
| OBLOCKEND_IS_HERE -> max (indent - 1) 0
| _ -> indent

let indentStr = String.replicate indent " "
printfn $"{indentStr}{token_to_string t} {lexbuf.LexemeRange}"

indent <-
match t with
| OBLOCKBEGIN -> indent + 1
| _ -> indent

match t with
| Parser.EOF _ -> exiter.Exit 0
Expand Down