Fixed weakness in parser causing modifier characters not to work in front of 'if' statements. Fixes #197

felipesanches-svg
Marius Kintel 2012-10-07 15:24:08 -04:00
parent fa9811c0f3
commit 0cea83a35d
20 changed files with 57 additions and 26 deletions

View File

@ -233,6 +233,22 @@ ifelse_statement:
} ;
module_instantiation:
'!' module_instantiation {
$$ = $2;
if ($$) $$->tag_root = true;
} |
'#' module_instantiation {
$$ = $2;
if ($$) $$->tag_highlight = true;
} |
'%' module_instantiation {
$$ = $2;
if ($$) $$->tag_background = true;
} |
'*' module_instantiation {
delete $2;
$$ = NULL;
} |
single_module_instantiation ';' {
$$ = $1;
} |
@ -271,26 +287,7 @@ single_module_instantiation:
$$->argexpr = $3->argexpr;
free($1);
delete $3;
} |
'!' single_module_instantiation {
$$ = $2;
if ($$)
$$->tag_root = true;
} |
'#' single_module_instantiation {
$$ = $2;
if ($$)
$$->tag_highlight = true;
} |
'%' single_module_instantiation {
$$ = $2;
if ($$)
$$->tag_background = true;
} |
'*' single_module_instantiation {
delete $2;
$$ = NULL;
};
}
expr:
TOK_TRUE {

View File

@ -2,3 +2,4 @@ difference() {
sphere(r=10);
%cylinder(h=30, r=6, center=true);
}
%if (true) cube([25,6,3], center=true);

View File

@ -2,3 +2,4 @@ difference() {
*sphere(r=10);
cylinder(h=30, r=6, center=true);
}
*if (true) cube([25,6,3], center=true);

View File

@ -1,8 +1,10 @@
difference() {
sphere(r=10);
%#cylinder(h=30, r=6, center=true);
%#if (true) cube([6,25,3], center=true);
}
translate([13,0,0]) difference() {
sphere(r=10);
#%cylinder(h=30, r=6, center=true);
#%if (true) cube([6,25,3], center=true);
}

View File

@ -2,3 +2,4 @@ difference() {
sphere(r=10);
#cylinder(h=30, r=6, center=true);
}
#if (true) cube([25,6,3], center=true);

View File

@ -19,10 +19,10 @@ translate([25,0,0]) hull() {
// Don't Crash (issue 188)
translate([-5,-5,-5]) {
hull() {
intersection(){
cube([1,1,1]);
translate([-1,-1,-1]) cube([1,1,1]);
}
hull() {
intersection() {
cube([1,1,1]);
translate([-1,-1,-1]) cube([1,1,1]);
}
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

View File

@ -2,4 +2,7 @@
sphere($fn = 0, $fa = 12, $fs = 2, r = 10);
%cylinder($fn = 0, $fa = 12, $fs = 2, h = 30, r1 = 6, r2 = 6, center = true);
}
%group() {
cube(size = [25, 6, 3], center = true);
}

View File

@ -1,11 +1,17 @@
difference() {
sphere($fn = 0, $fa = 12, $fs = 2, r = 10);
%cylinder($fn = 0, $fa = 12, $fs = 2, h = 30, r1 = 6, r2 = 6, center = true);
%group() {
cube(size = [6, 25, 3], center = true);
}
}
multmatrix([[1, 0, 0, 13], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
difference() {
sphere($fn = 0, $fa = 12, $fs = 2, r = 10);
%cylinder($fn = 0, $fa = 12, $fs = 2, h = 30, r1 = 6, r2 = 6, center = true);
%group() {
cube(size = [6, 25, 3], center = true);
}
}
}

View File

@ -2,4 +2,7 @@
sphere($fn = 0, $fa = 12, $fs = 2, r = 10);
cylinder($fn = 0, $fa = 12, $fs = 2, h = 30, r1 = 6, r2 = 6, center = true);
}
group() {
cube(size = [25, 6, 3], center = true);
}

View File

@ -17,4 +17,14 @@
}
}
}
multmatrix([[1, 0, 0, -5], [0, 1, 0, -5], [0, 0, 1, -5], [0, 0, 0, 1]]) {
hull() {
intersection() {
cube(size = [1, 1, 1], center = false);
multmatrix([[1, 0, 0, -1], [0, 1, 0, -1], [0, 0, 1, -1], [0, 0, 0, 1]]) {
cube(size = [1, 1, 1], center = false);
}
}
}
}

View File

@ -0,0 +1,7 @@
group() {
sphere($fn = 0, $fa = 12, $fs = 2, r = 5);
}
group() {
cube(size = [5, 5, 5], center = false);
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB