diff options
author | flaviut <tamasflaviu@gmail.com> | 2014-06-03 10:22:12 -0400 |
---|---|---|
committer | flaviut <tamasflaviu@gmail.com> | 2014-06-03 14:15:32 -0400 |
commit | 20cb567bf5e404a30bb4b898b87865e4304b1130 (patch) | |
tree | c52f43bc1bdf3b84ca73f371ba81140953b708ef | |
parent | 7b1b3cbf2505f1b0f31349bd7f22c3c608820204 (diff) | |
download | Nim-20cb567bf5e404a30bb4b898b87865e4304b1130.tar.gz |
Fix accents in enums
-rw-r--r-- | compiler/parser.nim | 8 | ||||
-rw-r--r-- | compiler/semtypes.nim | 5 |
2 files changed, 8 insertions, 5 deletions
diff --git a/compiler/parser.nim b/compiler/parser.nim index 61816f443..f89aee119 100644 --- a/compiler/parser.nim +++ b/compiler/parser.nim @@ -296,20 +296,22 @@ proc parseSymbol(p: var TParser, allowNil = false): PNode = of tkAccent: result = newNodeP(nkAccQuoted, p) getTok(p) + var bracketAccm = "" while true: case p.tok.tokType of tkIntLit..tkCharLit, tkBracketLe, tkBracketRi, tkParLe, tkParRi, tkCurlyRi, tkCurlyLe, tkEquals: - add(result, newIdentNodeP(getIdent(tokToStr(p.tok)), p)) + bracketAccm.add(tokToStr(p.tok)) getTok(p) of tokKeywordLow..tokKeywordHigh, tkSymbol, tkOpr, tkDot, tkDotDot: add(result, newIdentNodeP(p.tok.ident, p)) getTok(p) else: - if result.len == 0: - echo repr p.tok + if result.len == 0 and bracketAccm == "": parMessage(p, errIdentifierExpected, p.tok) break + if bracketAccm != "": + result.add(newIdentNodeP(getIdent(bracketAccm), p)) eat(p, tkAccent) else: if allowNil and p.tok.tokType == tkNil: diff --git a/compiler/semtypes.nim b/compiler/semtypes.nim index d70ed3465..2dcca8f1e 100644 --- a/compiler/semtypes.nim +++ b/compiler/semtypes.nim @@ -70,9 +70,10 @@ proc semEnum(c: PContext, n: PNode, prev: PType): PType = counter = x of nkSym: e = n.sons[i].sym - of nkIdent: + of nkIdent, nkAccQuoted: e = newSymS(skEnumField, n.sons[i], c) - else: illFormedAst(n[i]) + else: + illFormedAst(n[i]) e.typ = result e.position = int(counter) if e.position == 0: hasNull = true |