@@ -88,9 +88,7 @@ type FSharpTokenColorKind =
8888 | PreprocessorKeyword = 8
8989 | Number = 9
9090 | Operator = 10
91- #if COLORIZE_ TYPES
9291 | TypeName = 11
93- #endif
9492
9593/// Categorize an action the editor should take in response to a token, e.g. brace matching
9694///
@@ -477,15 +475,17 @@ type SingleLineTokenState =
477475[<Sealed>]
478476type FSharpLineTokenizer ( lexbuf : UnicodeLexing.Lexbuf ,
479477 maxLength: int option,
480- filename : string,
478+ filename : Option < string> ,
481479 lexArgsLightOn : lexargs,
482480 lexArgsLightOff : lexargs
483481 ) =
484482
485483 let skip = false // don't skip whitespace in the lexer
486484
487485 let mutable singleLineTokenState = SingleLineTokenState.BeforeHash
488- let fsx = CompileOps.IsScript( filename)
486+ let fsx = match filename with
487+ | None -> false
488+ | Some( value) -> CompileOps.IsScript( value)
489489
490490 // ----------------------------------------------------------------------------------
491491 // This implements post-processing of #directive tokens - not very elegant, but it works...
@@ -552,7 +552,9 @@ type FSharpLineTokenizer(lexbuf: UnicodeLexing.Lexbuf,
552552
553553
554554
555- do resetLexbufPos filename lexbuf
555+ do match filename with
556+ | None -> lexbuf.EndPos <- Internal.Utilities.Text.Lexing.Position.Empty
557+ | Some( value) -> resetLexbufPos value lexbuf
556558
557559 member x.ScanToken ( lexintInitial ) : Option < FSharpTokenInfo > * FSharpTokenizerLexState =
558560 use unwindBP = PushThreadBuildPhaseUntilUnwind ( BuildPhase.Parse)
@@ -736,7 +738,7 @@ type FSharpLineTokenizer(lexbuf: UnicodeLexing.Lexbuf,
736738 LexerStateEncoding.encodeLexCont colorState ncomments position ifdefStack light
737739
738740[<Sealed>]
739- type FSharpSourceTokenizer ( defineConstants : string list , filename : string ) =
741+ type FSharpSourceTokenizer ( defineConstants : string list , filename : Option < string > ) =
740742 let lexResourceManager = new Lexhelp.LexResourceManager()
741743
742744 let lexArgsLightOn = mkLexargs( filename, defineConstants, LightSyntaxStatus( true , false ), lexResourceManager, ref [], DiscardErrorsLogger)
0 commit comments