Pretty printing #1377

Merged
merged 32 commits into from Jul 6, 2013

Conversation

Projects
None yet
4 participants
@josevalim
Member

josevalim commented Jul 5, 2013

This is a final tidy up of the pretty printing branch for merge. WIP.

manpages and others added some commits May 7, 2013

using Lindig's strict pretty printer
* Implemented Wadler document algebra with explicit groups, meaning
  that a break should be rendered to a linebreak or a space as
  specified by a mode: `Flat` or `Break`.
* This algorithm reduces the search space for document layouts, as
  no `best` function is used to search lazily over layouts with a
  flat or newline breaks.
adapted IO.inspect calls to Lindig interface
* group1 and line functions were changed
* relying on `surround` helper
* using a default identation of 2, this should be an option?
Optimizing string concatenation calls on wadler.ex
* Modified render method to render sdoc records to a string list
  followed by a Enum.join call.
Merge remote-tracking branch 'upstream/master' into wadler-lindig
Conflicts:
	lib/elixir/lib/binary/inspect.ex
	lib/elixir/lib/kernel.ex
using iolist_to_binary over Enum.join on wadler.ex
* iolist_to_binary assumed to have better performance.
adjusting nesting tests and behaviour on wadler.ex
* surround/3 function aware that nesting only adds spaces after a
  linebreak
* nesting tests should force Break format mode, as Lindig pretty
  printer defaults to Flat printing for small strings.
stripped spaces from record pretty printing
* brackets are not followed/preceded by spaces when inspecting.
adjusting failing tests relying on inspection
* some test cases rely on result from the inspection functions.
  Those were adjusted based on the current result of the inspect
  function, but a more clever method of comparing the result may
  be needed if changes on the tests recur.
moving over to :lists.duplicate
* List.duplicate makes exponentially more :lists.duplicate/3 calls
  than :lists.duplicate/2.
* it also yields better slightly results than String.duplicate.
fixing inspect pretty: false option
* inspect pretty: false calls Wadler.format with :infinity
  as line width.
* Wadler.fits? with w=:infinity always returns true.
* Wadler.format with w=:infinity will only use Flat mode,
  not adding any line breaks.
Mix not using pretty printing
* Added pretty: false option to all inspect calls.
Merge branch 'master' of https://github.com/elixir-lang/elixir
Conflicts:
	lib/elixir/lib/binary/inspect.ex
	lib/mix/lib/mix/tasks/local.install.ex
using defrecordp for all records on wadler.ex
* some tests still need to be refactored.
tests use tuples instead of recordp macros
* recordp builder/accessor macros aren't accessible on test cases.

@josevalim josevalim merged commit 0c557d2 into master Jul 6, 2013

1 check passed

default The Travis CI build passed
Details
@devinus

This comment has been minimized.

Show comment
Hide comment
@devinus

devinus Jul 6, 2013

Contributor

👍 👍 👍 👍 👍 👍 👍 👍 👍 👍 👍 👍 👍 👍

Contributor

devinus commented on b335b16 Jul 6, 2013

👍 👍 👍 👍 👍 👍 👍 👍 👍 👍 👍 👍 👍 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment