Commit b54ca447 authored by Taddeüs Kroes's avatar Taddeüs Kroes

Cleanup

parent abb3154f
...@@ -120,9 +120,7 @@ rule token = parse ...@@ -120,9 +120,7 @@ rule token = parse
let a = if a = "" then 1 else int_of_string a in let a = if a = "" then 1 else int_of_string a in
let b = match b with None -> 0 | Some n -> int_of_string n in let b = match b with None -> 0 | Some n -> int_of_string n in
let apply_sign n = function Some '-' -> -n | _ -> n in let apply_sign n = function Some '-' -> -n | _ -> n in
let a = apply_sign a a_sign in FORMULA (apply_sign a a_sign, apply_sign b b_sign)
let b = apply_sign b b_sign in
FORMULA (a, b)
} }
| O N L Y { ONLY } | O N L Y { ONLY }
......
...@@ -29,9 +29,8 @@ let rec specificity = ...@@ -29,9 +29,8 @@ let rec specificity =
let precedes (a, b, c, d) (e, f, g, h) = let precedes (a, b, c, d) (e, f, g, h) =
let rec loop = function let rec loop = function
| [] -> true
| 0 :: tl -> loop tl | 0 :: tl -> loop tl
| n :: _ when n > 0 -> true | [] | n :: _ when n > 0 -> true
| _ -> false | _ -> false
in in
loop [a - e; b - f; c - g; d - h] loop [a - e; b - f; c - g; d - h]
...@@ -64,8 +63,7 @@ let can_match_same selector1 selector2 = ...@@ -64,8 +63,7 @@ let can_match_same selector1 selector2 =
in in
let rec intersect l = function let rec intersect l = function
| [] -> false | [] -> false
| hd :: _ when List.mem hd l -> true | hd :: tl -> List.mem hd l || intersect l tl
| _ :: tl -> intersect l tl
in in
let elem1, classes1, ids1, pseudos1, attrs1 = unfold selector1 in let elem1, classes1, ids1, pseudos1, attrs1 = unfold selector1 in
let elem2, classes2, ids2, pseudos2, attrs2 = unfold selector2 in let elem2, classes2, ids2, pseudos2, attrs2 = unfold selector2 in
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment