Index: trunk/PS-IPP-Metadata-Config/lib/PS/IPP/Metadata/Config.pm
===================================================================
--- trunk/PS-IPP-Metadata-Config/lib/PS/IPP/Metadata/Config.pm	(revision 3454)
+++ trunk/PS-IPP-Metadata-Config/lib/PS/IPP/Metadata/Config.pm	(revision 3456)
@@ -1,5 +1,5 @@
 # Copyright (c) 2005  Joshua Hoblitt
 #
-# $Id: Config.pm,v 1.6 2005-03-18 23:38:05 jhoblitt Exp $
+# $Id: Config.pm,v 1.7 2005-03-19 00:45:37 jhoblitt Exp $
 
 package PS::IPP::Metadata::Config;
@@ -155,4 +155,11 @@
 
 __DATA__
+
+{
+    use strict;
+    use warnings FATAL => qw( all );
+
+    use Carp qw( croak );
+}
 
 startrule: grammar
@@ -234,42 +241,55 @@
         {{
             class   => 'blank_line',
-            comment => $item{comment},
         }}
 
 typedef_declare:
-    <skip:'[ \t\r]*'> 'TYPE' <commit> name name(s) "\n"
+    <skip:'[ \t\r]*'> 'TYPE' <commit> name name(s) comment(?) "\n"
         {
             use Carp;
 
-            my $len = scalar @{ $item{'name(s)'} };
-
             if (defined $thisparser->{local}{typedef}{ $item{name} }) {
                 croak "refinition of TYPE $item{name}";    
             }
 
-            $thisparser->{local}{typedef}{ $item{name} } = $len;
-
-            $return = {
+            my $type = {
                 class   => 'typedef_declare',
                 name    => $item{name},
-                value   => $item{'name(s)'},
+                fields  => $item{'name(s)'},
+                length  => scalar @{ $item{'name(s)'} },
             };
-        }
-    | <skip:'[ \t\r]*'> 'TYPE' <commit> name name(s) comment "\n"
-        {{
-            class   => 'typedef_declare',
-            name    => $item{name},
-            value   => $item{'name(s)'},
-            comment => $item{comment},
-        }}
+
+            $thisparser->{local}{typedef}{ $item{name} } = $type;
+
+            # don't return anything in the parse tree
+            $return = { class => 'blank_line' };
+        }
 
 typedef:
-    <skip:'[ \t\r]*'> name typedef_type name(s) "\n"
+    <skip:'[ \t\r]*'> name typedef_type name(s) comment(?) "\n"
         {
+            my $type = $thisparser->{local}{typedef}{ $item{typedef_type} };
+
+            unless ( scalar @{ $item{'name(s)'} } == $type->{length} ) {
+                croak "\"$item{name} $item{typedef_type}\""
+                    . " does not have enough fields";
+            }
+
+            my @md;
+            my $i = 0;
+            foreach my $name ( @{ $type->{fields} } ) {
+                push @md, {
+                    name    => $name,
+                    class   => 'scalar',
+                    type    => 'STR',
+                    value   => $item{'name(s)'}[$i],
+                };
+
+                $i++;
+            }
+
             $return = {
-                class   => 'typedef',
+                class   => 'metadata',
                 name    => $item{name},
-                type    => $item{typedef_type},
-                value   => $item{'name(s)'},
+                value   => \@md,
             };
         }
