Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pretty printer algorithm revamp step 3 #93102

Merged
merged 13 commits into from
Jan 21, 2022
Merged

Commits on Jan 20, 2022

  1. Configuration menu
    Copy the full SHA
    eec6016 View commit details
    Browse the repository at this point in the history
  2. Grow scan_stack in the conventional direction

    The pretty printer algorithm involves 2 VecDeques: a ring-buffer of
    tokens and a deque of ring-buffer indices. Confusingly, those two deques
    were being grown in opposite directions for no good reason. Ring-buffer
    pushes would go on the "back" of the ring-buffer (i.e. higher indices)
    while scan_stack pushes would go on the "front" (i.e. lower indices).
    This commit flips the scan_stack accesses to grow the scan_stack and
    ring-buffer in the same direction, where push does the same
    operation as a Vec push i.e. inserting on the high-index end.
    dtolnay committed Jan 20, 2022
    Configuration menu
    Copy the full SHA
    d81740e View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    d981c5b View commit details
    Browse the repository at this point in the history
  4. Simplify left_total tracking

    dtolnay committed Jan 20, 2022
    Configuration menu
    Copy the full SHA
    351011e View commit details
    Browse the repository at this point in the history
  5. Simplify advance_left

    dtolnay committed Jan 20, 2022
    Configuration menu
    Copy the full SHA
    d2eb46c View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    ae75ba6 View commit details
    Browse the repository at this point in the history
  7. Combine advance_left matches

    dtolnay committed Jan 20, 2022
    Configuration menu
    Copy the full SHA
    ea23a1f View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    d5f15a8 View commit details
    Browse the repository at this point in the history
  9. Touch up print_string

    dtolnay committed Jan 20, 2022
    Configuration menu
    Copy the full SHA
    65dd670 View commit details
    Browse the repository at this point in the history
  10. Eliminate offset number from Fits frames

    PrintStackElems with pbreak=PrintStackBreak::Fits always carried a
    meaningless value offset=0. We can combine the two types PrintStackElem
    + PrintStackBreak into one PrintFrame enum that stores offset only for
    Broken frames.
    dtolnay committed Jan 20, 2022
    Configuration menu
    Copy the full SHA
    9e794d7 View commit details
    Browse the repository at this point in the history
  11. Inline indent function

    dtolnay committed Jan 20, 2022
    Configuration menu
    Copy the full SHA
    224536f View commit details
    Browse the repository at this point in the history
  12. Inline print_newline function

    dtolnay committed Jan 20, 2022
    Configuration menu
    Copy the full SHA
    51eeb82 View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    21c1571 View commit details
    Browse the repository at this point in the history