Implements #2154.
When unpacking tuples in var/let declarations a part of the tuple can now be discarded using a single underscore.
This commit is contained in:
parent
3751019823
commit
b38eb2e2a8
8 changed files with 39 additions and 6 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue