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