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.
Most of editors/IDEs expect column numbers to start from 1, so (1, 1) means
beginning of the file.
This change applies only to diagnostics output, however Nim will still
internally number columns starting from 0.
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.
The problem was saveConstant only checked the range
`nkCharLit..nkInt64Lit`, but not up to UInt. This lead to the sonsLen
method being called, where sons was never declared.
This commit changes it to `nkCharLit..nkUint64Lit`, to match the case
statements in the type definition of TNode, in ast.nim.
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.