diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2017-03-31 17:03:15 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2017-03-31 17:03:15 +0200 |
commit | d7eb146d28515e9aea5ae0f98e01b09bd96b5919 (patch) | |
tree | 01eceaaa5e87c7f333bb42980e61d2d05eff662d | |
parent | 98c6af780efded6bed75dc9af397b93ce95a3e14 (diff) | |
download | Nim-d7eb146d28515e9aea5ae0f98e01b09bd96b5919.tar.gz |
make pragma expression parsing use the same parser mechanism as elsewhere
-rw-r--r-- | compiler/parser.nim | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/compiler/parser.nim b/compiler/parser.nim index 8457adac7..84402ea3b 100644 --- a/compiler/parser.nim +++ b/compiler/parser.nim @@ -287,7 +287,7 @@ proc checkBinary(p: TParser) {.inline.} = #| optInd = COMMENT? #| optPar = (IND{>} | IND{=})? #| -#| simpleExpr = arrowExpr (OP0 optInd arrowExpr)* +#| simpleExpr = arrowExpr (OP0 optInd arrowExpr)* pragma? #| arrowExpr = assignExpr (OP1 optInd assignExpr)* #| assignExpr = orExpr (OP2 optInd orExpr)* #| orExpr = andExpr (OP3 optInd andExpr)* @@ -771,8 +771,7 @@ proc parseOperators(p: var TParser, headNode: PNode, proc simpleExprAux(p: var TParser, limit: int, mode: TPrimaryMode): PNode = result = primary(p, mode) - if p.tok.tokType == tkCurlyDotLe and - p.lex.lineNumber == result.info.line and + if p.tok.tokType == tkCurlyDotLe and (p.tok.indent < 0 or realInd(p)) and mode == pmNormal: var pragmaExp = newNodeP(nkPragmaExpr, p) pragmaExp.addSon result |