diff options
author | Andreas Rumpf <andreas@andreas-desktop> | 2009-12-15 01:50:26 +0100 |
---|---|---|
committer | Andreas Rumpf <andreas@andreas-desktop> | 2009-12-15 01:50:26 +0100 |
commit | 7063670a2cfc9cccfa9078f2dc479cccd16f526e (patch) | |
tree | 5e60f18aa4ed24beb14356a7ecdd2b5ba8c032c4 /rod/ast.nim | |
parent | 3b7ef2288f60bc5c355ad9aeaa127431ec3aee7b (diff) | |
download | Nim-7063670a2cfc9cccfa9078f2dc479cccd16f526e.tar.gz |
variable dynamic lib names
Diffstat (limited to 'rod/ast.nim')
-rwxr-xr-x | rod/ast.nim | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/rod/ast.nim b/rod/ast.nim index 0de61f467..89fadf375 100755 --- a/rod/ast.nim +++ b/rod/ast.nim @@ -409,7 +409,8 @@ type kind*: TLibKind generated*: bool # needed for the backends: name*: PRope - path*: string + path*: PNode # can be a string literal! + PLib* = ref TLib TSym* = object of TIdObj @@ -949,6 +950,35 @@ proc sonsNotNil(n: PNode): bool = proc addSonIfNotNil(father, n: PNode) = if n != nil: addSon(father, n) +proc getInt*(a: PNode): biggestInt = + case a.kind + of nkIntLit..nkInt64Lit: result = a.intVal + else: + internalError(a.info, "getInt") + result = 0 + +proc getFloat*(a: PNode): biggestFloat = + case a.kind + of nkFloatLit..nkFloat64Lit: result = a.floatVal + else: + internalError(a.info, "getFloat") + result = 0.0 + +proc getStr*(a: PNode): string = + case a.kind + of nkStrLit..nkTripleStrLit: result = a.strVal + else: + internalError(a.info, "getStr") + result = "" + +proc getStrOrChar*(a: PNode): string = + case a.kind + of nkStrLit..nkTripleStrLit: result = a.strVal + of nkCharLit: result = chr(int(a.intVal)) & "" + else: + internalError(a.info, "getStrOrChar") + result = "" + proc mustRehash(length, counter: int): bool = assert(length > counter) result = (length * 2 < counter * 3) or (length - counter < 4) |