2012-11-12 01:35:09 +00:00
|
|
|
class Flex < Formula
|
2015-05-19 00:00:59 +00:00
|
|
|
desc "Fast Lexical Analyzer, generates Scanners (tokenizers)"
|
2014-12-29 02:59:18 +00:00
|
|
|
homepage "http://flex.sourceforge.net"
|
2015-12-10 15:49:19 +00:00
|
|
|
url "https://downloads.sourceforge.net/flex/flex-2.6.0.tar.bz2"
|
|
|
|
sha256 "24e611ef5a4703a191012f80c1027dc9d12555183ce0ecd46f3636e587e9b8e9"
|
2012-11-12 01:35:09 +00:00
|
|
|
|
2014-06-09 16:05:56 +00:00
|
|
|
bottle do
|
2015-12-10 17:02:18 +00:00
|
|
|
sha256 "5ff47ed93df4c58a708c88d5638180dc989e17f1ac0ef2caf13bba20d32e646a" => :el_capitan
|
|
|
|
sha256 "a66259c848d0afb9b825b8f3cf9a303c33e815d5ba419a1c5401342d1ff43a9f" => :yosemite
|
|
|
|
sha256 "b2aeeaaa2b4de481c5b4fad5e3250b5e3e878bb7dd321b5234575d2b184a86be" => :mavericks
|
2014-06-09 16:05:56 +00:00
|
|
|
end
|
|
|
|
|
2014-12-29 02:59:18 +00:00
|
|
|
keg_only :provided_by_osx, "Some formulae require a newer version of flex."
|
2012-11-12 01:35:09 +00:00
|
|
|
|
2014-12-29 02:59:18 +00:00
|
|
|
depends_on "gettext"
|
2012-11-12 01:35:09 +00:00
|
|
|
|
|
|
|
def install
|
|
|
|
system "./configure", "--disable-dependency-tracking",
|
2015-01-04 09:16:53 +00:00
|
|
|
"--disable-shared",
|
2012-11-12 01:35:09 +00:00
|
|
|
"--prefix=#{prefix}"
|
2014-12-29 02:59:18 +00:00
|
|
|
system "make", "install"
|
2012-11-12 01:35:09 +00:00
|
|
|
end
|
2014-12-29 03:11:41 +00:00
|
|
|
|
|
|
|
test do
|
|
|
|
(testpath/"test.flex").write <<-EOS.undent
|
|
|
|
CHAR [a-z][A-Z]
|
|
|
|
%%
|
|
|
|
{CHAR}+ printf("%s", yytext);
|
|
|
|
[ \\t\\n]+ printf("\\n");
|
|
|
|
%%
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
yyin = stdin;
|
|
|
|
yylex();
|
|
|
|
}
|
|
|
|
EOS
|
|
|
|
system "#{bin}/flex", "test.flex"
|
|
|
|
system ENV.cc, "lex.yy.c", "-L#{lib}", "-lfl", "-o", "test"
|
|
|
|
assert_equal shell_output("echo \"Hello World\" | ./test"), <<-EOS.undent
|
|
|
|
Hello
|
|
|
|
World
|
|
|
|
EOS
|
|
|
|
end
|
2012-11-12 01:35:09 +00:00
|
|
|
end
|