Skip to content

'DynFlag'-free version of 'mkParserFlags'

Alec Theriault requested to merge harpocrates/ghc:arcpatch-D5405 into master

Summary: This is a fixed version of the reverted d2fbc33c and 5aa29231.

Obtaining a DynFlags is difficult, making using the lexer/parser for pure parsing/lexing unreasonably difficult, even with mkPStatePure. This is despite the fact that we only really need

* language extension flags
* warning flags
* a handful of boolean options

The new mkParserFlags' function makes is easier to directly construct a ParserFlags. Furthermore, since pExtsBitmap is just a footgun, I've gone ahead and made ParserFlags an abstract type.

Also, we now export ExtBits and getBit instead of defining/exporting a bunch of boilerplate functions that test for a particular 'ExtBits'. In the process, I also

  • cleaned up an unneeded special case for ITstatic
  • made UsePosPrags another variant of ExtBits
  • made the logic in reservedSymsFM match that of reservedWordsFM

Test Plan: make test

Reviewers: bgamari, alanz, tdammers

Subscribers: sjakobi, tdammers, rwbarton, mpickering, carter

GHC Trac Issues: #11301

Differential Revision: https://phabricator.haskell.org/D5405

Merge request reports