Merge branch 'devel' into araq-parser-fixes
This commit is contained in:
commit
272bbad784
71 changed files with 225 additions and 388 deletions
|
|
@ -265,7 +265,7 @@ proc rdCharLoc(a: TLoc): Rope =
|
|||
|
||||
proc genObjectInit(p: BProc, section: TCProcSection, t: PType, a: TLoc,
|
||||
takeAddr: bool) =
|
||||
if p.module.compileToCpp and t.isException:
|
||||
if p.module.compileToCpp and t.isException and not isDefined("noCppExceptions"):
|
||||
# init vtable in Exception object for polymorphic exceptions
|
||||
includeHeader(p.module, "<new>")
|
||||
linefmt(p, section, "new ($1) $2;$n", rdLoc(a), getTypeDesc(p.module, t))
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ proc processSwitch*(switch, arg: string, pass: TCmdLinePass, info: TLineInfo;
|
|||
|
||||
const
|
||||
HelpMessage = "Nim Compiler Version $1 [$2: $3]\n" &
|
||||
"Compiled at $4 $5\n" &
|
||||
"Copyright (c) 2006-" & copyrightYear & " by Andreas Rumpf\n"
|
||||
|
||||
const
|
||||
|
|
@ -68,7 +69,8 @@ const
|
|||
|
||||
proc getCommandLineDesc(): string =
|
||||
result = (HelpMessage % [VersionAsString, platform.OS[platform.hostOS].name,
|
||||
CPU[platform.hostCPU].name]) & Usage
|
||||
CPU[platform.hostCPU].name, CompileDate, CompileTime]) &
|
||||
Usage
|
||||
|
||||
proc helpOnError(pass: TCmdLinePass) =
|
||||
if pass == passCmd1:
|
||||
|
|
@ -79,7 +81,8 @@ proc writeAdvancedUsage(pass: TCmdLinePass) =
|
|||
if pass == passCmd1:
|
||||
msgWriteln(`%`(HelpMessage, [VersionAsString,
|
||||
platform.OS[platform.hostOS].name,
|
||||
CPU[platform.hostCPU].name]) & AdvancedUsage,
|
||||
CPU[platform.hostCPU].name, CompileDate, CompileTime]) &
|
||||
AdvancedUsage,
|
||||
{msgStdout})
|
||||
msgQuit(0)
|
||||
|
||||
|
|
@ -87,7 +90,8 @@ proc writeFullhelp(pass: TCmdLinePass) =
|
|||
if pass == passCmd1:
|
||||
msgWriteln(`%`(HelpMessage, [VersionAsString,
|
||||
platform.OS[platform.hostOS].name,
|
||||
CPU[platform.hostCPU].name]) & Usage & AdvancedUsage,
|
||||
CPU[platform.hostCPU].name, CompileDate, CompileTime]) &
|
||||
Usage & AdvancedUsage,
|
||||
{msgStdout})
|
||||
msgQuit(0)
|
||||
|
||||
|
|
@ -95,7 +99,7 @@ proc writeVersionInfo(pass: TCmdLinePass) =
|
|||
if pass == passCmd1:
|
||||
msgWriteln(`%`(HelpMessage, [VersionAsString,
|
||||
platform.OS[platform.hostOS].name,
|
||||
CPU[platform.hostCPU].name]),
|
||||
CPU[platform.hostCPU].name, CompileDate, CompileTime]),
|
||||
{msgStdout})
|
||||
|
||||
const gitHash = gorge("git log -n 1 --format=%H").strip
|
||||
|
|
|
|||
|
|
@ -45,7 +45,6 @@ proc scanPar(p: var TTmplParser, d: int) =
|
|||
let hi = p.x.len - 1
|
||||
while i <= hi:
|
||||
case p.x[i]
|
||||
of '\0': break
|
||||
of '(': inc(p.par)
|
||||
of ')': dec(p.par)
|
||||
of '[': inc(p.bracket)
|
||||
|
|
@ -64,16 +63,22 @@ const
|
|||
|
||||
proc parseLine(p: var TTmplParser) =
|
||||
var j = 0
|
||||
while p.x[j] == ' ': inc(j)
|
||||
let hi = p.x.len - 1
|
||||
|
||||
if hi == 0:
|
||||
return
|
||||
|
||||
while j <= hi and p.x[j] == ' ': inc(j)
|
||||
|
||||
if p.x[0] == p.nimDirective and p.x[1] == '?':
|
||||
newLine(p)
|
||||
elif p.x[j] == p.nimDirective:
|
||||
newLine(p)
|
||||
inc(j)
|
||||
while p.x[j] == ' ': inc(j)
|
||||
while j <= hi and p.x[j] == ' ': inc(j)
|
||||
let d = j
|
||||
var keyw = ""
|
||||
while p.x[j] in PatternChars:
|
||||
while j <= hi and p.x[j] in PatternChars:
|
||||
add(keyw, p.x[j])
|
||||
inc(j)
|
||||
|
||||
|
|
@ -127,10 +132,8 @@ proc parseLine(p: var TTmplParser) =
|
|||
llStreamWrite(p.outp, "(\"")
|
||||
inc(p.emitPar)
|
||||
p.state = psTempl
|
||||
while true:
|
||||
while j <= hi:
|
||||
case p.x[j]
|
||||
of '\0':
|
||||
break
|
||||
of '\x01'..'\x1F', '\x80'..'\xFF':
|
||||
llStreamWrite(p.outp, "\\x")
|
||||
llStreamWrite(p.outp, toHex(ord(p.x[j]), 2))
|
||||
|
|
@ -157,11 +160,8 @@ proc parseLine(p: var TTmplParser) =
|
|||
llStreamWrite(p.outp, '(')
|
||||
inc(j)
|
||||
var curly = 0
|
||||
while true:
|
||||
while j <= hi:
|
||||
case p.x[j]
|
||||
of '\0':
|
||||
localError(p.info, errXExpected, "}")
|
||||
break
|
||||
of '{':
|
||||
inc(j)
|
||||
inc(curly)
|
||||
|
|
@ -174,6 +174,9 @@ proc parseLine(p: var TTmplParser) =
|
|||
else:
|
||||
llStreamWrite(p.outp, p.x[j])
|
||||
inc(j)
|
||||
if curly > 0:
|
||||
localError(p.info, errXExpected, "}")
|
||||
break
|
||||
llStreamWrite(p.outp, ')')
|
||||
llStreamWrite(p.outp, p.conc)
|
||||
llStreamWrite(p.outp, '\"')
|
||||
|
|
@ -182,7 +185,7 @@ proc parseLine(p: var TTmplParser) =
|
|||
llStreamWrite(p.outp, p.conc)
|
||||
llStreamWrite(p.outp, p.toStr)
|
||||
llStreamWrite(p.outp, '(')
|
||||
while p.x[j] in PatternChars:
|
||||
while j <= hi and p.x[j] in PatternChars:
|
||||
llStreamWrite(p.outp, p.x[j])
|
||||
inc(j)
|
||||
llStreamWrite(p.outp, ')')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue