mirror of
https://github.com/nim-lang/Nim.git
synced 2026-05-04 21:14:48 +00:00
';' as statement separator
This commit is contained in:
@@ -1481,7 +1481,7 @@ proc parseStmt(p: var TParser): PNode =
|
|||||||
getTok(p)
|
getTok(p)
|
||||||
while true:
|
while true:
|
||||||
case p.tok.tokType
|
case p.tok.tokType
|
||||||
of tkSad: getTok(p)
|
of tkSad, tkSemicolon: getTok(p)
|
||||||
of tkEof: break
|
of tkEof: break
|
||||||
of tkDed:
|
of tkDed:
|
||||||
getTok(p)
|
getTok(p)
|
||||||
@@ -1494,16 +1494,17 @@ proc parseStmt(p: var TParser): PNode =
|
|||||||
break
|
break
|
||||||
addSon(result, a)
|
addSon(result, a)
|
||||||
popInd(p.lex)
|
popInd(p.lex)
|
||||||
else:
|
else:
|
||||||
# the case statement is only needed for better error messages:
|
# the case statement is only needed for better error messages:
|
||||||
case p.tok.tokType
|
case p.tok.tokType
|
||||||
of tkIf, tkWhile, tkCase, tkTry, tkFor, tkBlock, tkAsm, tkProc, tkIterator,
|
of tkIf, tkWhile, tkCase, tkTry, tkFor, tkBlock, tkAsm, tkProc, tkIterator,
|
||||||
tkMacro, tkType, tkConst, tkWhen, tkVar:
|
tkMacro, tkType, tkConst, tkWhen, tkVar:
|
||||||
parMessage(p, errComplexStmtRequiresInd)
|
parMessage(p, errComplexStmtRequiresInd)
|
||||||
result = ast.emptyNode
|
result = ast.emptyNode
|
||||||
else:
|
else:
|
||||||
result = simpleStmt(p)
|
result = simpleStmt(p)
|
||||||
if result.kind == nkEmpty: parMessage(p, errExprExpected, p.tok)
|
if result.kind == nkEmpty: parMessage(p, errExprExpected, p.tok)
|
||||||
|
if p.tok.tokType == tkSemicolon: getTok(p)
|
||||||
if p.tok.tokType == tkSad: getTok(p)
|
if p.tok.tokType == tkSad: getTok(p)
|
||||||
|
|
||||||
proc parseAll(p: var TParser): PNode =
|
proc parseAll(p: var TParser): PNode =
|
||||||
@@ -1522,7 +1523,7 @@ proc parseTopLevelStmt(p: var TParser): PNode =
|
|||||||
result = ast.emptyNode
|
result = ast.emptyNode
|
||||||
while true:
|
while true:
|
||||||
case p.tok.tokType
|
case p.tok.tokType
|
||||||
of tkSad: getTok(p)
|
of tkSad, tkSemicolon: getTok(p)
|
||||||
of tkDed, tkInd:
|
of tkDed, tkInd:
|
||||||
parMessage(p, errInvalidIndentation)
|
parMessage(p, errInvalidIndentation)
|
||||||
getTok(p)
|
getTok(p)
|
||||||
|
|||||||
@@ -614,11 +614,11 @@ Nimrod requires `interval arithmetic`:idx: for subrange types over a set
|
|||||||
of built-in operators that involve constants: ``x mod 3`` is of
|
of built-in operators that involve constants: ``x mod 3`` is of
|
||||||
type ``range[0..2]``. The following built-in operators for integers are
|
type ``range[0..2]``. The following built-in operators for integers are
|
||||||
affected by this rule: ``-``, ``+``, ``*``, ``min``, ``max``, ``succ``,
|
affected by this rule: ``-``, ``+``, ``*``, ``min``, ``max``, ``succ``,
|
||||||
``pred``, ``mod``, ``div``, ``and`` (bitwise and).
|
``pred``, ``mod``, ``div``, ``and`` (bitwise ``and``).
|
||||||
|
|
||||||
Bitwise and only produces a ``range`` if one of its operands is a
|
Bitwise ``and`` only produces a ``range`` if one of its operands is a
|
||||||
constant *x* so that (x+1) is a number of two.
|
constant *x* so that (x+1) is a number of two.
|
||||||
(Bitwise and then behaves as a ``mod`` operation.)
|
(Bitwise ``and`` is then a ``mod`` operation.)
|
||||||
|
|
||||||
This means that the following code is accepted:
|
This means that the following code is accepted:
|
||||||
|
|
||||||
|
|||||||
3
todo.txt
3
todo.txt
@@ -15,7 +15,6 @@ New pragmas:
|
|||||||
- document destructors
|
- document destructors
|
||||||
|
|
||||||
- ``borrow`` needs to take type classes into account
|
- ``borrow`` needs to take type classes into account
|
||||||
- introduce ``;`` to the parser: inc a; inc b
|
|
||||||
- make use of ``tyIter`` to fix the implicit items/pairs issue
|
- make use of ``tyIter`` to fix the implicit items/pairs issue
|
||||||
- ``=`` should be overloadable; requires specialization for ``=``
|
- ``=`` should be overloadable; requires specialization for ``=``
|
||||||
- optimize genericAssign in the code generator
|
- optimize genericAssign in the code generator
|
||||||
@@ -38,6 +37,8 @@ Bugs
|
|||||||
|
|
||||||
- bug: pragma statements in combination with symbol files are evaluated twice
|
- bug: pragma statements in combination with symbol files are evaluated twice
|
||||||
but this can lead to compilation errors
|
but this can lead to compilation errors
|
||||||
|
- bug: the parser is not strict enough with newlines: 'echo "a" echo "b"'
|
||||||
|
compiles
|
||||||
|
|
||||||
|
|
||||||
version 0.9.XX
|
version 0.9.XX
|
||||||
|
|||||||
@@ -124,12 +124,14 @@ Language Additions
|
|||||||
allowing for *sigil-like* operators.
|
allowing for *sigil-like* operators.
|
||||||
- Stand-alone ``finally`` and ``except`` blocks are now supported.
|
- Stand-alone ``finally`` and ``except`` blocks are now supported.
|
||||||
- Macros and templates can now be invoked as pragmas.
|
- Macros and templates can now be invoked as pragmas.
|
||||||
- The apostrophe in type suffixes for numerical literal is now optional.
|
- The apostrophe in type suffixes for numerical literals is now optional.
|
||||||
- Unsigned integer types have been added.
|
- Unsigned integer types have been added.
|
||||||
- The integer promotion rules changed.
|
- The integer promotion rules changed.
|
||||||
- Nimrod now tracks proper intervals for ``range`` over some built-in operators.
|
- Nimrod now tracks proper intervals for ``range`` over some built-in operators.
|
||||||
- In parameter lists a semicolon instead of a comma can be used to improve
|
- In parameter lists a semicolon instead of a comma can be used to improve
|
||||||
readability: ``proc divmod(a, b: int; resA, resB: var int)``.
|
readability: ``proc divmod(a, b: int; resA, resB: var int)``.
|
||||||
|
- A semicolon can now be used to have multiple simple statements on a single
|
||||||
|
line: ``inc i; inc j``.
|
||||||
|
|
||||||
|
|
||||||
2012-02-09 Version 0.8.14 released
|
2012-02-09 Version 0.8.14 released
|
||||||
|
|||||||
Reference in New Issue
Block a user