Răsfoiți Sursa

changed version check syntax if #if

ncannasse 6 ani în urmă
părinte
comite
81c9d2b98d
3 a modificat fișierele cu 5 adăugiri și 5 ștergeri
  1. 1 1
      src/syntax/grammar.mly
  2. 1 1
      src/syntax/parserEntry.ml
  3. 3 3
      std/hl/Format.hx

+ 1 - 1
src/syntax/grammar.mly

@@ -1468,12 +1468,12 @@ let rec validate_macro_cond s e = match fst e with
 	| EConst (String _)
 	| EConst (Int _)
 	| EConst (Float _)
-	| EConst (Regexp _)
 		-> e
 	| EUnop (op,p,e1) -> (EUnop (op, p, validate_macro_cond s e1), snd e)
 	| EBinop (op,e1,e2) -> (EBinop(op, (validate_macro_cond s e1), (validate_macro_cond s e2)), snd e)
 	| EParenthesis (e1) -> (EParenthesis (validate_macro_cond s e1), snd e)
 	| EField(e1,name) -> (EField(validate_macro_cond s e1,name), snd e)
+	| ECall ((EConst (Ident _),_) as i, args) -> (ECall (i,List.map (validate_macro_cond s) args),snd e)
 	| _ -> syntax_error (Custom ("Invalid conditional expression")) ~pos:(Some (pos e)) s ((EConst (Ident "false"),(pos e)))
 
 let parse_macro_ident t p s =

+ 1 - 1
src/syntax/parserEntry.ml

@@ -57,7 +57,7 @@ let rec eval ctx (e,p) =
 	| EConst (String s) -> TString s
 	| EConst (Int i) -> TFloat (float_of_string i)
 	| EConst (Float f) -> TFloat (float_of_string f)
-	| EConst (Regexp (s,_)) -> TVersion (make_version s)
+	| ECall ((EConst (Ident "version"),_),[(EConst (String s),_)]) -> TVersion (make_version s)
 	| EBinop (OpBoolAnd, e1, e2) -> TBool (is_true (eval ctx e1) && is_true (eval ctx e2))
 	| EBinop (OpBoolOr, e1, e2) -> TBool (is_true (eval ctx e1) || is_true(eval ctx e2))
 	| EUnop (Not, _, e) -> TBool (not (is_true (eval ctx e)))

+ 3 - 3
std/hl/Format.hx

@@ -60,9 +60,9 @@ class Format {
 	/**
 		Decode any image data into ARGB pixels
 	**/
-	#if (hl_ver >= ~/1.10/)
-	@:hlNative("fmt","img_decode")
-	public static function decodeIMG( src : hl.Bytes, srcLen : Int, dst : hl.Bytes, width : Int, height : Int ) : Bool {
+	#if (hl_ver >= version("1.10"))
+	@:hlNative("fmt","dxt_decode")
+	public static function decodeDXT( src : hl.Bytes, dst : hl.Bytes, width : Int, height : Int, dxtFormat : Int ) : Bool {
 		return false;
 	}
 	#end