summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2013-09-24 09:32:49 +0200
committerAraq <rumpf_a@web.de>2013-09-24 09:32:49 +0200
commit367abca3825fcd2f2a7fdf2bd699986f0535e6b1 (patch)
tree2163f82b727620e92eb60b4bab1d8b374ed470e2 /compiler
parentc11398ea0d32640012946d7555750b3f3ea7fc0e (diff)
downloadNim-367abca3825fcd2f2a7fdf2bd699986f0535e6b1.tar.gz
support for --cs:partial
Diffstat (limited to 'compiler')
-rw-r--r--compiler/commands.nim9
-rw-r--r--compiler/idents.nim5
2 files changed, 12 insertions, 2 deletions
diff --git a/compiler/commands.nim b/compiler/commands.nim
index ca0c309bd..d3266930b 100644
--- a/compiler/commands.nim
+++ b/compiler/commands.nim
@@ -11,7 +11,7 @@
 
 import 
   os, msgs, options, nversion, condsyms, strutils, extccomp, platform, lists, 
-  wordrecg, parseutils, babelcmd
+  wordrecg, parseutils, babelcmd, idents
 
 proc writeCommandLineUsage*()
 
@@ -512,6 +512,13 @@ proc processSwitch(switch, arg: string, pass: TCmdlinePass, info: TLineInfo) =
     gListFullPaths = true
   of "dynliboverride":
     dynlibOverride(switch, arg, pass, info)
+  of "cs":
+    expectArg(switch, arg, pass, info)
+    case arg
+    of "partial": idents.firstCharIsCS = true
+    of "none": idents.firstCharIsCS = false
+    else: LocalError(info, errGenerated,
+      "'partial' or 'none' expected, but found " & arg)
   else:
     if strutils.find(switch, '.') >= 0: options.setConfigVar(switch, arg)
     else: InvalidCmdLineOption(pass, switch, info)
diff --git a/compiler/idents.nim b/compiler/idents.nim
index f0935c204..1e6f9d2fd 100644
--- a/compiler/idents.nim
+++ b/compiler/idents.nim
@@ -24,10 +24,13 @@ type
     s*: string
     next*: PIdent             # for hash-table chaining
     h*: THash                 # hash value of s
-  
+
+var firstCharIsCS*: bool
 var buckets*: array[0..4096 * 2 - 1, PIdent]
 
 proc cmpIgnoreStyle(a, b: cstring, blen: int): int =
+  if firstCharIsCS:
+    if a[0] != b[0]: return 1
   var i = 0
   var j = 0
   result = 1