42 lines
1.3 KiB
Ruby
42 lines
1.3 KiB
Ruby
class Re2c < Formula
|
|
desc "Generate C-based recognizers from regular expressions"
|
|
homepage "http://re2c.org"
|
|
url "https://github.com/skvadrik/re2c/releases/download/1.1.1/re2c-1.1.1.tar.gz"
|
|
sha256 "856597337ea00b24ce91f549f79e6eece1b92ba5f8b63292cad66c14ac7451cf"
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
sha256 "51b7b472896a0469a279710ba252ad175ae0879a1a2df5b01af3483d27b2b2ab" => :mojave
|
|
sha256 "acb0d0eebcc5bdc18571a551c9e8bb9bf01a60e0fa97b6ca29773059e9bcceec" => :high_sierra
|
|
sha256 "e1809196ec0d125c664e46404a7aae0ec8a2c778e1e1db7036f75a772d62edee" => :sierra
|
|
sha256 "3c419cef2ce49afffa70662ce865bbde4f58844cf9752ccb1390c10c9e47a2d1" => :el_capitan
|
|
end
|
|
|
|
def install
|
|
system "./configure", "--disable-dependency-tracking",
|
|
"--prefix=#{prefix}"
|
|
system "make", "install"
|
|
end
|
|
|
|
test do
|
|
(testpath/"test.c").write <<~EOS
|
|
unsigned int stou (const char * s)
|
|
{
|
|
# define YYCTYPE char
|
|
const YYCTYPE * YYCURSOR = s;
|
|
unsigned int result = 0;
|
|
|
|
for (;;)
|
|
{
|
|
/*!re2c
|
|
re2c:yyfill:enable = 0;
|
|
|
|
"\x00" { return result; }
|
|
[0-9] { result = result * 10 + c; continue; }
|
|
*/
|
|
}
|
|
}
|
|
EOS
|
|
system bin/"re2c", "-is", testpath/"test.c"
|
|
end
|
|
end
|