summaryrefslogtreecommitdiff
path: root/compiler/parser
diff options
context:
space:
mode:
authorThomas Miedema <thomasmiedema@gmail.com>2015-07-03 22:37:18 +0200
committerBen Gamari <ben@smart-cactus.org>2015-07-03 22:44:50 +0200
commit6b01d3ce6c681428e7a9865af85685c2a76ba657 (patch)
tree1c3a846b5bfb22e45077235e14ee807d643ce59a /compiler/parser
parent39d83f239d33b1d214bdb7f7b3ce94d76d3e1467 (diff)
downloadhaskell-6b01d3ce6c681428e7a9865af85685c2a76ba657.tar.gz
parser: Allow Lm (MODIFIER LETTER) category in identifiers
Easy fix in the parser to stop regressions, due to Unicode 7.0 changing the classification of some prior code points. Signed-off-by: Austin Seipp <austin@well-typed.com> Test Plan: `tests/parser/should_compile/T10196.hs` Reviewers: hvr, austin, bgamari Reviewed By: austin, bgamari Subscribers: thomie, bgamari Differential Revision: https://phabricator.haskell.org/D969 GHC Trac Issues: #10196
Diffstat (limited to 'compiler/parser')
-rw-r--r--compiler/parser/Lexer.x8
1 files changed, 6 insertions, 2 deletions
diff --git a/compiler/parser/Lexer.x b/compiler/parser/Lexer.x
index 5839a410fb..2e883fd102 100644
--- a/compiler/parser/Lexer.x
+++ b/compiler/parser/Lexer.x
@@ -156,7 +156,10 @@ $graphic = [$small $large $symbol $digit $special $unigraphic \"\']
$binit = 0-1
$octit = 0-7
$hexit = [$decdigit A-F a-f]
-$idchar = [$small $large $digit \']
+
+$suffix = \x07 -- Trick Alex into handling Unicode. See alexGetByte.
+-- TODO #10196. Only allow modifier letters in the suffix of an identifier.
+$idchar = [$small $large $digit $suffix \']
$pragmachar = [$small $large $digit]
@@ -1842,6 +1845,7 @@ alexGetByte (AI loc s)
symbol = '\x04'
space = '\x05'
other_graphic = '\x06'
+ suffix = '\x07'
adj_c
| c <= '\x06' = non_graphic
@@ -1858,7 +1862,7 @@ alexGetByte (AI loc s)
UppercaseLetter -> upper
LowercaseLetter -> lower
TitlecaseLetter -> upper
- ModifierLetter -> other_graphic
+ ModifierLetter -> suffix -- see #10196
OtherLetter -> lower -- see #1103
NonSpacingMark -> other_graphic
SpacingCombiningMark -> other_graphic