Update of /cvsroot/perl-css/CSS-SAC/lib/CSS/SAC
In directory usw-pr-cvs1:/tmp/cvs-serv20716/lib/CSS/SAC
Modified Files:
Condition.pm ConditionFactory.pm LexicalUnit.pm Selector.pm
SelectorFactory.pm SelectorList.pm TestWriter.pm Writer.pm
Log Message:
stupid dos endings, samba really sucks when it wants to
Index: Condition.pm
===================================================================
RCS file: /cvsroot/perl-css/CSS-SAC/lib/CSS/SAC/Condition.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- Condition.pm 2001/08/17 17:50:15 1.2
+++ Condition.pm 2001/08/17 18:00:01 1.3
@@ -1,275 +1,275 @@
-
-###
-# CSS::SAC::Condition - base class for SAC conditions
-# Robin Berjon <ro...@kn...>
-# 24/02/2001
-###
-
-package CSS::SAC::Condition;
-use strict;
-use vars qw($VERSION);
-$VERSION = $CSS::SAC::VERSION || '0.03';
-
-#---------------------------------------------------------------------#
-# build the fields for an array based object
-#---------------------------------------------------------------------#
-use Class::ArrayObjects define => {
- fields => [qw(_type_)],
- };
-#---------------------------------------------------------------------#
-
-
-### Constants #########################################################
-# #
-# #
-
-sub UNKNOWN_CONDITION () { 1 }
-sub AND_CONDITION () { 2 }
-sub ATTRIBUTE_CONDITION () { 3 }
-sub BEGIN_HYPHEN_ATTRIBUTE_CONDITION () { 4 }
-sub CLASS_CONDITION () { 5 }
-sub CONTENT_CONDITION () { 6 }
-sub ID_CONDITION () { 7 }
-sub LANG_CONDITION () { 8 }
-sub NEGATIVE_CONDITION () { 9 }
-sub ONE_OF_ATTRIBUTE_CONDITION () { 10 }
-sub ONLY_CHILD_CONDITION () { 11 }
-sub ONLY_TYPE_CONDITION () { 12 }
-sub OR_CONDITION () { 13 }
-sub POSITIONAL_CONDITION () { 14 }
-sub PSEUDO_CLASS_CONDITION () { 15 }
-
-# new non-standard conditions for CSS3 selectors
-sub STARTS_WITH_ATTRIBUTE_CONDITION () { 16 } # [attr^='string']
-sub ENDS_WITH_ATTRIBUTE_CONDITION () { 17 } # [attr$='string']
-sub CONTAINS_ATTRIBUTE_CONDITION () { 18 } # [attr*='string']
-sub IS_ROOT_CONDITION () { 19 } # :root
-sub IS_EMPTY_CONDITION () { 20 } # :empty
-
-#---------------------------------------------------------------------#
-# import()
-# all import can do is export the constants
-#---------------------------------------------------------------------#
-sub import {
- my $class = shift;
- my $tag = shift || '';
-
- # check that we have the right tag
- return unless $tag eq ':constants';
-
- # define some useful vars
- my $pkg = caller;
- my @constants = qw(
- UNKNOWN_CONDITION
- AND_CONDITION
- ATTRIBUTE_CONDITION
- BEGIN_HYPHEN_ATTRIBUTE_CONDITION
- CLASS_CONDITION
- CONTENT_CONDITION
- ID_CONDITION
- LANG_CONDITION
- NEGATIVE_CONDITION
- ONE_OF_ATTRIBUTE_CONDITION
- ONLY_CHILD_CONDITION
- ONLY_TYPE_CONDITION
- OR_CONDITION
- POSITIONAL_CONDITION
- PSEUDO_CLASS_CONDITION
-
- STARTS_WITH_ATTRIBUTE_CONDITION
- ENDS_WITH_ATTRIBUTE_CONDITION
- CONTAINS_ATTRIBUTE_CONDITION
- IS_ROOT_CONDITION
- IS_EMPTY_CONDITION
- );
-
- # now lets create the constants in the caller's package
- no strict 'refs';
- for my $c (@constants) {
- my $qname = "${pkg}::$c";
- *$qname = \&{$c};
- }
-}
-#---------------------------------------------------------------------#
-
-
-# #
-# #
-### Constants #########################################################
-
-
-### Constructor #######################################################
-# #
-# #
-
-
-#---------------------------------------------------------------------#
-# CSS::SAC::Condition->new($type)
-# creates a new sac condition object
-#---------------------------------------------------------------------#
-sub new {
- my $class = ref($_[0])?ref(shift):shift;
- my $type = shift;
- return bless [$type], $class;
-}
-#---------------------------------------------------------------------#
-
-
-# #
-# #
-### Constructor #######################################################
-
-
-
-### Accessors #########################################################
-# #
-# #
-
-
-#---------------------------------------------------------------------#
-# my $type = $cond->ConditionType()
-# $cond->ConditionType($type)
-# get/set the condition type
-#---------------------------------------------------------------------#
-sub ConditionType {
- (@_==2) ? $_[0]->[_type_] = $_[1] :
- $_[0]->[_type_];
-}
-#---------------------------------------------------------------------#
-*CSS::SAC::Condition::getConditionType = \&ConditionType;
-
-
-#---------------------------------------------------------------------#
-# $cond->is_type($condition_constant)
-# returns true is this condition is of type $condition_constant
-#---------------------------------------------------------------------#
-sub is_type {
- return $_[0]->[_type_] == $_[1];
-}
-#---------------------------------------------------------------------#
-
-
-# #
-# #
-### Accessors #########################################################
-
-
-
-1;
-
-=pod
-
-=head1 NAME
-
-CSS::SAC::Condition - base class for SAC conditions
-
-=head1 SYNOPSIS
-
- use CSS::SAC::Condition qw(:constants);
- foo if $cond->is_type(CONDITION_TYPE_CONSTANT);
-
-=head1 DESCRIPTION
-
-SAC Conditions describe conditions that can be expressed in CSS such
-as AttributeConditions or PositionalConditions. This class provides
-everything that is needed to implement simple conditions (methods,
-constants) as well as what is needed by subclasses defining more
-complex conditions.
-
-The constants are those defined in the SAC spec, with the leading SAC_
-removed. What the constants map to is to be considered an opaque token
-that can be tested for equality. If there is demand for it, I will add
-a way to add new constants (for people wishing to define new condition
-types).
-
-I have also added the UNKNOWN_CONDITION constant. It shouldn't occur
-in normal processing but it's always useful to have such fallback
-values.
-
-The Condition interface adds $cond->is_type($condition_type) to the
-interface defined in the SAC spec. This allows for more flexible type
-checking. For instance, if you create a subclass of ContentCondition
-that extends it with the ContentRegexCondition interface you will
-probably want software ignorant of your subclass's existence to still
-be able to do something useful with it. That software should also be
-able to treat ContentRegexConditions as if they were
-ContentConditions.
-
-If that software tests condition types the following way:
-
- $rcond->ConditionType == CONTENT_CONDITION
-
-then you've lost because the condition type of ContentRegexCondition
-is REGEX_CONTENT_CONDITION. If, however, it tests it that way:
-
- $rcond->is_type(CONTENT_CONDITION)
-
-then you can simply implement is_type() so that it returns true for
-it's own type and the type of it's superclass. I strongly recommend
-using the latter scheme except in cases when you want to know the
-exact type.
-
-=head1 CONSTANTS
-
-=over 4
-
-=item * UNKNOWN_CONDITION
-
-=item * AND_CONDITION
-
-=item * ATTRIBUTE_CONDITION
-
-=item * BEGIN_HYPHEN_ATTRIBUTE_CONDITION
-
-=item * CLASS_CONDITION
-
-=item * CONTENT_CONDITION
-
-=item * ID_CONDITION
-
-=item * LANG_CONDITION
-
-=item * NEGATIVE_CONDITION
-
-=item * ONE_OF_ATTRIBUTE_CONDITION
-
-=item * ONLY_CHILD_CONDITION
-
-=item * ONLY_TYPE_CONDITION
-
-=item * OR_CONDITION
-
-=item * POSITIONAL_CONDITION
-
-=item * PSEUDO_CLASS_CONDITION
-
-=back
-
-=head1 METHODS
-
-=over 4
-
-=item * CSS::SAC::Condition->new($type) or $cond->new($type)
-
-Creates a new condition. The $type must be one of the type constants.
-
-=item * $cond->ConditionType()
-
-Returns the constant corresponding to the type of this condition.
-
-=item * $cond->is_type($condition_type)
-
-Returns a boolean indicating whether this condition is of type
-$condition_type (a condition constant).
-
-=back
-
-=head1 AUTHOR
-
-Robin Berjon <ro...@kn...>
-
-This module is licensed under the same terms as Perl itself.
-
-=cut
-
-
+
+###
+# CSS::SAC::Condition - base class for SAC conditions
+# Robin Berjon <ro...@kn...>
+# 24/02/2001
+###
+
+package CSS::SAC::Condition;
+use strict;
+use vars qw($VERSION);
+$VERSION = $CSS::SAC::VERSION || '0.03';
+
+#---------------------------------------------------------------------#
+# build the fields for an array based object
+#---------------------------------------------------------------------#
+use Class::ArrayObjects define => {
+ fields => [qw(_type_)],
+ };
+#---------------------------------------------------------------------#
+
+
+### Constants #########################################################
+# #
+# #
+
+sub UNKNOWN_CONDITION () { 1 }
+sub AND_CONDITION () { 2 }
+sub ATTRIBUTE_CONDITION () { 3 }
+sub BEGIN_HYPHEN_ATTRIBUTE_CONDITION () { 4 }
+sub CLASS_CONDITION () { 5 }
+sub CONTENT_CONDITION () { 6 }
+sub ID_CONDITION () { 7 }
+sub LANG_CONDITION () { 8 }
+sub NEGATIVE_CONDITION () { 9 }
+sub ONE_OF_ATTRIBUTE_CONDITION () { 10 }
+sub ONLY_CHILD_CONDITION () { 11 }
+sub ONLY_TYPE_CONDITION () { 12 }
+sub OR_CONDITION () { 13 }
+sub POSITIONAL_CONDITION () { 14 }
+sub PSEUDO_CLASS_CONDITION () { 15 }
+
+# new non-standard conditions for CSS3 selectors
+sub STARTS_WITH_ATTRIBUTE_CONDITION () { 16 } # [attr^='string']
+sub ENDS_WITH_ATTRIBUTE_CONDITION () { 17 } # [attr$='string']
+sub CONTAINS_ATTRIBUTE_CONDITION () { 18 } # [attr*='string']
+sub IS_ROOT_CONDITION () { 19 } # :root
+sub IS_EMPTY_CONDITION () { 20 } # :empty
+
+#---------------------------------------------------------------------#
+# import()
+# all import can do is export the constants
+#---------------------------------------------------------------------#
+sub import {
+ my $class = shift;
+ my $tag = shift || '';
+
+ # check that we have the right tag
+ return unless $tag eq ':constants';
+
+ # define some useful vars
+ my $pkg = caller;
+ my @constants = qw(
+ UNKNOWN_CONDITION
+ AND_CONDITION
+ ATTRIBUTE_CONDITION
+ BEGIN_HYPHEN_ATTRIBUTE_CONDITION
+ CLASS_CONDITION
+ CONTENT_CONDITION
+ ID_CONDITION
+ LANG_CONDITION
+ NEGATIVE_CONDITION
+ ONE_OF_ATTRIBUTE_CONDITION
+ ONLY_CHILD_CONDITION
+ ONLY_TYPE_CONDITION
+ OR_CONDITION
+ POSITIONAL_CONDITION
+ PSEUDO_CLASS_CONDITION
+
+ STARTS_WITH_ATTRIBUTE_CONDITION
+ ENDS_WITH_ATTRIBUTE_CONDITION
+ CONTAINS_ATTRIBUTE_CONDITION
+ IS_ROOT_CONDITION
+ IS_EMPTY_CONDITION
+ );
+
+ # now lets create the constants in the caller's package
+ no strict 'refs';
+ for my $c (@constants) {
+ my $qname = "${pkg}::$c";
+ *$qname = \&{$c};
+ }
+}
+#---------------------------------------------------------------------#
+
+
+# #
+# #
+### Constants #########################################################
+
+
+### Constructor #######################################################
+# #
+# #
+
+
+#---------------------------------------------------------------------#
+# CSS::SAC::Condition->new($type)
+# creates a new sac condition object
+#---------------------------------------------------------------------#
+sub new {
+ my $class = ref($_[0])?ref(shift):shift;
+ my $type = shift;
+ return bless [$type], $class;
+}
+#---------------------------------------------------------------------#
+
+
+# #
+# #
+### Constructor #######################################################
+
+
+
+### Accessors #########################################################
+# #
+# #
+
+
+#---------------------------------------------------------------------#
+# my $type = $cond->ConditionType()
+# $cond->ConditionType($type)
+# get/set the condition type
+#---------------------------------------------------------------------#
+sub ConditionType {
+ (@_==2) ? $_[0]->[_type_] = $_[1] :
+ $_[0]->[_type_];
+}
+#---------------------------------------------------------------------#
+*CSS::SAC::Condition::getConditionType = \&ConditionType;
+
+
+#---------------------------------------------------------------------#
+# $cond->is_type($condition_constant)
+# returns true is this condition is of type $condition_constant
+#---------------------------------------------------------------------#
+sub is_type {
+ return $_[0]->[_type_] == $_[1];
+}
+#---------------------------------------------------------------------#
+
+
+# #
+# #
+### Accessors #########################################################
+
+
+
+1;
+
+=pod
+
+=head1 NAME
+
+CSS::SAC::Condition - base class for SAC conditions
+
+=head1 SYNOPSIS
+
+ use CSS::SAC::Condition qw(:constants);
+ foo if $cond->is_type(CONDITION_TYPE_CONSTANT);
+
+=head1 DESCRIPTION
+
+SAC Conditions describe conditions that can be expressed in CSS such
+as AttributeConditions or PositionalConditions. This class provides
+everything that is needed to implement simple conditions (methods,
+constants) as well as what is needed by subclasses defining more
+complex conditions.
+
+The constants are those defined in the SAC spec, with the leading SAC_
+removed. What the constants map to is to be considered an opaque token
+that can be tested for equality. If there is demand for it, I will add
+a way to add new constants (for people wishing to define new condition
+types).
+
+I have also added the UNKNOWN_CONDITION constant. It shouldn't occur
+in normal processing but it's always useful to have such fallback
+values.
+
+The Condition interface adds $cond->is_type($condition_type) to the
+interface defined in the SAC spec. This allows for more flexible type
+checking. For instance, if you create a subclass of ContentCondition
+that extends it with the ContentRegexCondition interface you will
+probably want software ignorant of your subclass's existence to still
+be able to do something useful with it. That software should also be
+able to treat ContentRegexConditions as if they were
+ContentConditions.
+
+If that software tests condition types the following way:
+
+ $rcond->ConditionType == CONTENT_CONDITION
+
+then you've lost because the condition type of ContentRegexCondition
+is REGEX_CONTENT_CONDITION. If, however, it tests it that way:
+
+ $rcond->is_type(CONTENT_CONDITION)
+
+then you can simply implement is_type() so that it returns true for
+it's own type and the type of it's superclass. I strongly recommend
+using the latter scheme except in cases when you want to know the
+exact type.
+
+=head1 CONSTANTS
+
+=over 4
+
+=item * UNKNOWN_CONDITION
+
+=item * AND_CONDITION
+
+=item * ATTRIBUTE_CONDITION
+
+=item * BEGIN_HYPHEN_ATTRIBUTE_CONDITION
+
+=item * CLASS_CONDITION
+
+=item * CONTENT_CONDITION
+
+=item * ID_CONDITION
+
+=item * LANG_CONDITION
+
+=item * NEGATIVE_CONDITION
+
+=item * ONE_OF_ATTRIBUTE_CONDITION
+
+=item * ONLY_CHILD_CONDITION
+
+=item * ONLY_TYPE_CONDITION
+
+=item * OR_CONDITION
+
+=item * POSITIONAL_CONDITION
+
+=item * PSEUDO_CLASS_CONDITION
+
+=back
+
+=head1 METHODS
+
+=over 4
+
+=item * CSS::SAC::Condition->new($type) or $cond->new($type)
+
+Creates a new condition. The $type must be one of the type constants.
+
+=item * $cond->ConditionType()
+
+Returns the constant corresponding to the type of this condition.
+
+=item * $cond->is_type($condition_type)
+
+Returns a boolean indicating whether this condition is of type
+$condition_type (a condition constant).
+
+=back
+
+=head1 AUTHOR
+
+Robin Berjon <ro...@kn...>
+
+This module is licensed under the same terms as Perl itself.
+
+=cut
+
+
Index: ConditionFactory.pm
===================================================================
RCS file: /cvsroot/perl-css/CSS-SAC/lib/CSS/SAC/ConditionFactory.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ConditionFactory.pm 2001/08/17 17:50:15 1.2
+++ ConditionFactory.pm 2001/08/17 18:00:01 1.3
@@ -1,559 +1,559 @@
-
-###
-# CSS::SAC::ConditionFactory - the default ConditionFactory
-# Robin Berjon <ro...@kn...>
-# 24/02/2001
-###
-
-package CSS::SAC::ConditionFactory;
-use strict;
-use vars qw($VERSION);
-$VERSION = $CSS::SAC::VERSION || '0.03';
[...1087 lines suppressed...]
+
+=back
+
+=head1 EXPERIMENTAL
+
+There's some experimental stuff in here to provide for some new CSS
+constructs. It is and will remain undocumented until there is
+consensus on the handling of these new tokens. If you badly need to
+use one of the new CSS3 conditions that isn't documented, look at the
+source for features tagged EXPERIMENTAL.
+
+=head1 AUTHOR
+
+Robin Berjon <ro...@kn...>
+
+This module is licensed under the same terms as Perl itself.
+
+=cut
+
+
Index: LexicalUnit.pm
===================================================================
RCS file: /cvsroot/perl-css/CSS-SAC/lib/CSS/SAC/LexicalUnit.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- LexicalUnit.pm 2001/08/17 17:50:15 1.2
+++ LexicalUnit.pm 2001/08/17 18:00:01 1.3
@@ -1,389 +1,389 @@
-
-###
-# CSS::SAC::LexicalUnit - SAC units
-# Robin Berjon <ro...@kn...>
-# 24/02/2001
-###
-
-package CSS::SAC::LexicalUnit;
-use strict;
-use vars qw($VERSION);
-$VERSION = $CSS::SAC::VERSION || '0.03';
-
-#---------------------------------------------------------------------#
-# build the fields for an array based object
-#---------------------------------------------------------------------#
-use Class::ArrayObjects define => {
- fields => [qw(
- _type_
- _value_
- _text_
- )],
- };
-#---------------------------------------------------------------------#
-
-
-### Constants #########################################################
-# #
-# #
-
-
-sub ATTR () { 1 }
-sub CENTIMETER () { 2 }
-sub COUNTER_FUNCTION () { 3 }
-sub COUNTERS_FUNCTION () { 4 }
-sub DEGREE () { 5 }
-sub DIMENSION () { 6 }
-sub EM () { 7 }
-sub EX () { 8 }
-sub FUNCTION () { 9 }
-sub GRADIAN () { 10 }
-sub HERTZ () { 11 }
-sub IDENT () { 12 }
-sub INCH () { 13 }
-sub INHERIT () { 14 }
-sub INTEGER () { 15 }
-sub KILOHERTZ () { 16 }
-sub MILLIMETER () { 17 }
-sub MILLISECOND () { 18 }
-sub OPERATOR_COMMA () { 19 }
-sub OPERATOR_EXP () { 20 }
-sub OPERATOR_GE () { 21 }
-sub OPERATOR_GT () { 22 }
-sub OPERATOR_LE () { 23 }
-sub OPERATOR_LT () { 24 }
-sub OPERATOR_MINUS () { 25 }
-sub OPERATOR_MOD () { 26 }
-sub OPERATOR_MULTIPLY () { 27 }
-sub OPERATOR_PLUS () { 28 }
-sub OPERATOR_SLASH () { 29 }
-sub OPERATOR_TILDE () { 30 }
-sub PERCENTAGE () { 31 }
-sub PICA () { 32 }
-sub PIXEL () { 33 }
-sub POINT () { 34 }
-sub RADIAN () { 35 }
-sub REAL () { 36 }
-sub RECT_FUNCTION () { 37 }
-sub RGBCOLOR () { 38 }
-sub SECOND () { 39 }
-sub STRING_VALUE () { 40 }
-sub SUB_EXPRESSION () { 41 }
-sub UNICODERANGE () { 42 }
-sub URI () { 43 }
-
-
-
-#---------------------------------------------------------------------#
-# import()
-# all import can do is export the constants
-#---------------------------------------------------------------------#
-sub import {
- my $class = shift;
- my $tag = shift || '';
-
- # check that we have the right tag
- return unless $tag eq ':constants';
-
- # define some useful vars
- my $pkg = caller;
- my @constants = qw(
- ATTR CENTIMETER COUNTER_FUNCTION COUNTERS_FUNCTION
- DEGREE DIMENSION EM EX FUNCTION GRADIAN HERTZ
- IDENT INCH INHERIT INTEGER KILOHERTZ MILLIMETER
- MILLISECOND OPERATOR_COMMA OPERATOR_EXP OPERATOR_GE
- OPERATOR_GT OPERATOR_LE OPERATOR_LT OPERATOR_MINUS
- OPERATOR_MOD OPERATOR_MULTIPLY OPERATOR_PLUS
- OPERATOR_SLASH OPERATOR_TILDE PERCENTAGE PICA PIXEL
- POINT RADIAN REAL RECT_FUNCTION RGBCOLOR SECOND
- STRING_VALUE SUB_EXPRESSION UNICODERANGE URI
- );
-
- # now lets create the constants in the caller's package
- no strict 'refs';
- for my $c (@constants) {
- my $qname = "${pkg}::$c";
- *$qname = \&{$c};
- }
-}
-#---------------------------------------------------------------------#
-
-
-# #
-# #
-### Constants #########################################################
-
-
-### Constructor #######################################################
-# #
-# #
-
-
-#---------------------------------------------------------------------#
-# CSS::SAC::LexicalUnit->new($type,$text,$value)
-# creates a new sac lexical unit object
-#---------------------------------------------------------------------#
-sub new {
- my $class = ref($_[0])?ref(shift):shift;
- my $type = shift;
- my $text = shift;
- my $value = shift;
-
- # define our fields
- my $self = [];
- $self->[_type_] = $type;
- $self->[_text_] = $text;
- $self->[_value_] = $value;
-
- return bless $self, $class;
-}
-#---------------------------------------------------------------------#
-
-
-# #
-# #
-### Constructor #######################################################
-
-
-
-
-### Accessors #########################################################
-# #
-# #
-
-# defined aliases
-*CSS::SAC::LexicalUnit::getDimensionUnitText = \&DimensionUnitText;
-*CSS::SAC::LexicalUnit::getFunctionName = \&FunctionName;
-*CSS::SAC::LexicalUnit::getValue = \&Value;
-*CSS::SAC::LexicalUnit::getLexicalUnitType = \&LexicalUnitType;
-
-#---------------------------------------------------------------------#
-# my $dut = $lu->DimensionUnitText
-# $lu->DimensionUnitText($dut)
-# get/set the text of the dimension unit (eg cm, px, etc...)
-#---------------------------------------------------------------------#
-sub DimensionUnitText {
- (@_==2) ? $_[0]->[_text_] = $_[1] :
- $_[0]->[_text_];
-}
-#---------------------------------------------------------------------#
-
-
-#---------------------------------------------------------------------#
-# my $fn = $lu->FunctionName
-# $lu->FunctionName($fn)
-# get/set the name of the function (eg attr, uri, etc...)
-#---------------------------------------------------------------------#
-sub FunctionName {
- (@_==2) ? $_[0]->[_text_] = $_[1] :
- $_[0]->[_text_];
-}
-#---------------------------------------------------------------------#
-
-
-#---------------------------------------------------------------------#
-# my $value = $lu->Value
-# $lu->Value($value)
-# get/set the value of the lu (which may be another lu, or a lu list)
-#---------------------------------------------------------------------#
-sub Value {
- (@_==2) ? $_[0]->[_value_] = $_[1] :
- $_[0]->[_value_];
-}
-#---------------------------------------------------------------------#
-
-
-#---------------------------------------------------------------------#
-# my $type = $lu->LexicalUnitType
-# $lu->LexicalUnitType($type)
-# get/set the type of the lu
-#---------------------------------------------------------------------#
-sub LexicalUnitType {
- (@_==2) ? $_[0]->[_type_] = $_[1] :
- $_[0]->[_type_];
-}
-#---------------------------------------------------------------------#
-
-
-#---------------------------------------------------------------------#
-# $lu->is_type($lu_constant)
-# returns true is this lu is of type $lu_constant
-#---------------------------------------------------------------------#
-sub is_type {
- return $_[0]->[_type_] == $_[1];
-}
-#---------------------------------------------------------------------#
-
-
-# #
-# #
-### Accessors #########################################################
-
-
-1;
-=pod
-
-=head1 NAME
-
-CSS::SAC::LexicalUnit - SAC units
-
-=head1 SYNOPSIS
-
- use CSS::SAC::LexicalUnit qw(:constants);
- foo if $lu->is_type(LU_TYPE_CONSTANT);
-
-=head1 DESCRIPTION
-
-In the SAC spec, LexicalUnit is a linked list, that is, you only ever
-hold one LexicalUnit, and you ask for the next of for the previous one
-when you want to move on.
-
-Such a model seems awkward, though I'm sure it makes sense somehow in
-Java, likely for a Java-specific reason.
-
-In the Perl implementation, I have changed this. A LexicalUnit is an
-object that stands on it's own and has no next/previous objects.
-Instead, the $handler->property callback gets called with a
-LexicalUnitList, which is in fact just an array ref of LexicalUnits.
-
-We also don't differentiate between IntegerValue, FloatValue, and
-StringValue, it's always Value in Perl. This also applies to
-Parameters and SubValues. Both are called as Value and return an array
-ref of LexicalUnits.
-
-I added the is_type() method, see CSS::SAC::Condition for advantages
-of that approach.
-
-=head1 CONSTANTS
-
-=over 4
-
-=item * ATTR
-
-=item * CENTIMETER
-
-=item * COUNTER_FUNCTION
-
-=item * COUNTERS_FUNCTION
-
-=item * DEGREE
-
-=item * DIMENSION
-
-=item * EM
-
-=item * EX
-
-=item * FUNCTION
-
-=item * GRADIAN
-
-=item * HERTZ
-
-=item * IDENT
-
-=item * INCH
-
-=item * INHERIT
-
-=item * INTEGER
-
-=item * KILOHERTZ
-
-=item * MILLIMETER
-
-=item * MILLISECOND
-
-=item * OPERATOR_COMMA
-
-=item * OPERATOR_EXP
-
-=item * OPERATOR_GE
-
-=item * OPERATOR_GT
-
-=item * OPERATOR_LE
-
-=item * OPERATOR_LT
-
-=item * OPERATOR_MINUS
-
-=item * OPERATOR_MOD
-
-=item * OPERATOR_MULTIPLY
-
-=item * OPERATOR_PLUS
-
-=item * OPERATOR_SLASH
-
-=item * OPERATOR_TILDE
-
-=item * PERCENTAGE
-
-=item * PICA
-
-=item * PIXEL
-
-=item * POINT
-
-=item * RADIAN
-
-=item * REAL
-
-=item * RECT_FUNCTION
-
-=item * RGBCOLOR
-
-=item * SECOND
-
-=item * STRING_VALUE
-
-=item * SUB_EXPRESSION
-
-=item * UNICODERANGE
-
-=item * URI
-
-=back
-
-=head1 METHODS
-
-=over
-
-=item * CSS::SAC::LexicalUnit->new($type,$text,$value) or $lu->new($type,$text,$value)
-
-Creates a new unit. The $type must be one of the type constants, the
-text depends on the type of unit (unit text, func name, etc...), and
-the value is the content of the lu.
-
-=item * $lu->DimensionUnitText([$dut]) or getDimensionUnitText
-
-get/set the text of the dimension unit (eg cm, px, etc...)
-
-=item * $lu->FunctionName([$fn]) or getFunctionName
-
-get/set the name of the function (eg attr, uri, etc...)
-
-=item * $lu->Value([$value]) or getValue
-
-get/set the value of the lu (which may be another lu, or a lu list)
-
-=item * $lu->LexicalUnitType([$type]) or getLexicalUnitType
-
-get/set the type of the lu
-
-=item * $lu->is_type($lu_constant)
-
-returns true is this lu is of type $lu_constant
-
-=back
-
-=head1 AUTHOR
-
-Robin Berjon <ro...@kn...>
-
-This module is licensed under the same terms as Perl itself.
-
-=cut
-
-
+
+###
+# CSS::SAC::LexicalUnit - SAC units
+# Robin Berjon <ro...@kn...>
+# 24/02/2001
+###
+
+package CSS::SAC::LexicalUnit;
+use strict;
+use vars qw($VERSION);
+$VERSION = $CSS::SAC::VERSION || '0.03';
+
+#---------------------------------------------------------------------#
+# build the fields for an array based object
+#---------------------------------------------------------------------#
+use Class::ArrayObjects define => {
+ fields => [qw(
+ _type_
+ _value_
+ _text_
+ )],
+ };
+#---------------------------------------------------------------------#
+
+
+### Constants #########################################################
+# #
+# #
+
+
+sub ATTR () { 1 }
+sub CENTIMETER () { 2 }
+sub COUNTER_FUNCTION () { 3 }
+sub COUNTERS_FUNCTION () { 4 }
+sub DEGREE () { 5 }
+sub DIMENSION () { 6 }
+sub EM () { 7 }
+sub EX () { 8 }
+sub FUNCTION () { 9 }
+sub GRADIAN () { 10 }
+sub HERTZ () { 11 }
+sub IDENT () { 12 }
+sub INCH () { 13 }
+sub INHERIT () { 14 }
+sub INTEGER () { 15 }
+sub KILOHERTZ () { 16 }
+sub MILLIMETER () { 17 }
+sub MILLISECOND () { 18 }
+sub OPERATOR_COMMA () { 19 }
+sub OPERATOR_EXP () { 20 }
+sub OPERATOR_GE () { 21 }
+sub OPERATOR_GT () { 22 }
+sub OPERATOR_LE () { 23 }
+sub OPERATOR_LT () { 24 }
+sub OPERATOR_MINUS () { 25 }
+sub OPERATOR_MOD () { 26 }
+sub OPERATOR_MULTIPLY () { 27 }
+sub OPERATOR_PLUS () { 28 }
+sub OPERATOR_SLASH () { 29 }
+sub OPERATOR_TILDE () { 30 }
+sub PERCENTAGE () { 31 }
+sub PICA () { 32 }
+sub PIXEL () { 33 }
+sub POINT () { 34 }
+sub RADIAN () { 35 }
+sub REAL () { 36 }
+sub RECT_FUNCTION () { 37 }
+sub RGBCOLOR () { 38 }
+sub SECOND () { 39 }
+sub STRING_VALUE () { 40 }
+sub SUB_EXPRESSION () { 41 }
+sub UNICODERANGE () { 42 }
+sub URI () { 43 }
+
+
+
+#---------------------------------------------------------------------#
+# import()
+# all import can do is export the constants
+#---------------------------------------------------------------------#
+sub import {
+ my $class = shift;
+ my $tag = shift || '';
+
+ # check that we have the right tag
+ return unless $tag eq ':constants';
+
+ # define some useful vars
+ my $pkg = caller;
+ my @constants = qw(
+ ATTR CENTIMETER COUNTER_FUNCTION COUNTERS_FUNCTION
+ DEGREE DIMENSION EM EX FUNCTION GRADIAN HERTZ
+ IDENT INCH INHERIT INTEGER KILOHERTZ MILLIMETER
+ MILLISECOND OPERATOR_COMMA OPERATOR_EXP OPERATOR_GE
+ OPERATOR_GT OPERATOR_LE OPERATOR_LT OPERATOR_MINUS
+ OPERATOR_MOD OPERATOR_MULTIPLY OPERATOR_PLUS
+ OPERATOR_SLASH OPERATOR_TILDE PERCENTAGE PICA PIXEL
+ POINT RADIAN REAL RECT_FUNCTION RGBCOLOR SECOND
+ STRING_VALUE SUB_EXPRESSION UNICODERANGE URI
+ );
+
+ # now lets create the constants in the caller's package
+ no strict 'refs';
+ for my $c (@constants) {
+ my $qname = "${pkg}::$c";
+ *$qname = \&{$c};
+ }
+}
+#---------------------------------------------------------------------#
+
+
+# #
+# #
+### Constants #########################################################
+
+
+### Constructor #######################################################
+# #
+# #
+
+
+#---------------------------------------------------------------------#
+# CSS::SAC::LexicalUnit->new($type,$text,$value)
+# creates a new sac lexical unit object
+#---------------------------------------------------------------------#
+sub new {
+ my $class = ref($_[0])?ref(shift):shift;
+ my $type = shift;
+ my $text = shift;
+ my $value = shift;
+
+ # define our fields
+ my $self = [];
+ $self->[_type_] = $type;
+ $self->[_text_] = $text;
+ $self->[_value_] = $value;
+
+ return bless $self, $class;
+}
+#---------------------------------------------------------------------#
+
+
+# #
+# #
+### Constructor #######################################################
+
+
+
+
+### Accessors #########################################################
+# #
+# #
+
+# defined aliases
+*CSS::SAC::LexicalUnit::getDimensionUnitText = \&DimensionUnitText;
+*CSS::SAC::LexicalUnit::getFunctionName = \&FunctionName;
+*CSS::SAC::LexicalUnit::getValue = \&Value;
+*CSS::SAC::LexicalUnit::getLexicalUnitType = \&LexicalUnitType;
+
+#---------------------------------------------------------------------#
+# my $dut = $lu->DimensionUnitText
+# $lu->DimensionUnitText($dut)
+# get/set the text of the dimension unit (eg cm, px, etc...)
+#---------------------------------------------------------------------#
+sub DimensionUnitText {
+ (@_==2) ? $_[0]->[_text_] = $_[1] :
+ $_[0]->[_text_];
+}
+#---------------------------------------------------------------------#
+
+
+#---------------------------------------------------------------------#
+# my $fn = $lu->FunctionName
+# $lu->FunctionName($fn)
+# get/set the name of the function (eg attr, uri, etc...)
+#---------------------------------------------------------------------#
+sub FunctionName {
+ (@_==2) ? $_[0]->[_text_] = $_[1] :
+ $_[0]->[_text_];
+}
+#---------------------------------------------------------------------#
+
+
+#---------------------------------------------------------------------#
+# my $value = $lu->Value
+# $lu->Value($value)
+# get/set the value of the lu (which may be another lu, or a lu list)
+#---------------------------------------------------------------------#
+sub Value {
+ (@_==2) ? $_[0]->[_value_] = $_[1] :
+ $_[0]->[_value_];
+}
+#---------------------------------------------------------------------#
+
+
+#---------------------------------------------------------------------#
+# my $type = $lu->LexicalUnitType
+# $lu->LexicalUnitType($type)
+# get/set the type of the lu
+#---------------------------------------------------------------------#
+sub LexicalUnitType {
+ (@_==2) ? $_[0]->[_type_] = $_[1] :
+ $_[0]->[_type_];
+}
+#---------------------------------------------------------------------#
+
+
+#---------------------------------------------------------------------#
+# $lu->is_type($lu_constant)
+# returns true is this lu is of type $lu_constant
+#---------------------------------------------------------------------#
+sub is_type {
+ return $_[0]->[_type_] == $_[1];
+}
+#---------------------------------------------------------------------#
+
+
+# #
+# #
+### Accessors #########################################################
+
+
+1;
+=pod
+
+=head1 NAME
+
+CSS::SAC::LexicalUnit - SAC units
+
+=head1 SYNOPSIS
+
+ use CSS::SAC::LexicalUnit qw(:constants);
+ foo if $lu->is_type(LU_TYPE_CONSTANT);
+
+=head1 DESCRIPTION
+
+In the SAC spec, LexicalUnit is a linked list, that is, you only ever
+hold one LexicalUnit, and you ask for the next of for the previous one
+when you want to move on.
+
+Such a model seems awkward, though I'm sure it makes sense somehow in
+Java, likely for a Java-specific reason.
+
+In the Perl implementation, I have changed this. A LexicalUnit is an
+object that stands on it's own and has no next/previous objects.
+Instead, the $handler->property callback gets called with a
+LexicalUnitList, which is in fact just an array ref of LexicalUnits.
+
+We also don't differentiate between IntegerValue, FloatValue, and
+StringValue, it's always Value in Perl. This also applies to
+Parameters and SubValues. Both are called as Value and return an array
+ref of LexicalUnits.
+
+I added the is_type() method, see CSS::SAC::Condition for advantages
+of that approach.
+
+=head1 CONSTANTS
+
+=over 4
+
+=item * ATTR
+
+=item * CENTIMETER
+
+=item * COUNTER_FUNCTION
+
+=item * COUNTERS_FUNCTION
+
+=item * DEGREE
+
+=item * DIMENSION
+
+=item * EM
+
+=item * EX
+
+=item * FUNCTION
+
+=item * GRADIAN
+
+=item * HERTZ
+
+=item * IDENT
+
+=item * INCH
+
+=item * INHERIT
+
+=item * INTEGER
+
+=item * KILOHERTZ
+
+=item * MILLIMETER
+
+=item * MILLISECOND
+
+=item * OPERATOR_COMMA
+
+=item * OPERATOR_EXP
+
+=item * OPERATOR_GE
+
+=item * OPERATOR_GT
+
+=item * OPERATOR_LE
+
+=item * OPERATOR_LT
+
+=item * OPERATOR_MINUS
+
+=item * OPERATOR_MOD
+
+=item * OPERATOR_MULTIPLY
+
+=item * OPERATOR_PLUS
+
+=item * OPERATOR_SLASH
+
+=item * OPERATOR_TILDE
+
+=item * PERCENTAGE
+
+=item * PICA
+
+=item * PIXEL
+
+=item * POINT
+
+=item * RADIAN
+
+=item * REAL
+
+=item * RECT_FUNCTION
+
+=item * RGBCOLOR
+
+=item * SECOND
+
+=item * STRING_VALUE
+
+=item * SUB_EXPRESSION
+
+=item * UNICODERANGE
+
+=item * URI
+
+=back
+
+=head1 METHODS
+
+=over
+
+=item * CSS::SAC::LexicalUnit->new($type,$text,$value) or $lu->new($type,$text,$value)
+
+Creates a new unit. The $type must be one of the type constants, the
+text depends on the type of unit (unit text, func name, etc...), and
+the value is the content of the lu.
+
+=item * $lu->DimensionUnitText([$dut]) or getDimensionUnitText
+
+get/set the text of the dimension unit (eg cm, px, etc...)
+
+=item * $lu->FunctionName([$fn]) or getFunctionName
+
+get/set the name of the function (eg attr, uri, etc...)
+
+=item * $lu->Value([$value]) or getValue
+
+get/set the value of the lu (which may be another lu, or a lu list)
+
+=item * $lu->LexicalUnitType([$type]) or getLexicalUnitType
+
+get/set the type of the lu
+
+=item * $lu->is_type($lu_constant)
+
+returns true is this lu is of type $lu_constant
+
+=back
+
+=head1 AUTHOR
+
+Robin Berjon <ro...@kn...>
+
+This module is licensed under the same terms as Perl itself.
+
+=cut
+
+
Index: Selector.pm
===================================================================
RCS file: /cvsroot/perl-css/CSS-SAC/lib/CSS/SAC/Selector.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- Selector.pm 2001/08/17 17:50:15 1.2
+++ Selector.pm 2001/08/17 18:00:01 1.3
@@ -1,244 +1,244 @@
-
-###
-# CSS::SAC::Selector - base class for SAC selectors
-# Robin Berjon <ro...@kn...>
-# 24/02/2001
-###
-
-package CSS::SAC::Selector;
-use strict;
-use vars qw($VERSION);
-$VERSION = $CSS::SAC::VERSION || '0.03';
-
-#---------------------------------------------------------------------#
-# build the fields for an array based object
-#---------------------------------------------------------------------#
-use Class::ArrayObjects define => {
- fields => [qw(_type_)],
- };
-#---------------------------------------------------------------------#
-
-
-### Constants #########################################################
-# #
-# #
-
-sub UNKNOWN_SELECTOR () { 1 }
-sub ANY_NODE_SELECTOR () { 2 }
-sub CDATA_SECTION_NODE_SELECTOR () { 3 }
-sub CHILD_SELECTOR () { 4 }
-sub COMMENT_NODE_SELECTOR () { 5 }
-sub CONDITIONAL_SELECTOR () { 6 }
-sub DESCENDANT_SELECTOR () { 7 }
-sub DIRECT_ADJACENT_SELECTOR () { 8 }
-sub ELEMENT_NODE_SELECTOR () { 9 }
-sub NEGATIVE_SELECTOR () { 10 }
-sub PROCESSING_INSTRUCTION_NODE_SELECTOR () { 11 }
-sub PSEUDO_ELEMENT_SELECTOR () { 12 }
-sub ROOT_NODE_SELECTOR () { 13 }
-sub TEXT_NODE_SELECTOR () { 14 }
-
-# EXPERIMENTAL SELECTOR
-sub INDIRECT_ADJACENT_SELECTOR () { 15 }
-
-
-#---------------------------------------------------------------------#
-# import()
-# all import can do is export the constants
-#---------------------------------------------------------------------#
-sub import {
- my $class = shift;
- my $tag = shift || '';
-
- # check that we have the right tag
- return unless $tag eq ':constants';
-
- # define some useful vars
- my $pkg = caller;
- my @constants = qw(
- UNKNOWN_SELECTOR
- ANY_NODE_SELECTOR
- CDATA_SECTION_NODE_SELECTOR
- CHILD_SELECTOR
- COMMENT_NODE_SELECTOR
- CONDITIONAL_SELECTOR
- DESCENDANT_SELECTOR
- DIRECT_ADJACENT_SELECTOR
- ELEMENT_NODE_SELECTOR
- NEGATIVE_SELECTOR
- PROCESSING_INSTRUCTION_NODE_SELECTOR
- PSEUDO_ELEMENT_SELECTOR
- ROOT_NODE_SELECTOR
- TEXT_NODE_SELECTOR
-
- INDIRECT_ADJACENT_SELECTOR
- );
-
- # now lets create the constants in the caller's package
- no strict 'refs';
- for my $c (@constants) {
- my $qname = "${pkg}::$c";
- *$qname = \&{$c};
- }
-}
-#---------------------------------------------------------------------#
-
-
-# #
-# #
-### Constants #########################################################
-
-
-### Constructor #######################################################
-# #
-# #
-
-
-#---------------------------------------------------------------------#
-# CSS::SAC::Selector->new($type)
-# creates a new sac selector object
-#---------------------------------------------------------------------#
-sub new {
- my $class = ref($_[0])?ref(shift):shift;
- my $type = shift;
- return bless [$type], $class;
-}
-#---------------------------------------------------------------------#
-
-
-# #
-# #
-### Constructor #######################################################
-
-
-
-### Accessors #########################################################
-# #
-# #
-
-
-#---------------------------------------------------------------------#
-# my $type = $sel->SelectorType()
-# $sel->SelectorType($type)
-# get/set the selector type
-#---------------------------------------------------------------------#
-sub SelectorType {
- (@_==2) ? $_[0]->[_type_] = $_[1] :
- $_[0]->[_type_];
-}
-#---------------------------------------------------------------------#
-*CSS::SAC::Selector::getSelectorType = \&SelectorType;
-
-#---------------------------------------------------------------------#
-# $sel->is_type($selector_constant)
-# returns true is this selector is of type $selector_constant
-#---------------------------------------------------------------------#
-sub is_type {
- return $_[0]->[_type_] == $_[1];
-}
-#---------------------------------------------------------------------#
-
-
-# #
-# #
-### Accessors #########################################################
-
-
-
-1;
-
-=pod
-
-=head1 NAME
-
-CSS::SAC::Selector - base class for SAC selectors
-
-=head1 SYNOPSIS
-
- use CSS::SAC::Selector qw(:constants);
- foo if $sel->is_type(SELECTOR_TYPE_CONSTANT);
-
-=head1 DESCRIPTION
-
-SAC Selectors describe selectors that can be expressed in CSS such
-as ElementSelector or SiblingSelector. This class provides everything
-that is needed to implement simple selectors (methods, constants) as
-well as what is needed by subclasses defining more complex selectors.
-
-The constants are those defined in the SAC spec, with the leading SAC_
-removed. What the constants map to is to be considered an opaque token
-that can be tested for equality. If there is demand for it, I will add
-a way to add new constants (for people wishing to define new condition
-types).
-
-I have also added the UNKNOWN_SELECTOR constant. It shouldn't occur
-in normal processing but it's always useful to have such fallback
-values.
-
-The Selector interface adds $sel->is_type($selector_type) to the
-interface defined in the SAC spec. This allows for more flexible type
-checking. The advantages are the same as those described for the same
-extension in the CSS::SAC::Condition class.
-
-=head1 CONSTANTS
-
-=over
-
-=item * UNKNOWN_SELECTOR
-
-=item * ANY_NODE_SELECTOR
-
-=item * CDATA_SECTION_NODE_SELECTOR
-
-=item * CHILD_SELECTOR
-
-=item * COMMENT_NODE_SELECTOR
-
-=item * CONDITIONAL_SELECTOR
-
-=item * DESCENDANT_SELECTOR
-
-=item * DIRECT_ADJACENT_SELECTOR
-
-=item * ELEMENT_NODE_SELECTOR
-
-=item * NEGATIVE_SELECTOR
-
-=item * PROCESSING_INSTRUCTION_NODE_SELECTOR
-
-=item * PSEUDO_ELEMENT_SELECTOR
-
-=item * ROOT_NODE_SELECTOR
-
-=item * TEXT_NODE_SELECTOR
-
-=back
-
-=head1 METHODS
-
-=over
-
-=item * CSS::SAC::Selector->new($type) or $sel->new($type)
-
-Creates a new selector. The $type must be one of the type constants.
-
-=item * $sel->SelectorType() or $sel->getSelectorType
-
-Returns the constant corresponding to the type of this selector.
-
-=item * $sel->is_type($selector_type)
-
-Returns a boolean indicating whether this selector is of type
-$selector_type (a selector constant).
-
-=back
-
-=head1 AUTHOR
-
-Robin Berjon <ro...@kn...>
-
-This module is licensed under the same terms as Perl itself.
-
-=cut
-
-
+
+###
+# CSS::SAC::Selector - base class for SAC selectors
+# Robin Berjon <ro...@kn...>
+# 24/02/2001
+###
+
+package CSS::SAC::Selector;
+use strict;
+use vars qw($VERSION);
+$VERSION = $CSS::SAC::VERSION || '0.03';
+
+#---------------------------------------------------------------------#
+# build the fields for an array based object
+#---------------------------------------------------------------------#
+use Class::ArrayObjects define => {
+ fields => [qw(_type_)],
+ };
+#---------------------------------------------------------------------#
+
+
+### Constants #########################################################
+# #
+# #
+
+sub UNKNOWN_SELECTOR () { 1 }
+sub ANY_NODE_SELECTOR () { 2 }
+sub CDATA_SECTION_NODE_SELECTOR () { 3 }
+sub CHILD_SELECTOR () { 4 }
+sub COMMENT_NODE_SELECTOR () { 5 }
+sub CONDITIONAL_SELECTOR () { 6 }
+sub DESCENDANT_SELECTOR () { 7 }
+sub DIRECT_ADJACENT_SELECTOR () { 8 }
+sub ELEMENT_NODE_SELECTOR () { 9 }
+sub NEGATIVE_SELECTOR () { 10 }
+sub PROCESSING_INSTRUCTION_NODE_SELECTOR () { 11 }
+sub PSEUDO_ELEMENT_SELECTOR () { 12 }
+sub ROOT_NODE_SELECTOR () { 13 }
+sub TEXT_NODE_SELECTOR () { 14 }
+
+# EXPERIMENTAL SELECTOR
+sub INDIRECT_ADJACENT_SELECTOR () { 15 }
+
+
+#---------------------------------------------------------------------#
+# import()
+# all import can do is export the constants
+#---------------------------------------------------------------------#
+sub import {
+ my $class = shift;
+ my $tag = shift || '';
+
+ # check that we have the right tag
+ return unless $tag eq ':constants';
+
+ # define some useful vars
+ my $pkg = caller;
+ my @constants = qw(
+ UNKNOWN_SELECTOR
+ ANY_NODE_SELECTOR
+ CDATA_SECTION_NODE_SELECTOR
+ CHILD_SELECTOR
+ COMMENT_NODE_SELECTOR
+ CONDITIONAL_SELECTOR
+ DESCENDANT_SELECTOR
+ DIRECT_ADJACENT_SELECTOR
+ ELEMENT_NODE_SELECTOR
+ NEGATIVE_SELECTOR
+ PROCESSING_INSTRUCTION_NODE_SELECTOR
+ PSEUDO_ELEMENT_SELECTOR
+ ROOT_NODE_SELECTOR
+ TEXT_NODE_SELECTOR
+
+ INDIRECT_ADJACENT_SELECTOR
+ );
+
+ # now lets create the constants in the caller's package
+ no strict 'refs';
+ for my $c (@constants) {
+ my $qname = "${pkg}::$c";
+ *$qname = \&{$c};
+ }
+}
+#---------------------------------------------------------------------#
+
+
+# #
+# #
+### Constants #########################################################
+
+
+### Constructor #######################################################
+# #
+# #
+
+
+#---------------------------------------------------------------------#
+# CSS::SAC::Selector->new($type)
+# creates a new sac selector object
+#---------------------------------------------------------------------#
+sub new {
+ my $class = ref($_[0])?ref(shift):shift;
+ my $type = shift;
+ return bless [$type], $class;
+}
+#---------------------------------------------------------------------#
+
+
+# #
+# #
+### Constructor #######################################################
+
+
+
+### Accessors #########################################################
+# #
+# #
+
+
+#---------------------------------------------------------------------#
+# my $type = $sel->SelectorType()
+# $sel->SelectorType($type)
+# get/set the selector type
+#---------------------------------------------------------------------#
+sub SelectorType {
+ (@_==2) ? $_[0]->[_type_] = $_[1] :
+ $_[0]->[_type_];
+}
+#---------------------------------------------------------------------#
+*CSS::SAC::Selector::getSelectorType = \&SelectorType;
+
+#---------------------------------------------------------------------#
+# $sel->is_type($selector_constant)
+# returns true is this selector is of type $selector_constant
+#---------------------------------------------------------------------#
+sub is_type {
+ return $_[0]->[_type_] == $_[1];
+}
+#---------------------------------------------------------------------#
+
+
+# #
+# #
+### Accessors #########################################################
+
+
+
+1;
+
+=pod
+
+=head1 NAME
+
+CSS::SAC::Selector - base class for SAC selectors
+
+=head1 SYNOPSIS
+
+ use CSS::SAC::Selector qw(:constants);
+ foo if $sel->is_type(SELECTOR_TYPE_CONSTANT);
+
+=head1 DESCRIPTION
+
+SAC Selectors describe selectors that can be expressed in CSS such
+as ElementSelector or SiblingSelector. This class provides everything
+that is needed to implement simple selectors (methods, constants) as
+well as what is needed by subclasses defining more complex selectors.
+
+The constants are those defined in the SAC spec, with the leading SAC_
+removed. What the constants map to is to be considered an opaque token
+that can be tested for equality. If there is demand for it, I will add
+a way to add new constants (for people wishing to define new condition
+types).
+
+I have also added the UNKNOWN_SELECTOR constant. It shouldn't occur
+in normal processing but it's always useful to have such fallback
+values.
+
+The Selector interface adds $sel->is_type($selector_type) to the
+interface defined in the SAC spec. This allows for more flexible type
+checking. The advantages are the same as those described for the same
+extension in the CSS::SAC::Condition class.
+
+=head1 CONSTANTS
+
+=over
+
+=item * UNKNOWN_SELECTOR
+
+=item * ANY_NODE_SELECTOR
+
+=item * CDATA_SECTION_NODE_SELECTOR
+
+=item * CHILD_SELECTOR
+
+=item * COMMENT_NODE_SELECTOR
+
+=item * CONDITIONAL_SELECTOR
+
+=item * DESCENDANT_SELECTOR
+
+=item * DIRECT_ADJACENT_SELECTOR
+
+=item * ELEMENT_NODE_SELECTOR
+
+=item * NEGATIVE_SELECTOR
+
+=item * PROCESSING_INSTRUCTION_NODE_SELECTOR
+
+=item * PSEUDO_ELEMENT_SELECTOR
+
+=item * ROOT_NODE_SELECTOR
+
+=item * TEXT_NODE_SELECTOR
+
+=back
+
+=head1 METHODS
+
+=over
+
+=item * CSS::SAC::Selector->new($type) or $sel->new($type)
+
+Creates a new selector. The $type must be one of the type constants.
+
+=item * $sel->SelectorType() or $sel->getSelectorType
+
+Returns the constant corresponding to the type of this selector.
+
+=item * $sel->is_type($selector_type)
+
+Returns a boolean indicating whether this selector is of type
+$selector_type (a selector constant).
+
+=back
+
+=head1 AUTHOR
+
+Robin Berjon <ro...@kn...>
+
+This module is licensed under the same terms as Perl itself.
+
+=cut
+
+
Index: SelectorFactory.pm
===================================================================
RCS file: /cvsroot/perl-css/CSS-SAC/lib/CSS/SAC/SelectorFactory.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- SelectorFactory.pm 2001/08/17 17:50:15 1.2
+++ SelectorFactory.pm 2001/08/17 18:00:01 1.3
@@ -1,425 +1,425 @@
-
-###
-# CSS::SAC::SelectorFactory - the default SelectorFactory
-# Robin Berjon <ro...@kn...>
-# 24/02/2001
-###
-
-package CSS::SAC::SelectorFactory;
-use strict;
-use vars qw($VERSION);
-$VERSION = $CSS::SAC::VERSION || '0.03';
-
-use CSS::SAC::Selector qw(:constants);
-use CSS::SAC::Selector::Descendant qw();
-use CSS::SAC::Selector::Sibling qw();
-use CSS::SAC::Selector::Simple qw();
-use CSS::SAC::Selector::CharacterData qw();
-use CSS::SAC::Selector::Conditional qw();
-use CSS::SAC::Selector::Element qw();
-use CSS::SAC::Selector::Negative qw();
-use CSS::SAC::Selector::ProcessingInstruction qw();
-
-#---------------------------------------------------------------------#
-# build the fields for an array based object
-#---------------------------------------------------------------------#
-use Class::ArrayObjects define => { fields => [] };
-#---------------------------------------------------------------------#
-
-
-
-### Constructor #######################################################
-# #
-# #
-
-
-#------------------------------------------------------------...
[truncated message content] |