'DynFlag'-free version of 'mkParserFlags'

Authored by harpocrates on Dec 2 2018, 12:49 AM.



This is a fixed version of the reverted d2fbc33c4ff3074126ab71654af8bbf8a46e4e11
and 5aa29231ab7603537284eff5e4caff3a73dba6d2.

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

Diff Detail

rGHC Glasgow Haskell Compiler
Lint WarningsExcuse: Sorry
Warningcompiler/parser/Lexer.x:364TXT3Line Too Long
Warningcompiler/parser/Lexer.x:366TXT3Line Too Long
Warningcompiler/parser/Lexer.x:371TXT3Line Too Long
Warningcompiler/parser/Lexer.x:429TXT3Line Too Long
Warningcompiler/parser/Lexer.x:491TXT3Line Too Long
Warningcompiler/parser/Lexer.x:492TXT3Line Too Long
Warningcompiler/parser/Lexer.x:493TXT3Line Too Long
Warningcompiler/parser/Lexer.x:494TXT3Line Too Long
Warningcompiler/parser/Lexer.x:495TXT3Line Too Long
Warningcompiler/parser/Lexer.x:496TXT3Line Too Long
Warningcompiler/parser/Lexer.x:497TXT3Line Too Long
Warningcompiler/parser/Lexer.x:498TXT3Line Too Long
Warningcompiler/parser/Lexer.x:499TXT3Line Too Long
Warningcompiler/parser/Lexer.x:502TXT3Line Too Long
Warningcompiler/parser/Lexer.x:503TXT3Line Too Long
Warningcompiler/parser/Lexer.x:504TXT3Line Too Long
Warningcompiler/parser/Lexer.x:506TXT3Line Too Long
Warningcompiler/parser/Lexer.x:507TXT3Line Too Long
Warningcompiler/parser/Lexer.x:514TXT3Line Too Long
Warningcompiler/parser/Lexer.x:515TXT3Line Too Long
Warningcompiler/parser/Lexer.x:516TXT3Line Too Long
Warningcompiler/parser/Lexer.x:517TXT3Line Too Long
Warningcompiler/parser/Lexer.x:518TXT3Line Too Long
Warningcompiler/parser/Lexer.x:519TXT3Line Too Long
Warningcompiler/parser/Lexer.x:520TXT3Line Too Long
No Unit Test Coverage
Build Status
Buildable 25449
Build 64593: [GHC] Linux/amd64: Continuous Integration
Build 64592: [GHC] OSX/amd64: Continuous Integration
Build 64591: [GHC] Windows/amd64: Continuous Integration
Build 64590: arc lint + arc unit
harpocrates created this revision.Dec 2 2018, 12:49 AM
harpocrates retitled this revision from Simplify 'ExtBits' in the lexer to 'DynFlag'-free version of 'mkParserFlags'.Dec 2 2018, 1:02 AM
harpocrates edited the summary of this revision. (Show Details)
harpocrates updated the Trac tickets for this revision.

@bgamari This lumps together fixed changes from the two reverted patches D5269 and D5332.

tdammers requested changes to this revision.Dec 3 2018, 6:09 AM
tdammers added a subscriber: tdammers.
tdammers added inline comments.

Personally, I find ifExtension more descriptive than isBit - I think the code should still signal the intent "if extension X is enabled, then do this".

This revision now requires changes to proceed.Dec 3 2018, 6:09 AM
  • ifBit -> isExtension
harpocrates marked an inline comment as done.Dec 12 2018, 1:39 PM

@tdammers Are you satisfied with the latest changes?