This commit is contained in:
Andreas Rumpf 2016-10-20 21:03:49 +02:00
commit 20ee65af6d
2 changed files with 21 additions and 12 deletions

View file

@ -37,14 +37,20 @@ proc renderType(n: PNode): string =
of nkIdent: result = n.ident.s of nkIdent: result = n.ident.s
of nkSym: result = typeToString(n.sym.typ) of nkSym: result = typeToString(n.sym.typ)
of nkVarTy: of nkVarTy:
assert len(n) == 1 if n.len == 1:
result = renderType(n[0]) result = renderType(n[0])
else:
result = "var"
of nkRefTy: of nkRefTy:
assert len(n) == 1 if n.len == 1:
result = "ref." & renderType(n[0]) result = "ref." & renderType(n[0])
else:
result = "ref"
of nkPtrTy: of nkPtrTy:
assert len(n) == 1 if n.len == 1:
result = "ptr." & renderType(n[0]) result = "ptr." & renderType(n[0])
else:
result = "ptr"
of nkProcTy: of nkProcTy:
assert len(n) > 1 assert len(n) > 1
let params = n[0] let params = n[0]

View file

@ -242,14 +242,17 @@ proc nimNextToken(g: var GeneralTokenizer) =
inc(pos) inc(pos)
case g.buf[pos] case g.buf[pos]
of 'b', 'B': of 'b', 'B':
g.kind = gtBinNumber
inc(pos) inc(pos)
while g.buf[pos] in binChars: inc(pos) while g.buf[pos] in binChars: inc(pos)
pos = nimNumberPostfix(g, pos) pos = nimNumberPostfix(g, pos)
of 'x', 'X': of 'x', 'X':
g.kind = gtHexNumber
inc(pos) inc(pos)
while g.buf[pos] in hexChars: inc(pos) while g.buf[pos] in hexChars: inc(pos)
pos = nimNumberPostfix(g, pos) pos = nimNumberPostfix(g, pos)
of 'o', 'O': of 'o', 'O':
g.kind = gtOctNumber
inc(pos) inc(pos)
while g.buf[pos] in octChars: inc(pos) while g.buf[pos] in octChars: inc(pos)
pos = nimNumberPostfix(g, pos) pos = nimNumberPostfix(g, pos)