enum CompileTimeOption{

    ANCHORED ,
    AUTO_CALLOUT ,
    CASELESS ,
    ENDONLY  ,
    DOTALL  ,
    EXTENDED ,
    EXTRA   ,
    FIRSTLINE ,
    MULTILINE  ,
    NO_AUTO_CAPTURE  ,
    UNGREEDY ,
    UTF8 ,
    NO_UTF8_CHECK  ,
    DUPNAMES  ,
    NEWLINE_CR   ,
    NEWLINE_LF   ,
    NEWLINE_CRLF   ,
    NEWLINE_ANY   ,
}

public class RegExp
{
    enum {
        X, Y, Z
    }
    this(char[] pattern, int options = 0){}
    static RegExp opCall(char[] pattern, int option2){}
}

void main(){
    RegExp reg1    = new RegExp("^A.+", CompileTimeOption.UTF8 |
CompileTimeOption.MULTILINE | CompileTimeOption.DOTALL );
    // Syntactic sugar.
    RegExp reg2    = new RegExp("^A.+",
            CompileTimeOption.( UTF8 | MULTILINE | DOTALL )
        );
    const MyRegExpOption    = CompileTimeOption.( UTF8 | MULTILINE | DOTALL
);
    RegExp reg3    = RegExp( "^A.+",  .(X+Y*Z) );

    int X    = 33;

    RegExp reg4    = RegExp( "^A.+",  .( X+ .X /* the outer X */  ) );

}

Reply via email to