summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorOscar Campbell <oscar@campbell.nu>2015-06-01 23:49:04 +0200
committerOscar Campbell <oscar@campbell.nu>2015-06-01 23:49:04 +0200
commitdd30bab480f59e4bb4ab8fad5aabd13c08aa1b11 (patch)
treed7586193d5d727cc7468b58981b6d0459ddcbf47
parentd35887e492613e646f4fcc04f8314cc897afe793 (diff)
downloadNim-dd30bab480f59e4bb4ab8fad5aabd13c08aa1b11.tar.gz
Restructure branching slighty. Fix error message.
-rw-r--r--compiler/lexer.nim5
-rw-r--r--lib/pure/hashes.nim13
2 files changed, 9 insertions, 9 deletions
diff --git a/compiler/lexer.nim b/compiler/lexer.nim
index c37b4deba..eaabe05e2 100644
--- a/compiler/lexer.nim
+++ b/compiler/lexer.nim
@@ -140,7 +140,8 @@ proc isKeyword*(kind: TTokType): bool =
 proc isNimIdentifier*(s: string): bool =
   if s[0] in SymStartChars:
     var i = 1
-    while i < s.len:
+    var sLen = s.len
+    while i < sLen:
       if s[i] == '_':
         inc(i)
       elif isMagicIdentSeparatorRune(cstring s, i):
@@ -637,7 +638,7 @@ proc getSymbol(L: var TLexer, tok: var TToken) =
           buf[pos+1] == '\128' and
           buf[pos+2] == '\147':  # It's a 'magic separator' en-dash Unicode
         if buf[pos + magicIdentSeparatorRuneByteWidth] notin SymChars:
-          lexMessage(L, errInvalidToken, "·")
+          lexMessage(L, errInvalidToken, "–")
           break
         inc(pos, magicIdentSeparatorRuneByteWidth)
       else:
diff --git a/lib/pure/hashes.nim b/lib/pure/hashes.nim
index c6af8f918..132264e4a 100644
--- a/lib/pure/hashes.nim
+++ b/lib/pure/hashes.nim
@@ -130,14 +130,13 @@ proc hashIgnoreStyle*(x: string): THash =
     var c = x[i]
     if c == '_':
       inc(i)
-      continue                # skip _
-    if isMagicIdentSeparatorRune(cstring(x), i):
+    elif isMagicIdentSeparatorRune(cstring(x), i):
       inc(i, magicIdentSeparatorRuneByteWidth)
-      continue                # skip '·' (unicode middle dot)
-    if c in {'A'..'Z'}:
-      c = chr(ord(c) + (ord('a') - ord('A'))) # toLower()
-    h = h !& ord(c)
-    inc(i)
+    else:
+      if c in {'A'..'Z'}:
+        c = chr(ord(c) + (ord('a') - ord('A'))) # toLower()
+      h = h !& ord(c)
+      inc(i)
 
   result = !$h