mirror of
https://github.com/nim-lang/Nim.git
synced 2026-02-17 16:38:33 +00:00
Fix for some comments during if statements
added test files
This commit is contained in:
@@ -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":
|
||||
|
||||
21
compiler/c2nim/tests/vincent.c
Normal file
21
compiler/c2nim/tests/vincent.c
Normal 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';
|
||||
}
|
||||
3
compiler/c2nim/tests/vincent.h
Normal file
3
compiler/c2nim/tests/vincent.h
Normal file
@@ -0,0 +1,3 @@
|
||||
struct foo {
|
||||
int x,y,z;
|
||||
};
|
||||
Reference in New Issue
Block a user