From 9c9adbd0ffe6ecc37d3a565811d8e79f24383943 Mon Sep 17 00:00:00 2001 From: Oleg Grenrus Date: Sun, 14 Feb 2021 13:33:21 +0200 Subject: 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 --- testsuite/tests/parser/unicode/T18158.hs | 15 +++++++++++++++ testsuite/tests/parser/unicode/T18158b.hs | 15 +++++++++++++++ testsuite/tests/parser/unicode/T18158b.stderr | 2 ++ testsuite/tests/parser/unicode/all.T | 3 +++ 4 files changed, 35 insertions(+) create mode 100644 testsuite/tests/parser/unicode/T18158.hs create mode 100644 testsuite/tests/parser/unicode/T18158b.hs create mode 100644 testsuite/tests/parser/unicode/T18158b.stderr (limited to 'testsuite') diff --git a/testsuite/tests/parser/unicode/T18158.hs b/testsuite/tests/parser/unicode/T18158.hs new file mode 100644 index 0000000000..510ba858c5 --- /dev/null +++ b/testsuite/tests/parser/unicode/T18158.hs @@ -0,0 +1,15 @@ +main = print nⅯⅯⅩⅩ + where nⅯⅯⅩⅩ = 11 + +-- ⅯⅯⅩⅩ is characters are in NumberLetter unicode category. +-- We now allow it to be used in identifiers, but they +-- are not lower or upper, so cannot be the first one. +-- +-- Just like 'OtherNumber' (#4373), 'ModifierLetter' (#10196) and +-- NonSpacingMark (#7650). +-- +-- > map generalCategory "ⅯⅯⅩⅩ" +-- [LetterNumber,LetterNumber,LetterNumber,LetterNumber] +-- +-- > map show "ⅯⅯⅩⅩ" +-- ["'\\8559'","'\\8559'","'\\8553'","'\\8553'"] diff --git a/testsuite/tests/parser/unicode/T18158b.hs b/testsuite/tests/parser/unicode/T18158b.hs new file mode 100644 index 0000000000..0bd8780b31 --- /dev/null +++ b/testsuite/tests/parser/unicode/T18158b.hs @@ -0,0 +1,15 @@ +main = print ⅯⅯⅩⅩ + where ⅯⅯⅩⅩ = 11 + +-- ⅯⅯⅩⅩ is characters are in NumberLetter unicode category. +-- We now allow it to be used in identifiers, but they +-- are not lower or upper, so cannot be the first one. +-- +-- Just like 'OtherNumber' (#4373), 'ModifierLetter' (#10196) and +-- NonSpacingMark (#7650). +-- +-- > map generalCategory "ⅯⅯⅩⅩ" +-- [LetterNumber,LetterNumber,LetterNumber,LetterNumber] +-- +-- > map show "ⅯⅯⅩⅩ" +-- ["'\\8559'","'\\8559'","'\\8553'","'\\8553'"] diff --git a/testsuite/tests/parser/unicode/T18158b.stderr b/testsuite/tests/parser/unicode/T18158b.stderr new file mode 100644 index 0000000000..a2148b3908 --- /dev/null +++ b/testsuite/tests/parser/unicode/T18158b.stderr @@ -0,0 +1,2 @@ + +T18158b.hs:1:14: error: lexical error at character '\8559' diff --git a/testsuite/tests/parser/unicode/all.T b/testsuite/tests/parser/unicode/all.T index 54a3b7cb1f..c854ea41c4 100644 --- a/testsuite/tests/parser/unicode/all.T +++ b/testsuite/tests/parser/unicode/all.T @@ -30,3 +30,6 @@ test('T7650', normal, compile, ['']) test('brackets', normal, compile, ['']) test('T18225A', normal, compile, ['']) test('T18225B', normal, compile_fail, ['']) + +test('T18158', normal, compile, ['']) +test('T18158b', normal, compile_fail, ['']) -- cgit v1.2.1