#!/bin/sh
# $Id: collect-grammar.sh,v 1.4 2005/03/13 02:37:52 leavens Exp $

sed -e '1,/^@chapter Notation for Type Expressions/d' $* |
 sed -n -e '
	:begin
	/^\@chapter/p 
	/^\@iftex/p 
	/^\@end iftex/p 
	/^\@ifinfo/p 
	/^\@end ifinfo/p 
	/^ *\@var.*::=/p 
	/^  *| /p 
	/^               *\@/p' |
 awk 'BEGIN {print "@appendixsec Notation for Type Expressions\n@display\n"}
      {if ($1 == "@chapter") {
           $1 = "@appendixsec";
	   print "@end display\n";
	   print;
	   print "@display\n"; 
       }
       else
	   print 
      }
      END {print "@end display\n"}
     ' | sed -e '/^\@appendixsec Type Checker Commands and Options/,$d;'
