/[suikacvs]/markup/html/whatpm/Whatpm/CSS/MediaQueryParser.pm
Suika

Diff of /markup/html/whatpm/Whatpm/CSS/MediaQueryParser.pm

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

revision 1.1 by wakaba, Fri Feb 8 13:37:58 2008 UTC revision 1.2 by wakaba, Sat Aug 16 07:35:23 2008 UTC
# Line 5  our $VERSION=do{my @r=(q$Revision$=~/\d+ Line 5  our $VERSION=do{my @r=(q$Revision$=~/\d+
5  use Whatpm::CSS::Tokenizer qw(:token);  use Whatpm::CSS::Tokenizer qw(:token);
6    
7  sub new ($) {  sub new ($) {
8    my $self = bless {onerror => sub { },    my $self = bless {
9                      must_level => 'm', unsupported_level => 'u'}, shift;      onerror => sub { },
10        level => {
11          must => 'm',
12          uncertain => 'u',
13        },
14      }, shift;
15    #$self->{href} = \(uri in which the MQ appears);    #$self->{href} = \(uri in which the MQ appears);
16    return $self;    return $self;
17  } # new  } # new
# Line 40  sub parse_char_string ($$) { Line 45  sub parse_char_string ($$) {
45    
46    if ($t->{type} != EOF_TOKEN) {    if ($t->{type} != EOF_TOKEN) {
47      $self->{onerror}->(type => 'mq syntax error',      $self->{onerror}->(type => 'mq syntax error',
48                         level => $self->{must_level},                         level => $self->{level}->{must},
49                         uri => \$self->{href},                         uri => \$self->{href},
50                         token => $t);                         token => $t);
51      return undef;      return undef;
# Line 74  sub _parse_mq_with_tokenizer ($$$) { Line 79  sub _parse_mq_with_tokenizer ($$$) {
79        } else {        } else {
80          push @$r, [['#type', 'unknown']];          push @$r, [['#type', 'unknown']];
81          $self->{onerror}->(type => 'unknown media type',          $self->{onerror}->(type => 'unknown media type',
82                             level => $self->{unsupported_level},                             level => $self->{level}->{uncertain},
83                             uri => \$self->{href},                             uri => \$self->{href},
84                             token => $t);                             token => $t);
85        }        }
# Line 82  sub _parse_mq_with_tokenizer ($$$) { Line 87  sub _parse_mq_with_tokenizer ($$$) {
87      } elsif ($t->{type} == NUMBER_TOKEN or $t->{type} == DIMENSION_TOKEN) {      } elsif ($t->{type} == NUMBER_TOKEN or $t->{type} == DIMENSION_TOKEN) {
88        push @$r, [['#type', 'unknown']];        push @$r, [['#type', 'unknown']];
89        $self->{onerror}->(type => 'unknown media type',        $self->{onerror}->(type => 'unknown media type',
90                           level => $self->{unsupported_level},                           level => $self->{level}->{uncertain},
91                           uri => \$self->{href},                           uri => \$self->{href},
92                           token => $t);                           token => $t);
93        $t = $tt->get_next_token;        $t = $tt->get_next_token;
94      } else {      } else {
95        $self->{onerror}->(type => 'mq syntax error',        $self->{onerror}->(type => 'mq syntax error',
96                           level => $self->{must_level},                           level => $self->{level}->{must},
97                           uri => \$self->{href},                           uri => \$self->{href},
98                           token => $t);                               token => $t);    
99        return ($t, undef);        return ($t, undef);

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24