diff options
author | Joshua Price <2855417+ElderEphemera@users.noreply.github.com> | 2020-05-23 20:28:13 -0400 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-05-24 15:22:56 -0400 |
commit | cd339ef0e8ce940902df79ed1d93b3af50ea6f77 (patch) | |
tree | df919017bf2f813a3e07f936c08366d708b3bf87 /compiler/GHC | |
parent | b420fb2474650e6dfbd66afd199f28492f900f75 (diff) | |
download | haskell-cd339ef0e8ce940902df79ed1d93b3af50ea6f77.tar.gz |
Make Unicode brackets opening/closing tokens (#18225)
The tokens `[|`, `|]`, `(|`, and `|)` are opening/closing tokens as
described in GHC Proposal #229. This commit makes the unicode
variants (`⟦`, `⟧`, `⦇`, and `⦈`) act the same as their ASCII
counterparts.
Diffstat (limited to 'compiler/GHC')
-rw-r--r-- | compiler/GHC/Parser/Lexer.x | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/compiler/GHC/Parser/Lexer.x b/compiler/GHC/Parser/Lexer.x index 5bdf4c41f3..7606dd3f9e 100644 --- a/compiler/GHC/Parser/Lexer.x +++ b/compiler/GHC/Parser/Lexer.x @@ -564,11 +564,11 @@ $tab { warnTab } -- -- The precise rules are as follows: -- --- * Identifiers, literals, and opening brackets (, (#, [, [|, [||, [p|, [e|, --- [t|, {, are considered "opening tokens". The function followedByOpeningToken --- tests whether the next token is an opening token. +-- * Identifiers, literals, and opening brackets (, (#, (|, [, [|, [||, [p|, +-- [e|, [t|, {, ⟦, ⦇, are considered "opening tokens". The function +-- followedByOpeningToken tests whether the next token is an opening token. -- --- * Identifiers, literals, and closing brackets ), #), ], |], }, +-- * Identifiers, literals, and closing brackets ), #), |), ], |], }, ⟧, ⦈, -- are considered "closing tokens". The function precededByClosingToken tests -- whether the previous token is a closing token. -- @@ -1068,6 +1068,8 @@ followedByOpeningToken _ _ _ (AI _ buf) ('\"', _) -> True ('\'', _) -> True ('_', _) -> True + ('⟦', _) -> True + ('⦇', _) -> True (c, _) -> isAlphaNum c -- See Note [Whitespace-sensitive operator parsing] @@ -1080,6 +1082,8 @@ precededByClosingToken _ (AI _ buf) _ _ = '\"' -> True '\'' -> True '_' -> True + '⟧' -> True + '⦈' -> True c -> isAlphaNum c {-# INLINE nextCharIs #-} |