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

Cleanup

parent abb3154f
......@@ -120,9 +120,7 @@ rule token = parse
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 apply_sign n = function Some '-' -> -n | _ -> n in
let a = apply_sign a a_sign in
let b = apply_sign b b_sign in
FORMULA (a, b)
FORMULA (apply_sign a a_sign, apply_sign b b_sign)
}
| O N L Y { ONLY }
......
......@@ -29,10 +29,9 @@ let rec specificity =
let precedes (a, b, c, d) (e, f, g, h) =
let rec loop = function
| [] -> true
| 0 :: tl -> loop tl
| n :: _ when n > 0 -> true
| _ -> false
| 0 :: tl -> loop tl
| [] | n :: _ when n > 0 -> true
| _ -> false
in
loop [a - e; b - f; c - g; d - h]
......@@ -64,8 +63,7 @@ let can_match_same selector1 selector2 =
in
let rec intersect l = function
| [] -> false
| hd :: _ when List.mem hd l -> true
| _ :: tl -> intersect l tl
| hd :: tl -> List.mem hd l || intersect l tl
in
let elem1, classes1, ids1, pseudos1, attrs1 = unfold selector1 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