-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA.
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
+# AT_EXTRACT_SETS(INPUT, OUTPUT)
+# ------------------------------
+# Extract the information about the grammar sets from a bison
+# trace output (INPUT), and save it in OUTPUT.
+# And remember, there is no alternation in portable sed.
+m4_define([AT_EXTRACT_SETS],
+[AT_DATA([extract.sed],
+[[#n
+/^NULLABLE$/ {
+ :null
+ p
+ n
+ /^[ ]*$/ !b null
+}
+/^FIRSTS$/ {
+ :firsts
+ p
+ n
+ /^[ ]*$/ !b firsts
+}
+/^FDERIVES$/ {
+ :fderiv
+ p
+ n
+ /^[ ]*$/ !b fderiv
+}
+/^DERIVES$/ {
+ :deriv
+ p
+ n
+ /^[ ]*$/ !b deriv
+}
+]])
+AT_CHECK([sed -f extract.sed $1], 0, [stdout])
+AT_CHECK([mv stdout $2])
+])
+
+