aboutsummaryrefslogtreecommitdiff
path: root/haddock-api/src/Haddock/Backends/Hyperlinker
Commit message (Collapse)AuthorAgeFilesLines
* Remove workaround for now-fixed Clang CPP bug (#1028)Alec Theriault2019-02-111-45/+2
| | | | | | | | | | Before LLVM 6.0.1 (or 10.0 on Apple LLVM), there was a bug where lines that started with an octothorpe but turned out not to lex like pragmas would have an extra line added after them. Since this bug has been fixed upstream and that it doesn't have dire consequences anyways, the workaround is not really worth it anymore - we can just tell people to update their clang version (or re-structure their pragma code).
* Use `.hie` files for the Hyperlinker backend (#977)Alec Theriault2019-01-315-545/+488
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | # Summary This is a large architectural change to the Hyperlinker. * extract link (and now also type) information from `.hie` instead of doing ad-hoc SYB traversals of the `RenamedSource`. Also adds a superb type-on-hover feature (#715). * re-engineer the lexer to avoid needless string conversions. By going directly through GHC's `P` monad and taking bytestring slices, we avoid a ton of allocation and have better handling of position pragmas and CPP. In terms of performance, the Haddock side of things has gotten _much_ more efficient. Unfortunately, much of this is cancelled out by the increased GHC workload for generating `.hie` files. For the full set of boot libs (including `ghc`-the-library) * the sum of total time went down by 9-10% overall * the sum of total allocations went down by 6-7% # Motivation Haddock is moving towards working entirely over `.hi` and `.hie` files. This change means we no longer need the `RenamedSource` from `TypecheckedModule` (something which is _not_ in `.hi` files). # Details Along the way a bunch of things were fixed: * Cross package (and other) links are now more reliable (#496) * The lexer tries to recover from errors on every line (instead of at CPP boundaries) * `LINE`/`COLUMN` pragmas are taken into account * filter out zero length tokens before rendering * avoid recomputing the `ModuleName`-based `SrcMap` * remove the last use of `Documentation.Haddock.Utf8` (see #998) * restructure temporary folder logic for `.hi`/`.hie` model
* [TTG: Handling Source Locations] Foundation and PatShayan-Najd2018-11-231-30/+48
| | | | | | | | | | | Trac Issues #15495 This patch removes the ping-pong style from HsPat (only, for now), using the plan laid out at https://ghc.haskell.org/trac/ghc/wiki/ImplementingTreesThatGrow/HandlingSourceLocations (solution A). - the class `HasSrcSpan`, and its functions (e.g., `cL` and `dL`), are introduced - some instances of `HasSrcSpan` are introduced - some constructors `L` are replaced with `cL` - some patterns `L` are replaced with `dL->L` view pattern - some type annotation are necessarily updated (e.g., `Pat p` --> `Pat (GhcPass p)`)
* Add ITcomment_line_prag token to Hyperlinker ParserBen Sklaroff2018-08-211-5/+6
| | | | | | | | | | This token is necessary for parsing #line pragmas inside nested comments. Reviewers: bgamari Reviewed By: bgamari Differential Revision: https://phabricator.haskell.org/D4935
* Handle -XStarIsTypeVladislav Zavialov2018-06-141-0/+1
|
* Complete FixitySig and FamilyDecl pattern matchesSimon Jakobi2018-06-131-0/+3
|
* Improve hyperlinker's 'spanToNewline' (#846)Alec Theriault2018-06-131-7/+25
| | | | | | | | | | | | | | | | 'spanToNewline' is used to help break apart the source into lines which can then be partioned into CPP and non-CPP chunks. It is important that 'spanToNewline' not break apart tokens, so it needs to properly handle things like * block comments, possibly nested * string literals, possibly multi-line * CPP macros, possibly multi-line String literals in particular were not being properly handled. The fix is to to fall back in 'Text.Read.lex' to help lex things that are not comments. Fixes #837.
* Remove 'TokenGroup' from Hyperlinker (#818)Alec Theriault2018-06-131-50/+14
| | | | | Since the hyperlinker backend now relies on the GHC tokenizer, something like 'Bar.Baz.foo' already gets bunched together into one token (as opposed to being spread across 'Bar', '.', 'Baz', '.', and 'foo').
* Filter out CRLFs in hyperlinker backend (#813)Alec Theriault2018-06-131-2/+7
| | | This prevents spurious lines from appearing in the final output.
* Remove `ITtildehsh` tokenSimon Jakobi2018-06-131-1/+0
|
* DerivingVia changesRyan Scott2018-06-131-6/+1
|
* Merge branch 'ghc-head' with 'ghc-8.4'Herbert Valerio Riedel2018-05-011-26/+28
|\
| * Match changes in GHC for TTGAlan Zimmerman2018-04-271-8/+10
| |
| * Match GHC for TTG implemented on HsBinds, D4581Alan Zimmerman2018-04-131-3/+3
| |
| * Match GHC changes for TTGAlan Zimmerman2018-04-091-8/+8
| |
* | Don't treat fixity signatures like declarationsalexbiehl2018-04-201-1/+1
| |
* | Hyperlinker: Links for TyOps, class methods and associated typesalexbiehl2018-03-051-1/+14
| |
* | Hyperlinker: Also link pattern synonym argumentsalexbiehl2018-02-061-2/+5
| |
* | Hyperlink pattern synonyms and 'module' imports (#744)Alec Theriault2018-02-051-4/+10
| | | | | | | | | | | | Links to pattern synonyms are now generated, as well as links from modules in import lists. Fixes #731.
* | Support the new 'ITcolumn_prag' tokenAlec Theriault2018-02-021-0/+2
| |
* | Properly color pragma contents in hyperlinkerAlec Theriault2018-02-021-13/+65
| | | | | | | | | | | | The hyperlinker backend now classifies the content of pragmas as 'TkPragma'. That means that in something like '{-# INLINE foo #-}', 'foo' still gets classified as a pragma token.
* | Warning free compilationAlexander Biehl2018-02-011-1/+0
| |
* | Hyperlinker: Adjust parser to new PFailed constructorAlexander Biehl2018-02-011-8/+8
| |
* | Use the GHC lexer for the Hyperlinker backend (#714)Alec Theriault2018-02-014-238/+362
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Start changing to use GHC lexer * better cpp * Change SrcSpan to RealSrcSpan * Remove error * Try to stop too many open files * wip * wip * Revert "wip" This reverts commit b605510a195f26315e3d8ca90e6d95a6737553e1. Conflicts: haddock-api/haddock-api.cabal haddock-api/src/Haddock/Interface.hs * Remove pointless 'caching' * Use dlist rather than lists when finding vars * Use a map rather than list * Delete bogus comment * Rebase followup Things now run using the GHC lexer. There are still - stray debug statements - unnecessary changes w.r.t. master * Cleaned up differences w.r.t. current Haddock HEAD Things are looking good. quasiquotes in particular look beautiful: the TH ones (with Haskell source inside) colour/link their contents too! Haven't yet begun to check for possible performance problems. * Support CPP and top-level pragmas The support for these is hackier - but no more hacky than the existing support. * Tests pass, CPP is better recognized The tests were in some cases altered: I consider the new output to be more correct than the old one.... * Fix shrinking of source without tabs in test * Replace 'Position'/'Span' with GHC counterparts Replaces 'Position' -> 'GHC.RealSrcLoc' and 'Span' -> 'GHC.RealSrcSpan'. * Nits * Forgot entry in .cabal * Update changelog
* Revert "Match changes for Trees that Grow in GHC"Ben Gamari2017-11-211-6/+6
| | | | This reverts commit 01eeeb048acd2dd05ff6471ae148a97cf0720547.
* Revert "Match Trees that Grow in GHC for HsExpr"Ben Gamari2017-11-211-2/+2
| | | | This reverts commit 9f054dc365379c66668de6719840918190ae6e44.
* Match Trees that Grow in GHC for HsExprAlan Zimmerman2017-11-111-2/+2
|
* Match changes for Trees that Grow in GHCAlan Zimmerman2017-11-071-6/+6
|
* Update for #14131Ryan Scott2017-08-231-4/+5
|
* Merge remote-tracking branch 'origin/master' into ghc-headalexbiehl2017-08-212-53/+69
|\
| * Hyperlinker: Avoid linear lookup in enrichToken (#669)Alexander Biehl2017-08-192-41/+53
| | | | | | | | | | | | * Make Span strict in Position * Hyperlinker: Use a proper map to enrich tokens
| * Improve Syb code (#621)Doug Wilson2017-05-271-12/+16
| | | | | | | | | | | | | | | | | | | | | | | | Specialize.hs and Ast.hs are modified to have their Syb code not recurse into Name or Id in HsSyn types. Specialize.hs is refactored to have fewer calls to Syb functions. Syb.hs has some foldl calls replaced with foldl' calls. There is still a lot of performance on the floor of Ast.hs. The RenamedSource is traversed many times, and lookupBySpan is very inefficient. everywhereBut and lookupBySpan dominate the runtime whenever --hyperlinked-source is passed.
* | Rename extension index tagsAlan Zimmerman2017-06-051-12/+12
| |
* | Match new AST as per GHC wip/new-tree-one-paramAlan Zimmerman2017-06-051-12/+13
|/ | | | See https://ghc.haskell.org/trac/ghc/wiki/ImplementingTreesThatGrow
* Changes to match #13163 in GHCAlan Zimmerman2017-01-261-4/+4
|
* Matching changes for GHC wip/T12942Alan Zimmerman2016-12-121-1/+1
|
* Match changes in GHC wip/T3384 branchAlan Zimmerman2016-12-071-1/+1
|
* Change Hyperlinked lexer to know about DataKinds ticksOleg Grenrus2016-05-242-1/+14
|
* Changes due to fix for GHC#11648.Richard Eisenberg2016-03-151-1/+1
| | | | (cherry picked from commit bb994de1ab0c76d1aaf1e39c54158db2526d31f1)
* Fix HyperlinkerBen Gamari2015-12-161-1/+1
| | | | GHC.con_names is now GHC.getConNames
* WarningsMatthew Pickering2015-12-141-1/+0
|
* Changes to compile with 8.0Matthew Pickering2015-12-141-10/+14
|
* Move SYB utilities to standalone module.Łukasz Hanuszczak2015-08-211-14/+1
|
* Make hyperlinked source renderer generate line anchors.Łukasz Hanuszczak2015-08-021-3/+23
|
* Add some utility definitions for generating line anchors.Łukasz Hanuszczak2015-08-021-2/+23
|
* Fix bug with module name being hyperlinked to `Prelude`.Łukasz Hanuszczak2015-07-061-3/+4
|
* Add short documentation for hyperlinker source map type.Łukasz Hanuszczak2015-07-061-0/+9
|
* Add support for hyperlinking modules in import lists.Łukasz Hanuszczak2015-07-062-15/+16
|
* Move source paths types to hyperlinker types module.Łukasz Hanuszczak2015-07-062-1/+13
|
* Extract main hyperlinker types to separate module.Łukasz Hanuszczak2015-07-065-62/+69
|