summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rwxr-xr-xcompiler/parser.nim13
-rwxr-xr-xdoc/manual.txt6
-rwxr-xr-xtodo.txt3
-rwxr-xr-xweb/news.txt4
4 files changed, 15 insertions, 11 deletions
diff --git a/compiler/parser.nim b/compiler/parser.nim
index e65503b2c..26ffaf59c 100755
--- a/compiler/parser.nim
+++ b/compiler/parser.nim
@@ -1481,7 +1481,7 @@ proc parseStmt(p: var TParser): PNode =
     getTok(p)
     while true: 
       case p.tok.tokType
-      of tkSad: getTok(p)
+      of tkSad, tkSemicolon: getTok(p)
       of tkEof: break 
       of tkDed: 
         getTok(p)
@@ -1494,16 +1494,17 @@ proc parseStmt(p: var TParser): PNode =
           break 
         addSon(result, a)
     popInd(p.lex)
-  else: 
+  else:
     # the case statement is only needed for better error messages:
     case p.tok.tokType
-    of tkIf, tkWhile, tkCase, tkTry, tkFor, tkBlock, tkAsm, tkProc, tkIterator, 
-       tkMacro, tkType, tkConst, tkWhen, tkVar: 
+    of tkIf, tkWhile, tkCase, tkTry, tkFor, tkBlock, tkAsm, tkProc, tkIterator,
+       tkMacro, tkType, tkConst, tkWhen, tkVar:
       parMessage(p, errComplexStmtRequiresInd)
       result = ast.emptyNode
-    else: 
+    else:
       result = simpleStmt(p)
       if result.kind == nkEmpty: parMessage(p, errExprExpected, p.tok)
+      if p.tok.tokType == tkSemicolon: getTok(p)
       if p.tok.tokType == tkSad: getTok(p)
   
 proc parseAll(p: var TParser): PNode = 
@@ -1522,7 +1523,7 @@ proc parseTopLevelStmt(p: var TParser): PNode =
   result = ast.emptyNode
   while true: 
     case p.tok.tokType
-    of tkSad: getTok(p)
+    of tkSad, tkSemicolon: getTok(p)
     of tkDed, tkInd: 
       parMessage(p, errInvalidIndentation)
       getTok(p)
diff --git a/doc/manual.txt b/doc/manual.txt
index f526d9d22..201d7be5e 100755
--- a/doc/manual.txt
+++ b/doc/manual.txt
@@ -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 
 type ``range[0..2]``. The following built-in operators for integers are 
 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.
-(Bitwise and then behaves as a ``mod`` operation.)
+(Bitwise ``and`` is then a ``mod`` operation.)
 
 This means that the following code is accepted:
 
diff --git a/todo.txt b/todo.txt
index 53bdbb53d..d6b84d753 100755
--- a/todo.txt
+++ b/todo.txt
@@ -15,7 +15,6 @@ New pragmas:
 - document destructors
 
 - ``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
 - ``=`` should be overloadable; requires specialization for ``=``
 - optimize genericAssign in the code generator
@@ -38,6 +37,8 @@ Bugs
 
 - bug: pragma statements in combination with symbol files are evaluated twice
   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
diff --git a/web/news.txt b/web/news.txt
index 9a46a9f04..0143d8f9a 100755
--- a/web/news.txt
+++ b/web/news.txt
@@ -124,12 +124,14 @@ Language Additions
   allowing for *sigil-like* operators.
 - Stand-alone ``finally`` and ``except`` blocks are now supported.
 - 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.
 - The integer promotion rules changed.
 - 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 
   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