www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Can we have this Syntactic sugar.

enum CompileTimeOption{

    ANCHORED =A3=AC
    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 =3D 0){}
    static RegExp opCall(char[] pattern, int option2){}
}

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

    int X    =3D 33;

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

}
Nov 24 2009