bug-automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ylwrap proposition


From: Sergey Poznyakoff
Subject: ylwrap proposition
Date: Fri, 22 Jun 2007 14:15:32 +0300

Hello,

Some (rather long) time ago, I proposed an extension to ylwrap that
would enable it to provide a functionality similar to that
of `bison -p prefix', i.e. replacing `yy' prefix in idenifiers with
the given string. (The original proposition is available here:
http://lists.gnu.org/archive/html/bug-automake/2001-06/msg00021.html)

Tom seemed to agree with this. However, the patch never made it to the
distribution. So, here is the similar patch, this time against the
CVS automake.

Regards,
Sergey

Index: lib/ylwrap
--- automake/lib/ylwrap 2007-06-22 11:57:46.000000000 +0300
+++ automake.orig/lib/ylwrap    2007-06-22 13:05:20.000000000 +0300
@@ -41,9 +41,13 @@ case "$1" in
     basedir=$2
     shift 2
     ;;
+  --p|--pr|--pre|--pref|--prefi|--prefix)
+    YYREPL="s/yy/$2/g"
+    shift 2
+    ;;
   -h|--h*)
     cat <<\EOF
-Usage: ylwrap [--help|--version] INPUT [OUTPUT DESIRED]... -- PROGRAM [ARGS]...
+Usage: ylwrap [OPTIONS] INPUT [OUTPUT DESIRED]... -- PROGRAM [ARGS]...
 
 Wrapper for lex/yacc invocations, renaming files as desired.
 
@@ -55,6 +59,11 @@ Wrapper for lex/yacc invocations, renami
 
 Any number of OUTPUT,DESIRED pairs may be used.
 
+OPTIONS are
+  -p, --prefix PREFIX    Replace `yy' in identifiers with PREFIX
+  --help                 Display this help message and exit
+  --version              Display program version and exit
+
 Report bugs to <address@hidden>.
 EOF
     exit $?
@@ -177,7 +186,8 @@ if test $ret -eq 0; then
             -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'\
             -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'`
 
-      sed -e "/^#/!b" -e "s,$input_rx,," -e "s,$from,$2," \
+      sed -e "$YYREPL"  \
+          -e "/^#/!b" -e "s,$input_rx,," -e "s,$from,$2," \
           -e "s,$FROM,$TARGET," "$from" >"$target" || ret=$?
 
       # Check whether header files must be updated.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]