Index: trunk/lib/Text/FormBuilder/grammar
===================================================================
--- trunk/lib/Text/FormBuilder/grammar	(revision 25)
+++ trunk/lib/Text/FormBuilder/grammar	(revision 28)
@@ -8,8 +8,6 @@
 	%lists,
 	%patterns,
-	@fields,
 	@group,        # current group
 	%groups,       # stored groups of fields
-	@headings,
 	$type,
 	@options,
@@ -23,5 +21,5 @@
 }
 
-form_spec: (list_def | description_def | group_def | line)(s) 
+form_spec: (list_def | description_def | group_def | line)(s)
     {
 	$return = {
@@ -29,10 +27,8 @@
 	    author   => $author,
 	    description => $description,
-	    lists    => \%lists    || {}, 
-	    patterns => \%patterns || {}, 
-	    headings => \@headings || [],
-	    fields   => \@fields   || [],
-	    lines    => \@lines    || [],
-	    groups   => \%groups   || {},
+	    lists    => \%lists,
+	    patterns => \%patterns,
+	    lines    => \@lines,
+	    groups   => \%groups,
 	}
     }
@@ -71,9 +67,14 @@
 
 title: '!title' /.*/
-    { warn "[Text::Formbuilder] Title redefined at input text line $thisline\n" if defined $title;
-    $title = $item[2] }
+    {
+	warn "[Text::Formbuilder] Title redefined at input text line $thisline\n" if defined $title;
+	$title = $item[2];
+    }
 
 author: '!author' /.*/
-    { $author = $item[2] }
+    {
+	warn "[Text::Formbuilder] Author redefined at input text line $thisline\n" if defined $author;
+	$author = $item[2];
+    }
 
 pattern_def: '!pattern' var_name pattern
@@ -82,14 +83,9 @@
 pattern: /.*/
 
-heading: '!head' /.*/
-    {
-	warn "[Text::FormBuilder] Header before field " . scalar(@fields) . " redefined at input text line $thisline\n" if defined $headings[@fields];
-	$headings[@fields] = $item[2];
-	push @lines, [ 'head', $item[2] ];
-    }
+heading: '!head' /.*/    { push @lines, [ 'head', $item[2] ] }
 
 group_field: '!field' group_name name label(?)
-    { #warn "[$thisline] $item{group_name}\n"; 
-    push @lines, [ 'group', { name => $item{name}, label => $item{'label(?)'}[0], group => $item{group_name} } ];
+    { 
+	push @lines, [ 'group', { name => $item{name}, label => $item{'label(?)'}[0], group => $item{group_name} } ];
     }
 
@@ -115,13 +111,10 @@
 	$$field{size} = $size if defined $size;
 	
-	#warn "[$thisline] field $item{name}; context $context\n";   
+	#warn "[$thisline] field $item{name}; context $context\n";
 	if ($context eq 'group') {
 	    push @group, $field;
 	} else {
-	    push @fields, $field;
 	    push @lines, [ 'field', $field ];
 	}
-	
-	#warn "field $item{name} is required" if $required;
 	
 	$type = undef;
