From 367abca3825fcd2f2a7fdf2bd699986f0535e6b1 Mon Sep 17 00:00:00 2001 From: Araq Date: Tue, 24 Sep 2013 09:32:49 +0200 Subject: [PATCH] support for --cs:partial --- compiler/commands.nim | 9 ++++++++- compiler/idents.nim | 5 ++++- doc/advopt.txt | 2 ++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/compiler/commands.nim b/compiler/commands.nim index ca0c309bd6..d3266930b1 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 f0935c2045..1e6f9d2fd6 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 diff --git a/doc/advopt.txt b/doc/advopt.txt index baf67cc678..1452b9eef6 100644 --- a/doc/advopt.txt +++ b/doc/advopt.txt @@ -85,4 +85,6 @@ Advanced options: --parallelBuild=0|1|... perform a parallel build value = number of processors (0 for auto-detect) --verbosity:0|1|2|3 set Nimrod's verbosity level (1 is default) + --cs:none|partial set case sensitivity level (default: none); + do not use! this setting affects the whole language -v, --version show detailed version information