summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2015-03-27 02:14:27 +0100
committerAraq <rumpf_a@web.de>2015-03-27 02:14:27 +0100
commite80840c40af5c9108e9aed1573cf4f048a2757b8 (patch)
tree346fe321dccd550ddf3edf908c5bc9c8a99b8c0b /compiler
parent7720c0aafd61a446a6d36cc96c485c44d899dfd3 (diff)
downloadNim-e80840c40af5c9108e9aed1573cf4f048a2757b8.tar.gz
preparations for dealing with the 'echo $foo' gotcha
Diffstat (limited to 'compiler')
-rw-r--r--compiler/parser.nim12
1 files changed, 9 insertions, 3 deletions
diff --git a/compiler/parser.nim b/compiler/parser.nim
index d1aa2d8e3..dcd5401e8 100644
--- a/compiler/parser.nim
+++ b/compiler/parser.nim
@@ -241,9 +241,15 @@ proc isOperator(tok: TToken): bool =
 
 proc isUnary(p: TParser): bool =
   ## Check if the current parser token is a unary operator
-  p.strongSpaces and p.tok.tokType in {tkOpr, tkDotDot} and
-    p.tok.strongSpaceB == 0 and
-    p.tok.strongSpaceA > 0
+  if p.tok.tokType in {tkOpr, tkDotDot} and
+     p.tok.strongSpaceB == 0 and
+     p.tok.strongSpaceA > 0:
+    # XXX change this after 0.10.4 is out
+    if p.strongSpaces:
+      result = true
+    else:
+      parMessage(p, warnDeprecated,
+        "will be parsed as unary operator; inconsistent spacing")
 
 proc checkBinary(p: TParser) {.inline.} =
   ## Check if the current parser token is a binary operator.