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 |
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; |
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 |
} |
} |
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); |