summaryrefslogtreecommitdiff
path: root/compiler/GHC/Parser/Lexer.x
diff options
context:
space:
mode:
authorOleg Grenrus <oleg.grenrus@iki.fi>2021-02-14 13:33:21 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-04-05 20:38:07 -0400
commit9c9adbd0ffe6ecc37d3a565811d8e79f24383943 (patch)
tree6beab45ec5caf3e406c3aecb7dfb7f4361d3fb05 /compiler/GHC/Parser/Lexer.x
parent918d5021ad74a6b7e5e027df2f7d7605d833b486 (diff)
downloadhaskell-9c9adbd0ffe6ecc37d3a565811d8e79f24383943.tar.gz
Implement proposal 403: Lexer cleanup
This allows Other Numbers to be used in identifiers, and also documents other, already existing lexer divergence from Haskell Report
Diffstat (limited to 'compiler/GHC/Parser/Lexer.x')
-rw-r--r--compiler/GHC/Parser/Lexer.x14
1 files changed, 7 insertions, 7 deletions
diff --git a/compiler/GHC/Parser/Lexer.x b/compiler/GHC/Parser/Lexer.x
index eec5171eb8..9fa6d05cf0 100644
--- a/compiler/GHC/Parser/Lexer.x
+++ b/compiler/GHC/Parser/Lexer.x
@@ -131,7 +131,7 @@ $tab = \t
$ascdigit = 0-9
$unidigit = \x03 -- Trick Alex into handling Unicode. See [Unicode in Alex].
-$decdigit = $ascdigit -- for now, should really be $digit (ToDo)
+$decdigit = $ascdigit -- exactly $ascdigit, no more no less.
$digit = [$ascdigit $unidigit]
$special = [\(\)\,\;\[\]\`\{\}]
@@ -147,17 +147,17 @@ $unismall = \x02 -- Trick Alex into handling Unicode. See [Unicode in Alex].
$ascsmall = [a-z]
$small = [$ascsmall $unismall \_]
+$uniidchar = \x07 -- Trick Alex into handling Unicode. See [Unicode in Alex].
+$idchar = [$small $large $digit $uniidchar \']
+
$unigraphic = \x06 -- Trick Alex into handling Unicode. See [Unicode in Alex].
-$graphic = [$small $large $symbol $digit $special $unigraphic \"\']
+$graphic = [$small $large $symbol $digit $idchar $special $unigraphic \"\']
$binit = 0-1
$octit = 0-7
$hexit = [$decdigit A-F a-f]
-$uniidchar = \x07 -- Trick Alex into handling Unicode. See [Unicode in Alex].
-$idchar = [$small $large $digit $uniidchar \']
-
-$pragmachar = [$small $large $digit]
+$pragmachar = [$small $large $digit $uniidchar ]
$docsym = [\| \^ \* \$]
@@ -2521,7 +2521,7 @@ adjustChar c = fromIntegral $ ord adj_c
SpacingCombiningMark -> other_graphic
EnclosingMark -> other_graphic
DecimalNumber -> digit
- LetterNumber -> other_graphic
+ LetterNumber -> digit
OtherNumber -> digit -- see #4373
ConnectorPunctuation -> symbol
DashPunctuation -> symbol