c2nim compiles again [#9 state:resolved]; better error message for named parameters
This commit is contained in:
parent
f31eab8536
commit
dbc5048a9a
8 changed files with 25 additions and 3 deletions
|
|
@ -143,7 +143,7 @@ proc `<=` * (a, b: TTime): bool {.
|
||||||
|
|
||||||
proc getStartMilsecs*(): int {.deprecated.}
|
proc getStartMilsecs*(): int {.deprecated.}
|
||||||
## get the miliseconds from the start of the program. **Deprecated since
|
## get the miliseconds from the start of the program. **Deprecated since
|
||||||
## version 0.8.10.** Use ``realTime`` or ``cpuTime`` instead.
|
## version 0.8.10.** Use ``epochTime`` or ``cpuTime`` instead.
|
||||||
|
|
||||||
when not defined(ECMAScript):
|
when not defined(ECMAScript):
|
||||||
proc epochTime*(): float {.rtl, extern: "nt$1".}
|
proc epochTime*(): float {.rtl, extern: "nt$1".}
|
||||||
|
|
|
||||||
|
|
@ -279,7 +279,7 @@ proc parsePegLit(p: var TParser): TPeg =
|
||||||
if p.tok.xkind != pxStrLit: ExpectIdent(p)
|
if p.tok.xkind != pxStrLit: ExpectIdent(p)
|
||||||
try:
|
try:
|
||||||
result = parsePeg(
|
result = parsePeg(
|
||||||
input = if p.tok.xkind == pxStrLit: p.tok.s else: escapePeg(p.tok.s),
|
pattern = if p.tok.xkind == pxStrLit: p.tok.s else: escapePeg(p.tok.s),
|
||||||
filename = p.lex.filename,
|
filename = p.lex.filename,
|
||||||
line = p.lex.linenumber,
|
line = p.lex.linenumber,
|
||||||
col = col)
|
col = col)
|
||||||
|
|
|
||||||
|
|
@ -95,6 +95,9 @@ proc getNotFoundError(c: PContext, n: PNode): string =
|
||||||
result = msgKindToString(errTypeMismatch)
|
result = msgKindToString(errTypeMismatch)
|
||||||
for i in countup(1, sonsLen(n) - 1):
|
for i in countup(1, sonsLen(n) - 1):
|
||||||
#debug(n.sons[i].typ);
|
#debug(n.sons[i].typ);
|
||||||
|
if n.sons[i].kind == nkExprEqExpr:
|
||||||
|
add(result, renderTree(n.sons[i].sons[0]))
|
||||||
|
add(result, ": ")
|
||||||
add(result, typeToString(n.sons[i].typ))
|
add(result, typeToString(n.sons[i].typ))
|
||||||
if i != sonsLen(n) - 1: add(result, ", ")
|
if i != sonsLen(n) - 1: add(result, ", ")
|
||||||
add(result, ')')
|
add(result, ')')
|
||||||
|
|
|
||||||
8
tests/accept/compile/tnamedparams.nim
Normal file
8
tests/accept/compile/tnamedparams.nim
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
import pegs
|
||||||
|
|
||||||
|
discard parsePeg(
|
||||||
|
pattern = "input",
|
||||||
|
filename = "filename",
|
||||||
|
line = 1,
|
||||||
|
col = 23)
|
||||||
|
|
||||||
|
|
@ -15,6 +15,7 @@ tinvalidnewseq.nim;10;type mismatch: got (array[0..6, string], int)
|
||||||
tinvwhen.nim;6;invalid indentation
|
tinvwhen.nim;6;invalid indentation
|
||||||
titer4.nim;2;iterator within for loop context expected
|
titer4.nim;2;iterator within for loop context expected
|
||||||
tmethod.nim;2;'method' needs a parameter that has an object type
|
tmethod.nim;2;'method' needs a parameter that has an object type
|
||||||
|
tnamedparams.nim;3; Error: type mismatch: got (input: string, filename: string, line: int, col: int)
|
||||||
tnamspc.nim;5;undeclared identifier: 'global'
|
tnamspc.nim;5;undeclared identifier: 'global'
|
||||||
tnoop.nim;6;expression 'a()' cannot be called
|
tnoop.nim;6;expression 'a()' cannot be called
|
||||||
tnot.nim;9;type mismatch
|
tnot.nim;9;type mismatch
|
||||||
|
|
|
||||||
|
8
tests/reject/tnamedparams.nim
Normal file
8
tests/reject/tnamedparams.nim
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
import pegs
|
||||||
|
|
||||||
|
discard parsePeg(
|
||||||
|
input = "input",
|
||||||
|
filename = "filename",
|
||||||
|
line = 1,
|
||||||
|
col = 23)
|
||||||
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# Nimrod Tester
|
# Nimrod Tester
|
||||||
# (c) Copyright 2010 Andreas Rumpf
|
# (c) Copyright 2011 Andreas Rumpf
|
||||||
#
|
#
|
||||||
# See the file "copying.txt", included in this
|
# See the file "copying.txt", included in this
|
||||||
# distribution, for details about the copyright.
|
# distribution, for details about the copyright.
|
||||||
|
|
|
||||||
2
todo.txt
2
todo.txt
|
|
@ -1,4 +1,6 @@
|
||||||
- we need a way to disable tests
|
- we need a way to disable tests
|
||||||
|
- {.extern: "thisfile.m".} pragma for objective C/C++ support
|
||||||
|
- deprecate ^ and make it awailable as operator
|
||||||
|
|
||||||
|
|
||||||
High priority (version 0.9.0)
|
High priority (version 0.9.0)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue