/[suikacvs]/markup/html/whatpm/Whatpm/WebIDL.pm
Suika

Diff of /markup/html/whatpm/Whatpm/WebIDL.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.5 by wakaba, Sat Jul 19 13:11:30 2008 UTC revision 1.6 by wakaba, Sat Jul 19 13:50:03 2008 UTC
# Line 1209  sub type ($;$) { Line 1209  sub type ($;$) {
1209    return $_[0]->{type};    return $_[0]->{type};
1210  } # type  } # type
1211    
1212    {
1213      my $serialize_type;
1214      my $serialize_type_depth = 0;
1215      $serialize_type = sub ($) {
1216        my $type = shift;
1217        if ($type->[0] eq '::sequence::') {
1218          if ($serialize_type_depth++ == 1024) {
1219            return 'sequence<<<sequence too deep>>>';
1220          } else {
1221            return 'sequence<' . $serialize_type->($type->[1]) . '>';
1222          }
1223        } else {
1224          return join '::', map {
1225            /^::([^:]+)::$/ ? $1 : $_ ## TODO: escape
1226          } @{$type};
1227        }
1228      }; # $serialize_type
1229    
1230  sub type_text ($) {  sub type_text ($) {
1231    my $type = $_[0]->{type};    my $type = $_[0]->{type};
1232    return undef unless defined $type;    return undef unless defined $type;
1233      
1234    if ($type->[0] eq '::sequence::') {    return $serialize_type->($type);
     return 'sequence<' . (join '::', @{$type->[1]}) . '>'; ## TODO: escape, nested  
   } else {  
     return join '::', @$type; ## TODO: escape  
   }  
1235  } # type_text  } # type_text
1236    
1237    }
1238    
1239  package Whatpm::WebIDL::Module;  package Whatpm::WebIDL::Module;
1240  push our @ISA, 'Whatpm::WebIDL::Definition';  push our @ISA, 'Whatpm::WebIDL::Definition';
1241    

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

[email protected]
ViewVC Help
Powered by ViewVC 1.1.24