Changeset 128
- Timestamp:
- 11/05/07 07:57:23 (10 months ago)
- Files:
-
- trunk/blade/SyntaxTree.d (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/blade/SyntaxTree.d
r123 r128 21 21 * unary operators & ! 22 22 * && and || operators 23 * Comparision operators and NCEG floating point operators23 * Comparision operators, NCEG floating point operators, is, !is 24 24 * ?: 25 * $ not really supported: a[$-1] should be replaced by a[a.length-1]26 25 * cast 27 26 * new, delete, anonymous classes … … 267 266 AST!(text ~ "[" ~ AllText!(T) ~ "]") opIndex(T...)(T x){ return null; } 268 267 AST!("(" ~ text ~ "(" ~ AllText!(T) ~ "))") opCall(T...)(T){ return null; } 269 AST!("( " ~ text ~ "[" ~ AllText!(T) ~ "]=" ~ U.text ~ ")") opIndexAssign(U, T...)(U,T){ return null; }268 AST!("((" ~ text ~ "[" ~ AllText!(T) ~ "])=" ~ U.text ~ ")") opIndexAssign(U, T...)(U,T){ return null; } 270 269 271 270 // Avoid infinite recursion by templating these functions. … … 273 272 preOp!("+") opPos(dummy=void)(){ return null; } 274 273 preOp!("-") opNeg(dummy=void)(){ return null; } 274 preOp!("*") opStar(dummy=void)(){ return null; } // D2.0 only 275 275 postOp!("[]") opSlice(dummy=void)(){ return null; } 276 276 postOp!("++") opPostInc(dummy=void)(){ return null; } … … 309 309 char [] code = "typeof("; 310 310 for(int i=0; i<expr.length; ++i) { 311 if (expr[i]>='A' && expr[i]<='Z' ) code ~= "(cast(AST!(`" ~ expr[i] ~"`))(null))";311 if (expr[i]>='A' && expr[i]<='Z' || expr[i]=='$') code ~= "(cast(AST!(`" ~ expr[i] ~"`))(null))"; 312 312 else code ~= expr[i]; 313 313 } … … 359 359 assert(mixin(mixin_getPrecedence("D -= A+B *C"))=="D-=(A+(B*C))"); 360 360 assert(mixin(mixin_getPrecedence("D -= ++A"))=="D-=(++A)"); 361 assert(mixin(mixin_getPrecedence("A[B,C/D]=E+F"))=="A[B,(C/D)]=(E+F)"); 361 assert(mixin(mixin_getPrecedence("A[B,$-C/D]=E+F"))=="(A[B,($-(C/D))])=(E+F)"); 362 assert(mixin(mixin_getPrecedence("A[B]=E+F"))=="(A[B])=(E+F)"); 363 assert(mixin(mixin_getPrecedence("A[$]=E+F"))=="(A[$])=(E+F)"); 362 364 assert(mixin(mixin_getPrecedence("G-=A[B][C..B^D][D]*E+F"))=="G-=((A[B][C..(B^D)][D]*E)+F)"); 363 365 assert(mixin(mixin_getPrecedence("E=A[B,C/D]*F"))=="E=(A[B,(C/D)]*F)");
