package ott.compiler;

import ott.compiler.compileable.types.ConditionOpType;
import ott.parsing.*;

public enum CompilerTokens implements TokenType {
    COMMENT("/\\*(?>(?:(?>[^*]+)|\\*(?!/))*)\\*/|//.*"),
    ADD_OP("\\+|-"),
    MUL_OP("\\*"),
    NUMBER("0x(\\d|[A-F])+|\\d+"),
    SPECIAL("\\(|\\)|=|;|,"),
    FUNCTION("function "),
    VARIABLE("var "),
    CONTROL("if|else|while"), // do|for
    CONDITION_OP(ConditionOpType.getRegex()),
    LABEL("[a-zA-z]([a-zA-z]|\\d)*"),
    UNKOWN("\\S+"); // aggressive regex for anything not already registered

    private String regex;

    private CompilerTokens(String regex) {
        this.regex = regex;
    }

    @Override
    public String regex() {
        return regex;
    }
}

@@ -272,24 +272,70 @@
 %5D)+%7C%5C%5Cd+%22),%0A
+    CONDITION_OP(ConditionOpType.getRegex()),%0A
     SPECIAL(
@@ -445,54 +445,8 @@
 for%0A
-    CONDITION_OP(ConditionOpType.getRegex()),%0A
     

put condition op before special in the compiler tokens so that it pulls '==' before it will pull '='