package com.gliwka.hyperscan.wrapper;

/**
 * Flags influencing the matching behaviour of the scanner for a particular Expression
 */
public enum ExpressionFlag implements BitFlag {

    /**
     * Expression will be compiled with no flags.
     */
    NO_FLAG(0),


    /**
     * Matching will be performed case-insensitively.
     */
    CASELESS(1),

    /**
     * Matching a . will not exclude newlines.
     */
    DOTALL(2),


    /**
     * ^ and $ anchors match any newlines in data.
     */
    MULTILINE(4),

    /**
     * Only one match will be generated by the expression per stream.
     */
    SINGLEMATCH(8),

    /**
     * Allow expressions which can match against an empty string, such as .*.
     */
    ALLOWEMPTY(16),

    /**
     * Treat this pattern as a sequence of UTF-8 characters.
     */
    UTF8(32),

    /**
     * Use Unicode properties for character classes.
     */
    UCP(64),

    /**
     * compile pattern in prefiltering mode.
     */
    PREFILTER(128),

    /**
     * Report the leftmost start of match offset when a match is found.
     */
    SOM_LEFTMOST(256),

    /**
     * Parse the expression in logical combination syntax.
     */
    COMBINATION(512),

    /**
     * Ignore match reporting for this expression. Used for the sub-expressions in logical combinations.
     */
    QUIET(1024);

    private final int bits;

    ExpressionFlag(int bitPosition) {
        this.bits = bitPosition;
    }


    /**
     * Get the significant bits for the flag
     * @return int containing the significant bit for the flag
     */
    public int getBits() {
        return bits;
    }
}

@@ -32,16 +32,69 @@
 apper;%0A%0A
+import static com.gliwka.hyperscan.jni.hyperscan.*;%0A%0A
 /**%0A * F
@@ -396,17 +396,32 @@
 ASELESS(
-1
+HS_FLAG_CASELESS
 ),%0A%0A    
@@ -490,17 +490,30 @@
  DOTALL(
-2
+HS_FLAG_DOTALL
 ),%0A%0A%0A   
@@ -590,17 +590,33 @@
 LTILINE(
-4
+HS_FLAG_MULTILINE
 ),%0A%0A    
@@ -713,17 +713,35 @@
 LEMATCH(
-8
+HS_FLAG_SINGLEMATCH
 ),%0A%0A    
@@ -849,10 +849,26 @@
 PTY(
-16
+HS_FLAG_ALLOWEMPTY
 ),%0A%0A
@@ -957,10 +957,20 @@
 TF8(
-32
+HS_FLAG_UTF8
 ),%0A%0A
@@ -1050,10 +1050,19 @@
 UCP(
-64
+HS_FLAG_UCP
 ),%0A%0A
@@ -1140,11 +1140,25 @@
 TER(
-128
+HS_FLAG_PREFILTER
 ),%0A%0A
@@ -1266,11 +1266,28 @@
 OST(
-256
+HS_FLAG_SOM_LEFTMOST
 ),%0A%0A
@@ -1381,11 +1381,27 @@
 ION(
-512
+HS_FLAG_COMBINATION
 ),%0A%0A
@@ -1535,12 +1535,21 @@
 IET(
-1024
+HS_FLAG_QUIET
 );%0A%0A

Use constants for bit flag values