aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build.conf14
-rw-r--r--c++filt/c++filt.l62
2 files changed, 71 insertions, 5 deletions
diff --git a/build.conf b/build.conf
index 0b51acd..b31d1d3 100644
--- a/build.conf
+++ b/build.conf
@@ -1,19 +1,23 @@
1# build.conf for build, kind of whacky, eh? 1# build.conf for build, kind of whacky, eh?
2 2
3default action: check "build" 3default action: check targets()
4"clean" action: clean targets()
5"rebuild" action: clean "build", check "build"
6 4
7set "CXXFLAGS" += "-ggdb" 5set "CXXFLAGS" += "-ggdb"
8set "LDFLAGS" += "-Llibbu++ -lbu++ -ldl"
9 6
10"build": 7"build":
11 rule "exe", 8 rule "exe",
12 target file, 9 target file,
13 requires "libbu++/libbu++.a", 10 requires "libbu++/libbu++.a",
11 set "LDFLAGS" += "-Llibbu++ -lbu++ -ldl",
14 set "CXXFLAGS" += "-Ilibbu++/src", 12 set "CXXFLAGS" += "-Ilibbu++/src",
13 set "FLEXFLAGS" = "--bison-bridge --bison-locations",
15 input filesIn("src") filter regexp(".*\\.(cpp|y|l)$") 14 input filesIn("src") filter regexp(".*\\.(cpp|y|l)$")
16 15
16"c++filt":
17 rule "exe",
18 target file,
19 input filesIn("c++filt") filter regexp(".*\\.(cpp|y|l)$")
20
17rule "exe": 21rule "exe":
18 matches regexp("(.*)\\.o$"), 22 matches regexp("(.*)\\.o$"),
19 aggregate toString(" "), 23 aggregate toString(" "),
@@ -33,5 +37,5 @@ rule "bison":
33rule "flex": 37rule "flex":
34 matches regexp("(.*)\\.l$"), 38 matches regexp("(.*)\\.l$"),
35 produces "{re:1}.yy.c", 39 produces "{re:1}.yy.c",
36 perform command("flex --bison-bridge --bison-locations -o {target} {match}") 40 perform command("flex {FLEXFLAGS} -o {target} {match}")
37 41
diff --git a/c++filt/c++filt.l b/c++filt/c++filt.l
new file mode 100644
index 0000000..af12cac
--- /dev/null
+++ b/c++filt/c++filt.l
@@ -0,0 +1,62 @@
1%{
2# include <string>
3
4int nBC = 0;
5%}
6
7%s hasT
8%x inWith
9%x inT
10%option noyywrap nounput batch
11
12%%
13
14"operator<<" { ECHO; }
15"operator>>" { ECHO; }
16"operator". { ECHO; }
17
18"<<" { ECHO; }
19">>" { ECHO; }
20" <<" { ECHO; }
21" >>" { ECHO; }
22
23"<anonymous>" { ECHO; }
24
25\n+ {
26 BEGIN( INITIAL );
27 nBC = false;
28 ECHO;
29}
30
31" <" { ECHO; }
32
33"<" {
34 BEGIN( inT );
35 printf("<...>");
36 nBC++;
37}
38
39<inT>"<" {
40 nBC++;
41
42}
43<inT>[^<>]* { }
44<inT>">" {
45 nBC--;
46 if( nBC == 0 )
47 BEGIN( hasT );
48}
49
50<hasT>" [with"[^\]]*"]" { }
51
52%%
53
54int main()
55{
56 yyin = stdin;
57
58 yylex();
59
60 return 0;
61}
62