Fix accents in enums
This commit is contained in:
parent
7b1b3cbf25
commit
20cb567bf5
2 changed files with 8 additions and 5 deletions
|
|
@ -296,20 +296,22 @@ proc parseSymbol(p: var TParser, allowNil = false): PNode =
|
||||||
of tkAccent:
|
of tkAccent:
|
||||||
result = newNodeP(nkAccQuoted, p)
|
result = newNodeP(nkAccQuoted, p)
|
||||||
getTok(p)
|
getTok(p)
|
||||||
|
var bracketAccm = ""
|
||||||
while true:
|
while true:
|
||||||
case p.tok.tokType
|
case p.tok.tokType
|
||||||
of tkIntLit..tkCharLit, tkBracketLe, tkBracketRi, tkParLe, tkParRi,
|
of tkIntLit..tkCharLit, tkBracketLe, tkBracketRi, tkParLe, tkParRi,
|
||||||
tkCurlyRi, tkCurlyLe, tkEquals:
|
tkCurlyRi, tkCurlyLe, tkEquals:
|
||||||
add(result, newIdentNodeP(getIdent(tokToStr(p.tok)), p))
|
bracketAccm.add(tokToStr(p.tok))
|
||||||
getTok(p)
|
getTok(p)
|
||||||
of tokKeywordLow..tokKeywordHigh, tkSymbol, tkOpr, tkDot, tkDotDot:
|
of tokKeywordLow..tokKeywordHigh, tkSymbol, tkOpr, tkDot, tkDotDot:
|
||||||
add(result, newIdentNodeP(p.tok.ident, p))
|
add(result, newIdentNodeP(p.tok.ident, p))
|
||||||
getTok(p)
|
getTok(p)
|
||||||
else:
|
else:
|
||||||
if result.len == 0:
|
if result.len == 0 and bracketAccm == "":
|
||||||
echo repr p.tok
|
|
||||||
parMessage(p, errIdentifierExpected, p.tok)
|
parMessage(p, errIdentifierExpected, p.tok)
|
||||||
break
|
break
|
||||||
|
if bracketAccm != "":
|
||||||
|
result.add(newIdentNodeP(getIdent(bracketAccm), p))
|
||||||
eat(p, tkAccent)
|
eat(p, tkAccent)
|
||||||
else:
|
else:
|
||||||
if allowNil and p.tok.tokType == tkNil:
|
if allowNil and p.tok.tokType == tkNil:
|
||||||
|
|
|
||||||
|
|
@ -70,9 +70,10 @@ proc semEnum(c: PContext, n: PNode, prev: PType): PType =
|
||||||
counter = x
|
counter = x
|
||||||
of nkSym:
|
of nkSym:
|
||||||
e = n.sons[i].sym
|
e = n.sons[i].sym
|
||||||
of nkIdent:
|
of nkIdent, nkAccQuoted:
|
||||||
e = newSymS(skEnumField, n.sons[i], c)
|
e = newSymS(skEnumField, n.sons[i], c)
|
||||||
else: illFormedAst(n[i])
|
else:
|
||||||
|
illFormedAst(n[i])
|
||||||
e.typ = result
|
e.typ = result
|
||||||
e.position = int(counter)
|
e.position = int(counter)
|
||||||
if e.position == 0: hasNull = true
|
if e.position == 0: hasNull = true
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue