From bd5542900c087827df2a12cd08bb7e81aba57344 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Sun, 1 Jul 2007 16:33:44 +0000 Subject: Added c++filt, but in the wrong place, next commit it'll build. --- build.conf | 14 ++++++++----- c++filt/c++filt.l | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+), 5 deletions(-) create mode 100644 c++filt/c++filt.l diff --git a/build.conf b/build.conf index 0b51acd..b31d1d3 100644 --- a/build.conf +++ b/build.conf @@ -1,19 +1,23 @@ # build.conf for build, kind of whacky, eh? -default action: check "build" -"clean" action: clean targets() -"rebuild" action: clean "build", check "build" +default action: check targets() set "CXXFLAGS" += "-ggdb" -set "LDFLAGS" += "-Llibbu++ -lbu++ -ldl" "build": rule "exe", target file, requires "libbu++/libbu++.a", + set "LDFLAGS" += "-Llibbu++ -lbu++ -ldl", set "CXXFLAGS" += "-Ilibbu++/src", + set "FLEXFLAGS" = "--bison-bridge --bison-locations", input filesIn("src") filter regexp(".*\\.(cpp|y|l)$") +"c++filt": + rule "exe", + target file, + input filesIn("c++filt") filter regexp(".*\\.(cpp|y|l)$") + rule "exe": matches regexp("(.*)\\.o$"), aggregate toString(" "), @@ -33,5 +37,5 @@ rule "bison": rule "flex": matches regexp("(.*)\\.l$"), produces "{re:1}.yy.c", - perform command("flex --bison-bridge --bison-locations -o {target} {match}") + perform command("flex {FLEXFLAGS} -o {target} {match}") 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 @@ +%{ +# include + +int nBC = 0; +%} + +%s hasT +%x inWith +%x inT +%option noyywrap nounput batch + +%% + +"operator<<" { ECHO; } +"operator>>" { ECHO; } +"operator". { ECHO; } + +"<<" { ECHO; } +">>" { ECHO; } +" <<" { ECHO; } +" >>" { ECHO; } + +"" { ECHO; } + +\n+ { + BEGIN( INITIAL ); + nBC = false; + ECHO; +} + +" <" { ECHO; } + +"<" { + BEGIN( inT ); + printf("<...>"); + nBC++; +} + +"<" { + nBC++; + +} +[^<>]* { } +">" { + nBC--; + if( nBC == 0 ) + BEGIN( hasT ); +} + +" [with"[^\]]*"]" { } + +%% + +int main() +{ + yyin = stdin; + + yylex(); + + return 0; +} + -- cgit v1.2.3