Changeset 134
- Timestamp:
- 11/13/07 05:17:08 (10 months ago)
- Files:
-
- trunk/blade/BladeDemo.d (modified) (1 diff)
- trunk/blade/SyntaxTree.d (modified) (1 diff)
- trunk/blade/SyntaxTreeDemo.d (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/blade/BladeDemo.d
r133 r134 32 32 } 33 33 34 mixin(vectorize(" a += d*2.01 -z"));35 //mixin(vectorize(" a += r*2.01"));36 //mixin(vectorize(" q += q*2.01"));34 mixin(vectorize(" a += d*2.01*a[2]-z")); 35 mixin(vectorize(" a += r*2.01")); 36 mixin(vectorize(" q += q*2.01")); 37 37 38 38 writefln("a=", a); trunk/blade/SyntaxTree.d
r130 r134 330 330 { 331 331 // This function would just return sym.stringof, except for a couple of compiler bugs. 332 // (1) 1.23.stringof fails to compile. Fortunately (1.23).stringof works. 332 // (1) 1.23.stringof fails to compile. 333 // Fortunately (1.23).stringof works. IF you append "" to it! 333 334 // (2) x.stringof doesn't compile, if x is a function. Just return x instead. 334 335 // We also return x if x doesn't compile (eg, is an undefined variable). 335 336 if (sym[0]>='0' && sym[0]<='9') { // numeric literal 336 return "(" ~ sym ~ ").stringof";337 return `(` ~ sym ~ `).stringof~""`; 337 338 } 338 339 return `mixin(is(typeof(` ~ sym ~ `)==function) || !is(typeof(` ~ sym ~ `))?` ~ wrapInQuotes(wrapInQuotes(sym)) ~ `:` ~ wrapInQuotes(sym ~ ".stringof") ~ ")"; trunk/blade/SyntaxTreeDemo.d
r123 r134 102 102 mixin(vec("QUAL^st")); 103 103 mixin(vec("sin(3.45)")); 104 105 static z = [3.4, 565, 31.3, 0]; 106 double [] a = new double[4]; 107 double [] dun = [17.0, 28.25, 1, 56.2]; 108 109 mixin(vec(" a += dun*(25.5*3.01)-z")); 104 110 }
