|
From: Robin B. <da...@us...> - 2001-08-17 19:30:06
|
Update of /cvsroot/perl-css/CSS-SAC
In directory usw-pr-cvs1:/tmp/cvs-serv8575
Modified Files:
SAC.pm Changes
Log Message:
misc. fixes for Bjoern-reported bugs
Index: SAC.pm
===================================================================
RCS file: /cvsroot/perl-css/CSS-SAC/SAC.pm,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- SAC.pm 2001/08/17 18:14:22 1.4
+++ SAC.pm 2001/08/17 19:30:03 1.5
@@ -48,7 +48,7 @@
# matches a valid CSS ident (this may be wrong, needs testing)
my $RE_IDENT = qr/
(?:(?:\\(?:(?:[a-fA-F0-9]{1,6}[\t\x20])|[ \x32-\xff]))|[a-zA-Z\x80-\xff])
- (?:(?:\\(?:(?:[a-fA-F0-9]{1,6}[\t\x20])|[ \x32-\xff]))|[a-zA-Z\x80-\xff0-9-])*
+ (?:(?:\\(?:(?:[a-fA-F0-9]{1,6}[\t\x20])|[ \x32-\xff]))|[a-zA-Z\x80-\xff0-9_-])*
/xs;
# matches a unicode range
@@ -452,7 +452,8 @@
# error
else {
- $sac->[_eh_]->fatal_error('Unknown trailing tokens in style sheet');
+ last if ! length $css;
+ $sac->[_eh_]->fatal_error('Unknown trailing tokens in style sheet: "' . $css . '"');
last;
}
}
@@ -670,7 +671,14 @@
while (1) {
# we've reached the rule, or there isn't anything left to parse
- if ($$css =~ m/^\s*\{/ or !length $$css) {
+ if ($$css =~ m/^\s*\{/) {
+ if (!@sels) {
+ @sels = ($sac->[_sf_]->create_element_selector(undef,undef));
+ }
+ last;
+ }
+
+ elsif (!length $$css) {
last;
}
@@ -697,6 +705,7 @@
}
}
+ return unless @sels; # this returns nothing, there were no selectors (needed for parse)
return CSS::SAC::SelectorList->new(\@sels);
}
#---------------------------------------------------------------------#
@@ -719,6 +728,7 @@
my ($attr,$func,$args);
while (1) {
+
$sac->parse_comments($css);
# end of selector
@@ -970,7 +980,6 @@
}
}
-
### process the tokens list
# if the first token isn't an element selector then create a *|* one
@@ -1019,8 +1028,14 @@
my $new_selector = shift @tokens;
eval { $new_selector->SelectorType };
if ($@) {
- # this is a serious exception
- $sac->[_eh_]->fatal_error('Really weird input in simple selector');
+ if (ref $new_selector) {
+ unshift @tokens, $new_selector;
+ $new_selector = $sac->[_sf_]->create_element_selector(undef,undef);
+ }
+ else {
+ # this is a serious exception (we don't know what's here)
+ $sac->[_eh_]->fatal_error('Really weird input in simple selector: "' . $$css . '"');
+ }
}
# create a conditional selector with all conditions
@@ -1123,7 +1138,7 @@
$$css =~ s/^\s*//;
while (length $$css) {
# the property
- $$css =~ s/^($RE_IDENT)\s*//;
+ $$css =~ s/^(-?$RE_IDENT)\s*//; # includes the - prefix
my $prop = $1;
$sac->parse_comments($css);
@@ -1134,14 +1149,12 @@
# the value
my $lu = $sac->parse_property_value($css);
if (!@$lu) {
-#print "pvcss: $$css\n";
-# $$css =~ s/^.*?;?\s*//;
-# $sac->[_eh_]->warning('Unknown token in property value');
- if ($$css =~ s/[^;]*;//) {
+ last unless length $$css;
+ if ($$css =~ s/[^;}]*(?:;|\})?//) { # this is a bit dodgy...
$sac->[_eh_]->warning('Unknown token in style declaration');
}
else {
- $sac->[_eh_]->fatal_error('Unknown token in style declaration');
+ $sac->[_eh_]->fatal_error('Unknown token in style declaration: "' . $$css . '"');
}
next;
}
@@ -1183,6 +1196,8 @@
while (1) {
my ($type,$text,$value);
+ $sac->parse_comments($css);
+
# exit conditions
if (! length($$css) or $$css =~ m/^\s*(?:;|!)/) {
last;
@@ -1706,9 +1721,11 @@
- add docs on how to write a {Document,Error}Handler, right now there
is example code in Writer, but it isn't all clearly explained.
- - add an iterator that tracks loops and exits them with an error
- whenever it reaches a certain (configurable) count. We need to
- reliably jump out of infinite loops whenever it is needed.
+ - find a way to make the '-' prefix to properties optional
+
+ - switch to spec names (?)
+
+ - update docs
=head1 AUTHOR
Index: Changes
===================================================================
RCS file: /cvsroot/perl-css/CSS-SAC/Changes,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- Changes 2001/08/17 17:50:15 1.2
+++ Changes 2001/08/17 19:30:03 1.3
@@ -10,6 +10,10 @@
Goeldner)
- HTML end comments didn't work properly (Steffen Goeldner)
- @import looked for uri instead of url (Steffen Goeldner)
+ - added the possibility to parse properties that start with a '-'.
+ I don't think that's too spec clean, but a lot of people seem to want
+ those as extensions in various browsers (suggested by BH).
+ - added _ to the IDENT characters (it's in CSS2 Errata)
0.03 Mon Apr 23 16:44:16 2001
|