1 NAME: "Conditional compilation"
2 CATEGORY: Lexical conventions (E262-3 ch 7)
12 **** VERY PRELIMINARY ****
13 **** UNAPPROVED PROPOSAL ****
17 - This needs to be compatible somehow with the MSIE approach
19 - The condition should really be restricted to "version=n" which
20 tests whether the browser can handle language version n or higher.
21 IOW, this is equivalent to the mime-type test.
23 - It's an interesting fact that code that loads scripts dynamically
24 into a browser that does not support this facility directly
25 can perform the preprocessing fairly easily using existing facilities.
26 That would be a good way to define its semantics.
31 A block comment that is preceded on the same line only by horizontal
32 whitespace and that starts with the four-character sequence /**@ is
33 part of a conditional compilation directive.
35 A condition must follow the @ without intervening spaces.
37 If the block comment does not end on the same line then:
39 If the condition is true, then the text in the block comment
40 starting from the line following the end of the condition through
41 the end of the comment is inserted into the source stream.
42 Otherwise the contents of the block comment are removed, just as
43 if the comment were an ordinary comment.
45 Otherwise, if the block comment does end on the same line then:
47 If the condition is false, then all the source text following the
48 comment up until the next block comment that begins with the text
49 /**@end (no leading whitespace etc) is removed from the source
50 stream. Otherwise it is left in place .
52 - if the block comment does end on the same line, then the text following
54 Directives may nest (useful to test for version=5 inside version=4 code).
56 No gunk after the condition, or after @else or @end -- only
57 whitespace (arbitrary linefeeds OK) and the end-comment thing.
61 @else */ // preceded by whitespace, followed by end-of-comment
71 function Point(x, y) : x=x, y=y {}
81 function Point(x, y) {