diff options
author | Oscar Nihlgård <oscarnihlgard@gmail.com> | 2018-05-30 09:40:35 +0200 |
---|---|---|
committer | Oscar Nihlgård <oscarnihlgard@gmail.com> | 2018-06-03 09:05:50 +0200 |
commit | fd2823636820e995f0d1c4370542ee1dbfc55442 (patch) | |
tree | 079a04c68559f7d9cff16353ff64735e4e1fdda2 | |
parent | 25a41d5d90c707e8d926308c495c95e2cd13d984 (diff) | |
download | Nim-fd2823636820e995f0d1c4370542ee1dbfc55442.tar.gz |
Multi byte characters should not be treated as part of an operator
-rw-r--r-- | compiler/lexer.nim | 2 | ||||
-rw-r--r-- | lib/packages/docutils/highlite.nim | 2 | ||||
-rw-r--r-- | tests/parser/tunicodeidents.nim | 11 |
3 files changed, 13 insertions, 2 deletions
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 |