summary refs log tree commit diff stats
path: root/compiler/idents.nim
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/idents.nim')
-rw-r--r--compiler/idents.nim34
1 files changed, 17 insertions, 17 deletions
diff --git a/compiler/idents.nim b/compiler/idents.nim
index 6986800cf..d9b72baf0 100644
--- a/compiler/idents.nim
+++ b/compiler/idents.nim
@@ -11,13 +11,13 @@
 # An identifier is a shared immutable string that can be compared by its
 # id. This module is essential for the compiler's performance.
 
-import 
+import
   hashes, strutils, etcpriv
 
-type 
+type
   TIdObj* = object of RootObj
     id*: int # unique id; use this for comparisons and not the pointers
-  
+
   PIdObj* = ref TIdObj
   PIdent* = ref TIdent
   TIdent*{.acyclic.} = object of TIdObj
@@ -45,12 +45,12 @@ proc cmpIgnoreStyle(a, b: cstring, blen: int): int =
     if aa >= 'A' and aa <= 'Z': aa = chr(ord(aa) + (ord('a') - ord('A')))
     if bb >= 'A' and bb <= 'Z': bb = chr(ord(bb) + (ord('a') - ord('A')))
     result = ord(aa) - ord(bb)
-    if (result != 0) or (aa == '\0'): break 
+    if (result != 0) or (aa == '\0'): break
     inc(i)
     inc(j)
   if result == 0:
     if a[i] != '\0': result = 1
-  
+
 proc cmpExact(a, b: cstring, blen: int): int =
   var i = 0
   var j = 0
@@ -59,10 +59,10 @@ proc cmpExact(a, b: cstring, blen: int): int =
     var aa = a[i]
     var bb = b[j]
     result = ord(aa) - ord(bb)
-    if (result != 0) or (aa == '\0'): break 
+    if (result != 0) or (aa == '\0'): break
     inc(i)
     inc(j)
-  if result == 0: 
+  if result == 0:
     if a[i] != '\0': result = 1
 
 var wordCounter = 1
@@ -72,14 +72,14 @@ proc getIdent*(identifier: cstring, length: int, h: Hash): PIdent =
   result = buckets[idx]
   var last: PIdent = nil
   var id = 0
-  while result != nil: 
-    if cmpExact(cstring(result.s), identifier, length) == 0: 
-      if last != nil: 
+  while result != nil:
+    if cmpExact(cstring(result.s), identifier, length) == 0:
+      if last != nil:
         # make access to last looked up identifier faster:
         last.next = result.next
         result.next = buckets[idx]
         buckets[idx] = result
-      return 
+      return
     elif cmpIgnoreStyle(cstring(result.s), identifier, length) == 0:
       assert((id == 0) or (id == result.id))
       id = result.id
@@ -91,20 +91,20 @@ proc getIdent*(identifier: cstring, length: int, h: Hash): PIdent =
   for i in countup(0, length - 1): result.s[i] = identifier[i]
   result.next = buckets[idx]
   buckets[idx] = result
-  if id == 0: 
+  if id == 0:
     inc(wordCounter)
     result.id = -wordCounter
-  else: 
+  else:
     result.id = id
 
-proc getIdent*(identifier: string): PIdent = 
-  result = getIdent(cstring(identifier), len(identifier), 
+proc getIdent*(identifier: string): PIdent =
+  result = getIdent(cstring(identifier), len(identifier),
                     hashIgnoreStyle(identifier))
 
-proc getIdent*(identifier: string, h: Hash): PIdent = 
+proc getIdent*(identifier: string, h: Hash): PIdent =
   result = getIdent(cstring(identifier), len(identifier), h)
 
-proc identEq*(id: PIdent, name: string): bool = 
+proc identEq*(id: PIdent, name: string): bool =
   result = id.id == getIdent(name).id
 
 var idAnon* = getIdent":anonymous"