Skip to content

Commit e9b0b5c

Browse files
committed
bison: update 3.8.2 bottle.
1 parent ae8a409 commit e9b0b5c

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

Formula/b/bison.rb

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
class Bison < Formula
2+
desc "Parser generator"
3+
homepage "https://www.gnu.org/software/bison/"
4+
# X.Y.9Z are beta releases that sometimes get accidentally uploaded to the release FTP
5+
url "https://ftp.gnu.org/gnu/bison/bison-3.8.2.tar.xz"
6+
mirror "https://ftpmirror.gnu.org/bison/bison-3.8.2.tar.xz"
7+
sha256 "9bba0214ccf7f1079c5d59210045227bcf619519840ebfa80cd3849cff5a5bf2"
8+
license "GPL-3.0-or-later"
9+
version_scheme 1
10+
11+
bottle do
12+
root_url "https://github.com/gromgit/homebrew-core-aarch64_linux/releases/download/bison-3.8.2"
13+
sha256 cellar: :any_skip_relocation, aarch64_linux: "2a0732c30f659e4581b2c6eefc5a2a0acf5596302f6be2982a8517a9b3863e22"
14+
end
15+
16+
keg_only :provided_by_macos
17+
18+
uses_from_macos "m4"
19+
20+
def install
21+
system "./configure", "--disable-dependency-tracking",
22+
"--enable-relocatable",
23+
"--prefix=/output",
24+
"M4=m4"
25+
system "make", "install", "DESTDIR=#{buildpath}"
26+
prefix.install Dir["#{buildpath}/output/*"]
27+
end
28+
29+
test do
30+
(testpath/"test.y").write <<~EOS
31+
%{ #include <iostream>
32+
using namespace std;
33+
extern void yyerror (char *s);
34+
extern int yylex ();
35+
%}
36+
%start prog
37+
%%
38+
prog: // empty
39+
| prog expr '\\n' { cout << "pass"; exit(0); }
40+
;
41+
expr: '(' ')'
42+
| '(' expr ')'
43+
| expr expr
44+
;
45+
%%
46+
char c;
47+
void yyerror (char *s) { cout << "fail"; exit(0); }
48+
int yylex () { cin.get(c); return c; }
49+
int main() { yyparse(); }
50+
EOS
51+
system bin/"bison", "test.y"
52+
system ENV.cxx, "test.tab.c", "-o", "test"
53+
assert_equal "pass", shell_output("echo \"((()(())))()\" | ./test")
54+
assert_equal "fail", shell_output("echo \"())\" | ./test")
55+
end
56+
end

0 commit comments

Comments
 (0)