mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-28 17:04:41 +00:00
Get rid of tkUnderscore. Map _ to tkSymbol.
This commit is contained in:
@@ -384,8 +384,7 @@ proc genItem(d: PDoc, n, nameNode: PNode, k: TSymKind) =
|
||||
tkBracketDotLe, tkBracketDotRi, tkCurlyDotLe, tkCurlyDotRi, tkParDotLe,
|
||||
tkParDotRi, tkComma, tkSemiColon, tkColon, tkEquals, tkDot, tkDotDot,
|
||||
tkAccent, tkColonColon,
|
||||
tkGStrLit, tkGTripleStrLit, tkInfixOpr, tkPrefixOpr, tkPostfixOpr,
|
||||
tkUnderscore:
|
||||
tkGStrLit, tkGTripleStrLit, tkInfixOpr, tkPrefixOpr, tkPostfixOpr:
|
||||
dispA(result, "<span class=\"Other\">$1</span>", "\\spanOther{$1}",
|
||||
[toRope(esc(d.target, literal))])
|
||||
inc(d.id)
|
||||
|
||||
@@ -61,8 +61,7 @@ type
|
||||
tkComma, tkSemiColon,
|
||||
tkColon, tkColonColon, tkEquals, tkDot, tkDotDot,
|
||||
tkOpr, tkComment, tkAccent,
|
||||
tkSpaces, tkInfixOpr, tkPrefixOpr, tkPostfixOpr,
|
||||
tkUnderscore
|
||||
tkSpaces, tkInfixOpr, tkPrefixOpr, tkPostfixOpr
|
||||
|
||||
TTokTypes* = set[TTokType]
|
||||
|
||||
@@ -97,7 +96,7 @@ const
|
||||
":", "::", "=", ".", "..",
|
||||
"tkOpr", "tkComment", "`",
|
||||
"tkSpaces", "tkInfixOpr",
|
||||
"tkPrefixOpr", "tkPostfixOpr", "_"]
|
||||
"tkPrefixOpr", "tkPostfixOpr"]
|
||||
|
||||
type
|
||||
TNumericalBase* = enum
|
||||
@@ -876,7 +875,8 @@ proc rawGetTok(L: var TLexer, tok: var TToken) =
|
||||
tok.tokType = tkAccent
|
||||
inc(L.bufpos)
|
||||
of '_':
|
||||
tok.tokType = tkUnderscore
|
||||
tok.tokType = tkSymbol
|
||||
tok.ident = getIdent("_")
|
||||
inc(L.bufpos)
|
||||
of '\"':
|
||||
# check for extended raw string literal:
|
||||
|
||||
@@ -302,9 +302,6 @@ proc parseSymbol(p: var TParser, allowNil = false): PNode =
|
||||
of tkSymbol, tkAddr, tkType:
|
||||
result = newIdentNodeP(p.tok.ident, p)
|
||||
getTok(p)
|
||||
of tkUnderscore:
|
||||
result = newIdentNodeP(getIdent("_"), p)
|
||||
getTok(p)
|
||||
of tkAccent:
|
||||
result = newNodeP(nkAccQuoted, p)
|
||||
getTok(p)
|
||||
@@ -646,9 +643,6 @@ proc identOrLiteral(p: var TParser, mode: TPrimaryMode): PNode =
|
||||
of tkNil:
|
||||
result = newNodeP(nkNilLit, p)
|
||||
getTok(p)
|
||||
of tkUnderscore:
|
||||
result = newIdentNodeP(getIdent("_"), p)
|
||||
getTok(p)
|
||||
of tkParLe:
|
||||
# () constructor
|
||||
if mode in {pmTypeDesc, pmTypeDef}:
|
||||
@@ -1820,7 +1814,7 @@ proc parseVarTuple(p: var TParser): PNode =
|
||||
result = newNodeP(nkVarTuple, p)
|
||||
getTok(p) # skip '('
|
||||
optInd(p, result)
|
||||
while p.tok.tokType in {tkSymbol, tkAccent, tkUnderscore}:
|
||||
while p.tok.tokType in {tkSymbol, tkAccent}:
|
||||
var a = identWithPragma(p)
|
||||
addSon(result, a)
|
||||
if p.tok.tokType != tkComma: break
|
||||
|
||||
@@ -10,6 +10,9 @@ var (x, _, y) = foo()
|
||||
doAssert x == 4
|
||||
doAssert y == 3
|
||||
|
||||
var (a, _, _) = foo()
|
||||
doAssert a == 4
|
||||
|
||||
iterator bar(): tuple[x, y, z: int] =
|
||||
yield (1,2,3)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user