2013-02-02 22:58:25 +00:00
|
|
|
class Bison < Formula
|
2015-05-19 00:00:59 +00:00
|
|
|
desc "Parser generator"
|
2015-01-15 13:11:18 +00:00
|
|
|
homepage "https://www.gnu.org/software/bison/"
|
2015-06-14 19:17:33 +00:00
|
|
|
url "http://ftpmirror.gnu.org/bison/bison-3.0.4.tar.gz"
|
2015-01-24 13:56:22 +00:00
|
|
|
mirror "https://ftp.gnu.org/gnu/bison/bison-3.0.4.tar.gz"
|
2015-08-03 12:55:31 +00:00
|
|
|
sha256 "b67fd2daae7a64b5ba862c66c07c1addb9e6b1b05c5f2049392cfd8a2172952e"
|
2013-02-02 22:58:25 +00:00
|
|
|
|
2014-06-09 16:05:56 +00:00
|
|
|
bottle do
|
2015-09-11 13:57:47 +00:00
|
|
|
sha256 "17488b69156f6fc91dd438c54920751399c23745f330487abd54c4cbcb49ff6a" => :el_capitan
|
2015-11-19 15:45:31 +00:00
|
|
|
sha256 "0a6b72564c1602a033d814b68939bf2732f21cfdc06196c29da19c79faba669f" => :yosemite
|
|
|
|
sha256 "a3146ea90c2e4ee5d5626154b3446c7c5aea748b9239beac6ac2c26e753c830e" => :mavericks
|
|
|
|
sha256 "1ac1b43ae92fea5b04f663197309ce8b788061d31f09ba14e97dd4d5d1183d62" => :mountain_lion
|
2014-06-09 16:05:56 +00:00
|
|
|
end
|
|
|
|
|
2014-12-29 03:47:33 +00:00
|
|
|
keg_only :provided_by_osx, "Some formulae require a newer version of bison."
|
2013-02-02 22:58:25 +00:00
|
|
|
|
|
|
|
def install
|
|
|
|
system "./configure", "--disable-dependency-tracking",
|
|
|
|
"--prefix=#{prefix}"
|
2013-07-25 21:29:08 +00:00
|
|
|
system "make", "install"
|
2013-02-02 22:58:25 +00:00
|
|
|
end
|
2014-12-29 04:15:49 +00:00
|
|
|
|
|
|
|
test do
|
|
|
|
(testpath/"test.y").write <<-EOS.undent
|
|
|
|
%{ #include <iostream>
|
|
|
|
using namespace std;
|
|
|
|
extern void yyerror (char *s);
|
|
|
|
extern int yylex ();
|
|
|
|
%}
|
|
|
|
%start prog
|
|
|
|
%%
|
|
|
|
prog: // empty
|
|
|
|
| prog expr '\\n' { cout << "pass"; exit(0); }
|
|
|
|
;
|
|
|
|
expr: '(' ')'
|
|
|
|
| '(' expr ')'
|
|
|
|
| expr expr
|
|
|
|
;
|
|
|
|
%%
|
|
|
|
char c;
|
|
|
|
void yyerror (char *s) { cout << "fail"; exit(0); }
|
|
|
|
int yylex () { cin.get(c); return c; }
|
|
|
|
int main() { yyparse(); }
|
|
|
|
EOS
|
|
|
|
system "#{bin}/bison", "test.y"
|
|
|
|
system ENV.cxx, "test.tab.c", "-o", "test"
|
|
|
|
assert_equal "pass", shell_output("echo \"((()(())))()\" | ./test")
|
|
|
|
assert_equal "fail", shell_output("echo \"())\" | ./test")
|
|
|
|
end
|
2013-02-02 22:58:25 +00:00
|
|
|
end
|