diff options
author | flaviut <tamasflaviu@gmail.com> | 2014-06-03 18:58:59 -0400 |
---|---|---|
committer | flaviut <tamasflaviu@gmail.com> | 2014-06-03 19:05:12 -0400 |
commit | 7a9bcf47697a004de8d3b3ec54beb8ac4bdb9872 (patch) | |
tree | 26301af9aff276b46c17f8c8769f092783f61f44 | |
parent | 20cb567bf5e404a30bb4b898b87865e4304b1130 (diff) | |
download | Nim-7a9bcf47697a004de8d3b3ec54beb8ac4bdb9872.tar.gz |
Clean up code
-rw-r--r-- | compiler/parser.nim | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/compiler/parser.nim b/compiler/parser.nim index f89aee119..ae115e749 100644 --- a/compiler/parser.nim +++ b/compiler/parser.nim @@ -296,22 +296,17 @@ proc parseSymbol(p: var TParser, allowNil = false): PNode = of tkAccent: result = newNodeP(nkAccQuoted, p) getTok(p) - var bracketAccm = "" + var accm = "" while true: case p.tok.tokType - of tkIntLit..tkCharLit, tkBracketLe, tkBracketRi, tkParLe, tkParRi, - tkCurlyRi, tkCurlyLe, tkEquals: - 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 and bracketAccm == "": + of tkAccent, tkEof: + if accm == "": parMessage(p, errIdentifierExpected, p.tok) break - if bracketAccm != "": - result.add(newIdentNodeP(getIdent(bracketAccm), p)) + else: + accm.add(tokToStr(p.tok)) + getTok(p) + result.add(newIdentNodeP(getIdent(accm), p)) eat(p, tkAccent) else: if allowNil and p.tok.tokType == tkNil: |