diff options
author | Dominik Picheta <dominikpicheta@googlemail.com> | 2015-03-31 00:39:23 +0100 |
---|---|---|
committer | Dominik Picheta <dominikpicheta@googlemail.com> | 2015-03-31 00:39:23 +0100 |
commit | b38eb2e2a84537c315f28e9f823c10363be8cdb1 (patch) | |
tree | 00de09cef213dbfb373c75f2ef18ba6a17e9d68c /compiler/lexer.nim | |
parent | 3751019823ee78bd67b44cb27bc331913f12ff47 (diff) | |
download | Nim-b38eb2e2a84537c315f28e9f823c10363be8cdb1.tar.gz |
Implements #2154.
When unpacking tuples in var/let declarations a part of the tuple can now be discarded using a single underscore.
Diffstat (limited to 'compiler/lexer.nim')
-rw-r--r-- | compiler/lexer.nim | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/compiler/lexer.nim b/compiler/lexer.nim index 78266ef4d..5d98b872b 100644 --- a/compiler/lexer.nim +++ b/compiler/lexer.nim @@ -62,6 +62,7 @@ type tkColon, tkColonColon, tkEquals, tkDot, tkDotDot, tkOpr, tkComment, tkAccent, tkSpaces, tkInfixOpr, tkPrefixOpr, tkPostfixOpr, + tkUnderscore TTokTypes* = set[TTokType] @@ -96,7 +97,7 @@ const ":", "::", "=", ".", "..", "tkOpr", "tkComment", "`", "tkSpaces", "tkInfixOpr", - "tkPrefixOpr", "tkPostfixOpr"] + "tkPrefixOpr", "tkPostfixOpr", "_"] type TNumericalBase* = enum @@ -874,6 +875,9 @@ proc rawGetTok(L: var TLexer, tok: var TToken) = of '`': tok.tokType = tkAccent inc(L.bufpos) + of '_': + tok.tokType = tkUnderscore + inc(L.bufpos) of '\"': # check for extended raw string literal: var rawMode = L.bufpos > 0 and L.buf[L.bufpos-1] in SymChars |