     defp to_condition([:'<', version | _]) do
       {major, minor, patch, pre} = parse_condition(version)
 
-      {:orelse, {:'<', {{:'$1', :'$2', :'$3'}},
-                       {:const, {major, minor, patch}}},
-                {:andalso, {:'==', {{:'$1', :'$2', :'$3'}},
-                                   {:const, {major, minor, patch}}},
-                {:orelse, {:andalso, {:'/=', {:length, :'$4'}, 0},
-                                     {:'==', length(pre), 0}},
-                          {:andalso, {:'/=', {:length, :'$4'}, 0},
-                          {:orelse, {:'<', {:length, :'$4'}, length(pre)},
-                                    {:andalso, {:'==', {:length, :'$4'}, length(pre)},
-                                               {:'<', :'$4', {:const, pre}}}}}}}}
+      {:orelse, main_condition(:'<', major, minor, patch),
+                {:andalso, main_condition(:'==', major, minor, patch),
+                           pre_condition(:'<', pre)}}
     end
 
     defp to_condition([:'<=', version | _]) do

        {:ok, version} -> version
        :error -> throw :invalid_matchspec
      end
    end

    defp matchable_to_string({major, minor, patch, pre}) do

      (?:\+([\d\w\-]+))?    # build
      $/x

    @spec parse_requirement(String.t) :: {:ok, term} | :error
    def parse_requirement(source) do
      lexed = lexer(source, [])
      to_matchspec(lexed)
