2018-05-04 11:17:47 -04:00
|
|
|
#!/usr/bin/env php
|
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Given a set of sorted zips, generates a regular expression to match only the
|
|
|
|
* given input
|
|
|
|
*
|
2019-02-07 13:23:09 -05:00
|
|
|
* Copyright (C) 2014-2019 Ryan Specialty Group, LLC.
|
2018-05-04 11:17:47 -04:00
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
* I wanted to write this in Scheme (it's a perfect recursive application), but
|
|
|
|
* I figured that other developers may get annoyed having to find a Scheme impl
|
|
|
|
* that works for them...so...PHP it is...
|
|
|
|
*
|
|
|
|
* THIS SCRIPT EXPECTS THE DATA TO BE SORTED! This can be easily accomplished by
|
|
|
|
* doing the following:
|
|
|
|
* sort -d zipfile | ./zipre
|
|
|
|
*/
|
|
|
|
|
|
|
|
include 'lib/zipre.php';
|
|
|
|
|
|
|
|
// grab input from stdin (must be sorted!)
|
|
|
|
$data = explode( "\n", file_get_contents( 'php://stdin' ) );
|
|
|
|
|
|
|
|
// build and output
|
|
|
|
echo gen_re_quick( $data );
|