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-01-04 09:16:53 +00:00
|
|
|
url "https://downloads.sourceforge.net/flex/flex-2.5.39.tar.bz2"
|
2015-08-03 12:55:31 +00:00
|
|
|
sha256 "add2b55f3bc38cb512b48fad7d72f43b11ef244487ff25fc00aabec1e32b617f"
|
2012-11-12 01:35:09 +00:00
|
|
|
|
2014-06-09 16:05:56 +00:00
|
|
|
bottle do
|
2015-09-22 11:50:25 +00:00
|
|
|
sha256 "31607eeace06e7460d03b2a0bfb9b13f3ca5b0407eb3e80d75d3b4f1ec43ba0f" => :el_capitan
|
2015-01-08 14:09:14 +00:00
|
|
|
sha1 "a1f8a76465942c6187b00dfa931ac56f22b7ba00" => :yosemite
|
|
|
|
sha1 "533d4351154274d9d68f517b85e1de8e524b2bd5" => :mavericks
|
|
|
|
sha1 "524d471123dbd4ca812e3fc3778afd865df616e6" => :mountain_lion
|
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
|