Fix for some comments during if statements

added test files
This commit is contained in:
Vincent Burns
2014-01-13 01:51:36 -05:00
parent 58855c2fc7
commit 5f905865be
3 changed files with 25 additions and 1 deletions

View File

@@ -1473,12 +1473,12 @@ proc parseIf(p: var TParser): PNode =
while true:
getTok(p) # skip ``if``
var branch = newNodeP(nkElifBranch, p)
skipCom(p, branch)
eat(p, pxParLe, branch)
addSon(branch, expression(p))
eat(p, pxParRi, branch)
addSon(branch, nestedStatement(p))
addSon(result, branch)
skipCom(p, branch)
if p.tok.s == "else":
getTok(p, result)
if p.tok.s != "if":

View File

@@ -0,0 +1,21 @@
#include <stdlib.h>
#include <stdio.h>
int rand(void);
int main() {
float f = .2,
g = 2.,
h = 1.0+rand(),
i = 1.0e+3;
int j, a;
for(j = 0, a = 10; j < 0; j++, a++) ;
do {
printf("howdy");
} while(--i, 0);
if(1)
printf("1"); // error from this comment
else
printf("2");
return '\x00';
}

View File

@@ -0,0 +1,3 @@
struct foo {
int x,y,z;
};