Correct lineinfo for accent quoted symbols in proc definition (#10399)
* compiler/parser: preserve lineinfo for accent quoted symbols
Previously the lineinfo for symbol $$$ in this example is:
proc `$$$`
^
After this commit:
proc `$$$`
^
* compiler/semstmts: correct lineinfo for accent quoted idents
Previously nimsuggest would highlight this as:
proc `$$$`
^~~
After this commit:
proc `$$$`
^~~
* nimsuggest/tests: add a test for accent quoted proc
Disabled by default
This commit is contained in:
parent
4bea8dd674
commit
413755fd45
3 changed files with 22 additions and 11 deletions
|
|
@ -332,12 +332,15 @@ proc parseSymbol(p: var TParser, mode = smNormal): PNode =
|
|||
parMessage(p, errIdentifierExpected, p.tok)
|
||||
break
|
||||
of tkOpr, tkDot, tkDotDot, tkEquals, tkParLe..tkParDotRi:
|
||||
let lineinfo = parLineinfo(p)
|
||||
var accm = ""
|
||||
while p.tok.tokType in {tkOpr, tkDot, tkDotDot, tkEquals,
|
||||
tkParLe..tkParDotRi}:
|
||||
accm.add(tokToStr(p.tok))
|
||||
getTok(p)
|
||||
result.add(newIdentNodeP(p.lex.cache.getIdent(accm), p))
|
||||
let node = newNodeI(nkIdent, lineinfo)
|
||||
node.ident = p.lex.cache.getIdent(accm)
|
||||
result.add(node)
|
||||
of tokKeywordLow..tokKeywordHigh, tkSymbol, tkIntLit..tkCharLit:
|
||||
result.add(newIdentNodeP(p.lex.cache.getIdent(tokToStr(p.tok)), p))
|
||||
getTok(p)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue