Previously pragmas could be attached only to whole statements, this change
allows attaching pragmas to inline statements, eg.:
template rewriteAdd{a + b}(a: expr, b: expr): expr =
({.noRewrite.}: a + b) + 1
Code above will cause a + b to be rewritten once, because rewriteAdd attaches
{.noRewrite.} to resulting a + b expr.
Previously parser was using lexMessage which was taking location from current
buffer position which was pointing after recently consumed token. But since
parser shows diagnostics about that token it should point to the location where
token starts.
This makes diagnostics like: `test.nim(2, 2) Error: ':' expected` point
properly at the beginning of the wrong token.
This makes use single comcol or eat for multiple cases. Also this makes
exprList responsible for consuming only list of expressions, nothing else which
is more logical.
As a side-effect compiler is now more consistent about errors, eg.:
try # <- missing something
echo "try"
finally:
echo "finally"
Triggers: test.nim(2, 6) Error: ':' expected
try:
echo "try"
finally # <- missing something
echo "finally"
Previously triggered: test.nim(4, 6) Error: invalid indentation
But now we got: Error: ':' expected - same as in 1st case
Don't use ^ operator yet for compatibility with older compilers.
Moved arrow like explanation, and fix precedence description on the text in the manual.
Fixed typo in news.
When #!strongSpaces is on, every operator affected by it gains priority higher than any operator not affected by it. This includes comparison operators, addition, etc.
It seems that counting spaces for keywords operators don't break anything in the parser. Of course, they can't have 0 spaces between their operands, but at least their precedence will work accordingly to their 1+ spaces.
This still doesn't work quite right, because some common operations like array
indexing lay completely outside the scope/symbol lookup system - they are not
even magics.