From fd2823636820e995f0d1c4370542ee1dbfc55442 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oscar=20Nihlg=C3=A5rd?= Date: Wed, 30 May 2018 09:40:35 +0200 Subject: [PATCH] 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 5915619877..d498cf4afa 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 4f1264c9ed..fbd2d7ecac 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 0000000000..3347eb7a95 --- /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