diff options
author | Araq <rumpf_a@web.de> | 2012-08-20 01:13:13 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2012-08-20 01:13:13 +0200 |
commit | 5e15dec1757e6013cbeb5d6baf9d9579cf025361 (patch) | |
tree | 2157b7f03f5f596060ad9ed52427118964912e50 /compiler/nimconf.nim | |
parent | 0cac8d9b6fa2c982468899db109a964df979b186 (diff) | |
download | Nim-5e15dec1757e6013cbeb5d6baf9d9579cf025361.tar.gz |
first steps to make templates hygienic
Diffstat (limited to 'compiler/nimconf.nim')
-rwxr-xr-x | compiler/nimconf.nim | 42 |
1 files changed, 22 insertions, 20 deletions
diff --git a/compiler/nimconf.nim b/compiler/nimconf.nim index c3592e03a..f4f6d0a42 100755 --- a/compiler/nimconf.nim +++ b/compiler/nimconf.nim @@ -111,7 +111,7 @@ proc jumpToDirective(L: var TLexer, tok: var TToken, dest: TJumpDest) = proc parseDirective(L: var TLexer, tok: var TToken) = ppGetTok(L, tok) # skip @ case whichKeyword(tok.ident) - of wIf: + of wIf: setlen(condStack, len(condStack) + 1) var res = EvalppIf(L, tok) condStack[high(condStack)] = res @@ -123,25 +123,27 @@ proc parseDirective(L: var TLexer, tok: var TToken) = ppGetTok(L, tok) msgs.MsgWriteln(tokToStr(tok)) ppGetTok(L, tok) - of wPutEnv: - ppGetTok(L, tok) - var key = tokToStr(tok) - ppGetTok(L, tok) - os.putEnv(key, tokToStr(tok)) - ppGetTok(L, tok) - of wPrependEnv: - ppGetTok(L, tok) - var key = tokToStr(tok) - ppGetTok(L, tok) - os.putEnv(key, tokToStr(tok) & os.getenv(key)) - ppGetTok(L, tok) - of wAppendenv: - ppGetTok(L, tok) - var key = tokToStr(tok) - ppGetTok(L, tok) - os.putEnv(key, os.getenv(key) & tokToStr(tok)) - ppGetTok(L, tok) - else: lexMessage(L, errInvalidDirectiveX, tokToStr(tok)) + else: + case tok.ident.s.normalize + of "putenv": + ppGetTok(L, tok) + var key = tokToStr(tok) + ppGetTok(L, tok) + os.putEnv(key, tokToStr(tok)) + ppGetTok(L, tok) + of "prependenv": + ppGetTok(L, tok) + var key = tokToStr(tok) + ppGetTok(L, tok) + os.putEnv(key, tokToStr(tok) & os.getenv(key)) + ppGetTok(L, tok) + of "appendenv": + ppGetTok(L, tok) + var key = tokToStr(tok) + ppGetTok(L, tok) + os.putEnv(key, os.getenv(key) & tokToStr(tok)) + ppGetTok(L, tok) + else: lexMessage(L, errInvalidDirectiveX, tokToStr(tok)) proc confTok(L: var TLexer, tok: var TToken) = ppGetTok(L, tok) |