@@ -305,48 +305,44 @@ module Keywords =
305305 keywordList |> List.map ( fun ( _ , w , _ ) -> w)
306306
307307 let keywordTable =
308- // TODO: this doesn't need to be a multi-map, a dictionary will do
309308 let tab = System.Collections.Generic.Dictionary< string, token>( 100 )
310- for (_ mode, keyword, token) in keywordList do tab.Add( keyword, token)
309+ for _, keyword, token in keywordList do
310+ tab.Add( keyword, token)
311311 tab
312312
313313 let KeywordToken s = keywordTable.[ s]
314314
315- /// ++GLOBAL MUTABLE STATE. Note this is a deprecated, undocumented command line option anyway, we can ignore it.
316- let mutable permitFsharpKeywords = true
317-
318315 let IdentifierToken args ( lexbuf : UnicodeLexing.Lexbuf ) ( s : string ) =
319316 if IsCompilerGeneratedName s then
320317 warning( Error( FSComp.SR.lexhlpIdentifiersContainingAtSymbolReserved(), lexbuf.LexemeRange));
321318 args.resourceManager.InternIdentifierToken s
322319
323320 let KeywordOrIdentifierToken args ( lexbuf : UnicodeLexing.Lexbuf ) s =
324- if not permitFsharpKeywords && List.contains s unreserveWords then
325- // You can assume this condition never fires - this is a deprecated, undocumented command line option anyway, we can ignore it.
326- IdentifierToken args lexbuf s
327- else
328- let mutable v = Unchecked.defaultof<_>
329- if keywordTable.TryGetValue( s, & v) then
330- if ( match v with RESERVED -> true | _ -> false ) then
331- warning( ReservedKeyword( FSComp.SR.lexhlpIdentifierReserved( s), lexbuf.LexemeRange));
332- IdentifierToken args lexbuf s
333- else v
334- else
321+ match keywordTable.TryGetValue s with
322+ | true , v ->
323+ match v with
324+ | RESERVED ->
325+ warning( ReservedKeyword( FSComp.SR.lexhlpIdentifierReserved( s), lexbuf.LexemeRange));
326+ IdentifierToken args lexbuf s
327+ | _ -> v
328+ | _ ->
335329 match s with
336330 | " __SOURCE_DIRECTORY__" ->
337331 let filename = fileOfFileIndex lexbuf.StartPos.FileIndex
338- let dirname = if filename = stdinMockFilename then
339- System.IO.Directory.GetCurrentDirectory()
340- else
341- filename |> FileSystem.GetFullPathShim (* asserts that path is already absolute *)
342- |> System.IO.Path.GetDirectoryName
332+ let dirname =
333+ if filename = stdinMockFilename then
334+ System.IO.Directory.GetCurrentDirectory()
335+ else
336+ filename
337+ |> FileSystem.GetFullPathShim (* asserts that path is already absolute *)
338+ |> System.IO.Path.GetDirectoryName
343339 KEYWORD_ STRING dirname
344340 | " __SOURCE_FILE__" ->
345- KEYWORD_ STRING ( System.IO.Path.GetFileName(( fileOfFileIndex lexbuf.StartPos.FileIndex)))
341+ KEYWORD_ STRING ( System.IO.Path.GetFileName(( fileOfFileIndex lexbuf.StartPos.FileIndex)))
346342 | " __LINE__" ->
347- KEYWORD_ STRING ( string lexbuf.StartPos.Line)
343+ KEYWORD_ STRING ( string lexbuf.StartPos.Line)
348344 | _ ->
349- IdentifierToken args lexbuf s
345+ IdentifierToken args lexbuf s
350346
351347 /// A utility to help determine if an identifier needs to be quoted
352348 let QuoteIdentifierIfNeeded ( s : string ) : string =
0 commit comments