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

Change handling of “blank” identifiers #5282

Merged
merged 3 commits into from
Aug 18, 2024

Commits on Aug 16, 2024

  1. Configuration menu
    Copy the full SHA
    5042914 View commit details
    Browse the repository at this point in the history
  2. Change handling of “blank” identifiers

    Previously, they were tokenized separately from other identifiers, but
    then most handling checked both tokens anyway. This now always parses
    “blanks” as normal identifiers and checks their blankness at the few
    places we care about it.
    
    There were two places that treated `Blank` differently than `WordyId`,
    and those are preserved. There were also two places where `Blank ""`
    (`_`) was treated differently than `Blank n` (`_withSomeSuffix`), and
    those have been eliminated.
    
    Fixes unisonweb#2822.
    sellout committed Aug 16, 2024
    Configuration menu
    Copy the full SHA
    ebda5ae View commit details
    Browse the repository at this point in the history
  3. Improve the Show (BlockTree a) instance

    This makes it much easier to read the output when debugging the lexer.
    And it should be `Read`-compatible..
    
    There’s still room for improvement, though:
    ```haskell
    Block (Open "scratch.u")
      [
        [
          Leaf (WordyId (NameOnly (Name Relative (NameSegment {toUnescapedText = "dontMap"} :| [])))),
          Leaf (WordyId (NameOnly (Name Relative (NameSegment {toUnescapedText = "f"} :| [])))),
          Block (Open "=")
            [
              [
                Block (Open "cases")
                  [
                    [
                      Leaf (WordyId (NameOnly (Name Relative (NameSegment {toUnescapedText = "None"} :| [])))),
                      Block (Open "->")
                        [
                          [
                            Leaf (Reserved "false"),
                          ],
                        ]
                        (Just Close),
                      Leaf (Semi True),
                    ],
                    [
                      Leaf (WordyId (NameOnly (Name Relative (NameSegment {toUnescapedText = "Some"} :| [])))),
                      Leaf (WordyId (NameOnly (Name Relative (NameSegment {toUnescapedText = "_unused"} :| [])))),
                      Block (Open "->")
                        [
                          [
                            Leaf (WordyId (NameOnly (Name Relative (NameSegment {toUnescapedText = "f"} :| [])))),
                            Leaf (Numeric "2"),
                          ],
                        ]
                        (Just Close),
                    ],
                  ]
                  (Just Close),
              ],
            ]
            (Just Close),
        ],
      ]
      (Just Close)
    ```
    sellout committed Aug 16, 2024
    Configuration menu
    Copy the full SHA
    eff07ae View commit details
    Browse the repository at this point in the history