This commit is contained in:
Andreas Rumpf 2018-01-24 20:08:17 +01:00
commit 80caca15bd
6 changed files with 30 additions and 5 deletions

View file

@ -471,6 +471,16 @@ proc processSwitch(switch, arg: string, pass: TCmdLinePass, info: TLineInfo;
processOnOffSwitch({optMemTracker}, arg, pass, info)
if optMemTracker in gOptions: defineSymbol("memtracker")
else: undefSymbol("memtracker")
of "oldnewlines":
case arg.normalize
of "on":
options.gOldNewlines = true
defineSymbol("nimOldNewlines")
of "off":
options.gOldNewlines = false
undefSymbol("nimOldNewlines")
else:
localError(info, errOnOrOffExpectedButXFound, arg)
of "checks", "x": processOnOffSwitch(ChecksOptions, arg, pass, info)
of "floatchecks":
processOnOffSwitch({optNaNCheck, optInfCheck}, arg, pass, info)

View file

@ -625,7 +625,15 @@ proc getEscapedChar(L: var TLexer, tok: var TToken) =
inc(L.bufpos) # skip '\'
case L.buf[L.bufpos]
of 'n', 'N':
if tok.tokType == tkCharLit: lexMessage(L, errNnotAllowedInCharacter)
if gOldNewlines:
if tok.tokType == tkCharLit: lexMessage(L, errNnotAllowedInCharacter)
add(tok.literal, tnl)
else:
add(tok.literal, '\L')
inc(L.bufpos)
of 'p', 'P':
if tok.tokType == tkCharLit:
lexMessage(L, errGenerated, "\\p not allowed in character literal")
add(tok.literal, tnl)
inc(L.bufpos)
of 'r', 'R', 'c', 'C':

View file

@ -114,6 +114,7 @@ proc cppDefine*(c: ConfigRef; define: string) =
var
gIdeCmd*: IdeCmd
gOldNewlines*: bool
const
ChecksOptions* = {optObjCheck, optFieldCheck, optRangeCheck, optNilCheck,