From fd2823636820e995f0d1c4370542ee1dbfc55442 Mon Sep 17 00:00:00 2001 From: Oscar Nihlgård Date: Wed, 30 May 2018 09:40:35 +0200 Subject: Multi byte characters should not be treated as part of an operator --- compiler/lexer.nim | 2 +- lib/packages/docutils/highlite.nim | 2 +- tests/parser/tunicodeidents.nim | 11 +++++++++++ 3 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 tests/parser/tunicodeidents.nim diff --git a/compiler/lexer.nim b/compiler/lexer.nim index 591561987..d498cf4af 100644 --- a/compiler/lexer.nim +++ b/compiler/lexer.nim @@ -25,7 +25,7 @@ const SymChars*: set[char] = {'a'..'z', 'A'..'Z', '0'..'9', '\x80'..'\xFF'} SymStartChars*: set[char] = {'a'..'z', 'A'..'Z', '\x80'..'\xFF'} OpChars*: set[char] = {'+', '-', '*', '/', '\\', '<', '>', '!', '?', '^', '.', - '|', '=', '%', '&', '$', '@', '~', ':', '\x80'..'\xFF'} + '|', '=', '%', '&', '$', '@', '~', ':'} # don't forget to update the 'highlite' module if these charsets should change diff --git a/lib/packages/docutils/highlite.nim b/lib/packages/docutils/highlite.nim index 4f1264c9e..fbd2d7eca 100644 --- a/lib/packages/docutils/highlite.nim +++ b/lib/packages/docutils/highlite.nim @@ -130,7 +130,7 @@ proc nimNumber(g: var GeneralTokenizer, position: int): int = const OpChars = {'+', '-', '*', '/', '\\', '<', '>', '!', '?', '^', '.', - '|', '=', '%', '&', '$', '@', '~', ':', '\x80'..'\xFF'} + '|', '=', '%', '&', '$', '@', '~', ':'} proc nimNextToken(g: var GeneralTokenizer) = const diff --git a/tests/parser/tunicodeidents.nim b/tests/parser/tunicodeidents.nim new file mode 100644 index 000000000..3347eb7a9 --- /dev/null +++ b/tests/parser/tunicodeidents.nim @@ -0,0 +1,11 @@ +discard """ + action: run +""" + +# #7884 + +type Obj = object + ö: int + +let o = Obj(ö: 1) +doAssert o.ö == 1 -- cgit 1.4.1-2-gfad0