X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/595284e9d0277517bac8f3fc7bcdd529d97aa6f9..HEAD:/examples/extexi diff --git a/examples/extexi b/examples/extexi index 8f27a3ba..f7c443f2 100755 --- a/examples/extexi +++ b/examples/extexi @@ -3,7 +3,7 @@ # This file is part of GNU Bison -# Copyright (C) 1992, 2000-2001, 2005-2006, 2009-2012 Free Software +# Copyright (C) 1992, 2000-2001, 2005-2006, 2009-2015 Free Software # Foundation, Inc. # # This program is free software: you can redistribute it and/or modify @@ -19,7 +19,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Usage: extexi input-file.texi ... -- [FILES to extract] +# Usage: extexi [OPTION...] input-file.texi ... -- [FILES to extract] # Look for @example environments preceded with lines such as: # @@ -35,6 +35,9 @@ use strict; +# Whether we generate synclines. +my $synclines = 0; + # normalize($block) # ----------------- # Remove Texinfo mark up. @@ -102,7 +105,7 @@ sub process ($) { # Bison supports synclines, but not Flex. $input .= sprintf ("#line %s \"$in\"\n", $. + 1) - if $file =~ /\.[chy]*$/; + if $synclines && $file =~ /\.[chy]*$/; next; } elsif (/^\@end (small)?example$/) @@ -136,14 +139,18 @@ my @input; my $seen_dash = 0; for my $arg (@ARGV) { - if ($arg eq '--') + if ($seen_dash) + { + use File::Basename; + $file_wanted{basename($arg)} = $arg; + } + elsif ($arg eq '--') { $seen_dash = 1; } - elsif ($seen_dash) + elsif ($arg eq '--synclines') { - use File::Basename; - $file_wanted{basename($arg)} = $arg; + $synclines = 1; } else {