fixes #7089
This commit is contained in:
parent
cd26d02882
commit
80caca15bd
6 changed files with 30 additions and 5 deletions
|
|
@ -223,3 +223,6 @@ styledEcho "Red on Green.", resetStyle
|
||||||
|
|
||||||
- ``writeStackTrace`` is now proclaimed to have no IO effect (even though it does)
|
- ``writeStackTrace`` is now proclaimed to have no IO effect (even though it does)
|
||||||
so that it is more useful for debugging purposes.
|
so that it is more useful for debugging purposes.
|
||||||
|
- ``\n`` is now only the single line feed character like in most
|
||||||
|
other programming languages. The new platform specific newline escape sequence is
|
||||||
|
written as ``\p``. This change only affects the Windows platform.
|
||||||
|
|
|
||||||
|
|
@ -471,6 +471,16 @@ proc processSwitch(switch, arg: string, pass: TCmdLinePass, info: TLineInfo;
|
||||||
processOnOffSwitch({optMemTracker}, arg, pass, info)
|
processOnOffSwitch({optMemTracker}, arg, pass, info)
|
||||||
if optMemTracker in gOptions: defineSymbol("memtracker")
|
if optMemTracker in gOptions: defineSymbol("memtracker")
|
||||||
else: undefSymbol("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 "checks", "x": processOnOffSwitch(ChecksOptions, arg, pass, info)
|
||||||
of "floatchecks":
|
of "floatchecks":
|
||||||
processOnOffSwitch({optNaNCheck, optInfCheck}, arg, pass, info)
|
processOnOffSwitch({optNaNCheck, optInfCheck}, arg, pass, info)
|
||||||
|
|
|
||||||
|
|
@ -625,8 +625,16 @@ proc getEscapedChar(L: var TLexer, tok: var TToken) =
|
||||||
inc(L.bufpos) # skip '\'
|
inc(L.bufpos) # skip '\'
|
||||||
case L.buf[L.bufpos]
|
case L.buf[L.bufpos]
|
||||||
of 'n', 'N':
|
of 'n', 'N':
|
||||||
|
if gOldNewlines:
|
||||||
if tok.tokType == tkCharLit: lexMessage(L, errNnotAllowedInCharacter)
|
if tok.tokType == tkCharLit: lexMessage(L, errNnotAllowedInCharacter)
|
||||||
add(tok.literal, tnl)
|
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)
|
inc(L.bufpos)
|
||||||
of 'r', 'R', 'c', 'C':
|
of 'r', 'R', 'c', 'C':
|
||||||
add(tok.literal, CR)
|
add(tok.literal, CR)
|
||||||
|
|
|
||||||
|
|
@ -114,6 +114,7 @@ proc cppDefine*(c: ConfigRef; define: string) =
|
||||||
|
|
||||||
var
|
var
|
||||||
gIdeCmd*: IdeCmd
|
gIdeCmd*: IdeCmd
|
||||||
|
gOldNewlines*: bool
|
||||||
|
|
||||||
const
|
const
|
||||||
ChecksOptions* = {optObjCheck, optFieldCheck, optRangeCheck, optNilCheck,
|
ChecksOptions* = {optObjCheck, optFieldCheck, optRangeCheck, optNilCheck,
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,7 @@ Advanced options:
|
||||||
--memTracker:on|off turn memory tracker on|off
|
--memTracker:on|off turn memory tracker on|off
|
||||||
--excessiveStackTrace:on|off
|
--excessiveStackTrace:on|off
|
||||||
stack traces use full file paths
|
stack traces use full file paths
|
||||||
|
--oldNewlines:on|off turn on|off the old behaviour of "\n"
|
||||||
--skipCfg do not read the general configuration file
|
--skipCfg do not read the general configuration file
|
||||||
--skipUserCfg do not read the user's configuration file
|
--skipUserCfg do not read the user's configuration file
|
||||||
--skipParentCfg do not read the parent dirs' configuration files
|
--skipParentCfg do not read the parent dirs' configuration files
|
||||||
|
|
|
||||||
|
|
@ -163,9 +163,10 @@ contain the following `escape sequences`:idx:\ :
|
||||||
================== ===================================================
|
================== ===================================================
|
||||||
Escape sequence Meaning
|
Escape sequence Meaning
|
||||||
================== ===================================================
|
================== ===================================================
|
||||||
``\n`` `newline`:idx:
|
``\p`` platform specific newline: CRLF on Windows,
|
||||||
|
LF on Unix
|
||||||
``\r``, ``\c`` `carriage return`:idx:
|
``\r``, ``\c`` `carriage return`:idx:
|
||||||
``\l`` `line feed`:idx:
|
``\n``, ``\l`` `line feed`:idx: (often called `newline`:idx:)
|
||||||
``\f`` `form feed`:idx:
|
``\f`` `form feed`:idx:
|
||||||
``\t`` `tabulator`:idx:
|
``\t`` `tabulator`:idx:
|
||||||
``\v`` `vertical tabulator`:idx:
|
``\v`` `vertical tabulator`:idx:
|
||||||
|
|
@ -261,7 +262,8 @@ Character literals
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
Character literals are enclosed in single quotes ``''`` and can contain the
|
Character literals are enclosed in single quotes ``''`` and can contain the
|
||||||
same escape sequences as strings - with one exception: `newline`:idx: (``\n``)
|
same escape sequences as strings - with one exception: the platform
|
||||||
|
dependent `newline`:idx: (``\p``)
|
||||||
is not allowed as it may be wider than one character (often it is the pair
|
is not allowed as it may be wider than one character (often it is the pair
|
||||||
CR/LF for example). Here are the valid `escape sequences`:idx: for character
|
CR/LF for example). Here are the valid `escape sequences`:idx: for character
|
||||||
literals:
|
literals:
|
||||||
|
|
@ -270,7 +272,7 @@ literals:
|
||||||
Escape sequence Meaning
|
Escape sequence Meaning
|
||||||
================== ===================================================
|
================== ===================================================
|
||||||
``\r``, ``\c`` `carriage return`:idx:
|
``\r``, ``\c`` `carriage return`:idx:
|
||||||
``\l`` `line feed`:idx:
|
``\n``, ``\l`` `line feed`:idx:
|
||||||
``\f`` `form feed`:idx:
|
``\f`` `form feed`:idx:
|
||||||
``\t`` `tabulator`:idx:
|
``\t`` `tabulator`:idx:
|
||||||
``\v`` `vertical tabulator`:idx:
|
``\v`` `vertical tabulator`:idx:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue