...

Text file src/github.com/alecthomas/chroma/lexers/testdata/openscad.actual

Documentation: github.com/alecthomas/chroma/lexers/testdata

     1use <write.scad>
     2include <../common/base.scad>
     3
     4/*
     5	Multiline
     6	Comment
     7*/
     8
     9//draw a foobar
    10module foobar(){
    11    translate([0,-10,0])
    12    difference(){
    13    	height=5+6;
    14        cube([height,10.04,2.99e+8]);
    15        sphere(r=PI,$fn=100);
    16    }
    17}
    18
    19foobar();
    20#cube ([5,5,5]);
    21echo("done");
    22    
    23function func0() = 5;
    24function func1(x=3) = 2*x+1;
    25function func2() = [1,2,3,4];
    26function func3(y=7) = (y==7) ? 5 : 2 ;
    27function func4(p0,p1,p2,p3) = [p0,p1,p2,p3];
    28    
    29echo (func0());           // 5
    30a =   func1();            // 7
    31b=    func1(5);           // 11
    32echo (func2());           // [1, 2, 3, 4]
    33echo( func3(2),func3());  // 2, 5
    34   
    35z= func4(func0(),func1(),func2(),func3()); //  [5, 7, [1, 2, 3, 4], 5]
    36   
    37translate([0,-4*func0(),0])cube([func0(),2*func0(),func0()]);
    38
    39module parallelogram(x=1,y=1,angle=90)
    40    {polygon([[0,0],[x,0],
    41              [x+x*cos(angle)/sin(angle),y],
    42              [x*cos(angle)/sin(angle),y]]);};
    43  
    44parallelogram(10,10,35);
    45
    46 function add_up_to(n) = ( n==0 ? 0 : n + add_up_to(n-1) );

View as plain text