summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2017-03-31 17:03:15 +0200
committerAndreas Rumpf <rumpf_a@web.de>2017-03-31 17:03:15 +0200
commitd7eb146d28515e9aea5ae0f98e01b09bd96b5919 (patch)
tree01eceaaa5e87c7f333bb42980e61d2d05eff662d
parent98c6af780efded6bed75dc9af397b93ce95a3e14 (diff)
downloadNim-d7eb146d28515e9aea5ae0f98e01b09bd96b5919.tar.gz
make pragma expression parsing use the same parser mechanism as elsewhere
-rw-r--r--compiler/parser.nim5
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