Changeset 116
- Timestamp:
- 09/19/07 02:17:58 (1 year ago)
- Files:
-
- trunk/blade/SyntaxTree.d (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/blade/SyntaxTree.d
r115 r116 56 56 char [] syntaxtreeof(char [] expression) 57 57 { 58 char [] expr =expression;58 char [] expr = expression; 59 59 char [][] symbols = replaceSymbolsWithPlaceholders(expr); 60 60 // if (symbols.length> 25) return `static assert(0, "Too many symbols in expression.");`; … … 127 127 * 128 128 * Returns: an array of symbols (with no duplicates, though aliasing may exist) 129 * 130 * Supports all D syntax, except D2.004 string literals. 129 131 */ 130 132 char [][] replaceSymbolsWithPlaceholders(inout char [] expr) … … 179 181 code ~= "."; 180 182 } 181 if (c!='/' || i >= expr.length-1) code ~= c; 182 else { 183 // Remove comments 183 if (c!='/' || i >= expr.length-1) { 184 code ~= c; 185 } else { 186 // Remove comments. 184 187 if (expr[i..i+2]=="//") { 185 188 for ( ; i<expr.length && expr[i]!='\n' ; ++i) {} … … 220 223 operation was performed. This gives the associativity and precedence rules 221 224 which the compiler used. 222 223 Bugs:224 Doesn't support:225 unary operators & !226 && and || operators227 ?:228 $ not really supported: a[$-1] should be replaced by a[a.length-1]229 Comparison and NCEG floating point operators230 cast231 new, delete, anonymous classes232 mixin, assert, and import expressions233 225 */ 234 226 class AST(char [] expr) … … 306 298 * Insert parentheses around each symbol, to enforce normal D precedence rules. 307 299 * Returns: a string which, when mixed in, generates a parenthesised expression. 308 */ 300 * 301 * Bugs: 302 * Doesn't support: 303 * unary operators & ! 304 * && and || operators 305 * ?: 306 * $ not really supported: a[$-1] should be replaced by a[a.length-1] 307 * Comparison and NCEG floating point operators 308 * cast 309 * new, delete, anonymous classes 310 * mixin, assert, and import expressions 311 */ 309 312 char [] mixin_getPrecedence(char [] expr) 310 313 {
