38 lines
1.3 KiB
PHP
Executable File
38 lines
1.3 KiB
PHP
Executable File
#!/usr/bin/env php
|
|
<?php
|
|
/**
|
|
* Given a set of sorted zips, generates a regular expression to match only the
|
|
* given input
|
|
*
|
|
* Copyright (C) 2014-2023 Ryan Specialty, LLC.
|
|
*
|
|
* 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 );
|