Ary Borenszweig escribió:
Jason House escribió:
Walter Bright Wrote:

5. Why can't one 'version out' syntax that is not recognized by the compiler?

The problem is that supporting this requires semantic analysis in order to successfully lex and parse the source code. Breaking this will make the lexing and parsing an order of magnitude harder for third party tools to do. If you need to 'comment out' a section of syntactically invalid code, use the /+ ... +/ nesting comment.

Would you be willing to introduce an alternative to /+ +/ which would be treated differently by the D1 and D2 compilers? Here are some examples with no attempt at creativity:
beginD1 endD1
D1 D1 (works like string delimiters)
/D2 D2/

Why not have special versions like D1, D2, D3 for the compiler to treat them differently? If a version(DX) is found that is not the current's compiler version, it just consumes tokens (counting opening and closing of brackets, etc.) until the curly's close. Much like the asm statement.

Ah, mmm... the lexer also needs to know this. Doesn't work. :-(

Well, it could work if you lookahead a few tokens...

Reply via email to