diff options
author | Alec Theriault <alec.theriault@gmail.com> | 2019-01-31 01:37:25 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-31 01:37:25 -0800 |
commit | 1b26460fb3b5df5215cc1e6715661cbc7c950085 (patch) | |
tree | 0b5ac6285ecf432021e8365567d48eeb6249f44b /hypsrc-test/ref/src/CPP.html | |
parent | 4c02498a24e6ceb775528bed043b66340296ad06 (diff) |
Use `.hie` files for the Hyperlinker backend (#977)
# 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
Diffstat (limited to 'hypsrc-test/ref/src/CPP.html')
-rw-r--r-- | hypsrc-test/ref/src/CPP.html | 197 |
1 files changed, 104 insertions, 93 deletions
diff --git a/hypsrc-test/ref/src/CPP.html b/hypsrc-test/ref/src/CPP.html index fb85bd2f..2ebcae90 100644 --- a/hypsrc-test/ref/src/CPP.html +++ b/hypsrc-test/ref/src/CPP.html @@ -11,8 +11,8 @@ ><span > </span - ><a name="line-2" - ></a + ><span id="line-2" + ></span ><span class="hs-keyword" >module</span ><span @@ -23,45 +23,48 @@ > </span ><span class="hs-keyword" >where</span - ><span - > -</span - ><a name="line-3" - ></a - ><span - > -</span - ><a name="line-4" - ></a ><span class="hs-cpp" - >#define SOMETHING1 + > + +#define SOMETHING1 </span ><span > </span - ><a name="line-6" - ></a - ><span class="hs-identifier" - >foo</span + ><span id="line-6" + ></span + ><span class="annot" + ><a href="CPP.html#foo" + ><span class="hs-identifier hs-type" + >foo</span + ></a + ></span ><span > </span ><span class="hs-glyph" >::</span ><span > </span + ><span class="annot" ><span class="hs-identifier hs-type" - >String</span + >String</span + ></span ><span > </span - ><a name="line-7" - ></a - ><a name="foo" - ><a href="CPP.html#foo" - ><span class="hs-identifier" - >foo</span - ></a - ></a + ><span id="line-7" + ></span + ><span id="foo" + ><span class="annot" + ><span class="annottext" + >foo :: String +</span + ><a href="CPP.html#foo" + ><span class="hs-identifier hs-var hs-var" + >foo</span + ></a + ></span + ></span ><span > </span ><span class="hs-glyph" @@ -74,142 +77,150 @@ -}</span ><span > </span + ><span class="annot" ><span class="hs-string" - >"foo"</span - ><span - > -</span - ><a name="line-10" - ></a - ><span - > -</span - ><a name="line-11" - ></a + >"foo"</span + ></span ><span class="hs-cpp" - >#define SOMETHING2 + > + +#define SOMETHING2 </span ><span > </span - ><a name="line-13" - ></a - ><span class="hs-identifier" - >bar</span + ><span id="line-13" + ></span + ><span class="annot" + ><a href="CPP.html#bar" + ><span class="hs-identifier hs-type" + >bar</span + ></a + ></span ><span > </span ><span class="hs-glyph" >::</span ><span > </span + ><span class="annot" ><span class="hs-identifier hs-type" - >String</span + >String</span + ></span ><span > </span - ><a name="line-14" - ></a - ><a name="bar" - ><a href="CPP.html#bar" - ><span class="hs-identifier" - >bar</span - ></a - ></a + ><span id="line-14" + ></span + ><span id="bar" + ><span class="annot" + ><span class="annottext" + >bar :: String +</span + ><a href="CPP.html#bar" + ><span class="hs-identifier hs-var hs-var" + >bar</span + ></a + ></span + ></span ><span > </span ><span class="hs-glyph" >=</span ><span > </span + ><span class="annot" ><span class="hs-string" - >"block comment in a string is not a comment {- "</span - ><span - > -</span - ><a name="line-15" - ></a - ><span - > -</span - ><a name="line-16" - ></a + >"block comment in a string is not a comment {- "</span + ></span ><span class="hs-cpp" - >#define SOMETHING3 + > + +#define SOMETHING3 </span ><span > </span - ><a name="line-18" - ></a + ><span id="line-18" + ></span ><span class="hs-comment" >-- " single quotes are fine in line comments</span ><span > </span - ><a name="line-19" - ></a + ><span id="line-19" + ></span ><span class="hs-comment" >-- {- unclosed block comments are fine in line comments</span ><span > </span - ><a name="line-20" - ></a + ><span id="line-20" + ></span ><span > </span - ><a name="line-21" - ></a + ><span id="line-21" + ></span ><span class="hs-comment" >-- Multiline CPP is also fine</span - ><span - > -</span - ><a name="line-22" - ></a ><span class="hs-cpp" - >#define FOO\ + > +#define FOO\ 1 </span ><span > </span - ><a name="line-25" - ></a - ><span class="hs-identifier" - >baz</span + ><span id="line-25" + ></span + ><span class="annot" + ><a href="CPP.html#baz" + ><span class="hs-identifier hs-type" + >baz</span + ></a + ></span ><span > </span ><span class="hs-glyph" >::</span ><span > </span + ><span class="annot" ><span class="hs-identifier hs-type" - >String</span + >String</span + ></span ><span > </span - ><a name="line-26" - ></a - ><a name="baz" - ><a href="CPP.html#baz" - ><span class="hs-identifier" - >baz</span - ></a - ></a + ><span id="line-26" + ></span + ><span id="baz" + ><span class="annot" + ><span class="annottext" + >baz :: String +</span + ><a href="CPP.html#baz" + ><span class="hs-identifier hs-var hs-var" + >baz</span + ></a + ></span + ></span ><span > </span ><span class="hs-glyph" >=</span ><span > </span + ><span class="annot" ><span class="hs-string" - >"line comment in a string is not a comment --"</span + >"line comment in a string is not a comment --"</span + ></span ><span > </span - ><a name="line-27" - ></a + ><span id="line-27" + ></span ></pre ></body ></html |