You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-commits@xmlgraphics.apache.org by ca...@apache.org on 2007/08/27 04:54:21 UTC
svn commit: r569967 - in /xmlgraphics/batik/trunk:
resources/org/apache/batik/css/parser/resources/Messages.properties
sources/org/apache/batik/css/parser/Parser.java
Author: cam
Date: Sun Aug 26 19:54:20 2007
New Revision: 569967
URL: http://svn.apache.org/viewvc?rev=569967&view=rev
Log:
Fixed parsing of pseudo-elements (which were being ignored).
Modified:
xmlgraphics/batik/trunk/resources/org/apache/batik/css/parser/resources/Messages.properties
xmlgraphics/batik/trunk/sources/org/apache/batik/css/parser/Parser.java
Modified: xmlgraphics/batik/trunk/resources/org/apache/batik/css/parser/resources/Messages.properties
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/resources/org/apache/batik/css/parser/resources/Messages.properties?rev=569967&r1=569966&r2=569967&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/resources/org/apache/batik/css/parser/resources/Messages.properties (original)
+++ xmlgraphics/batik/trunk/resources/org/apache/batik/css/parser/resources/Messages.properties Sun Aug 26 19:54:20 2007
@@ -78,6 +78,9 @@
duplicate.pseudo.element = \
A pseudo element has already been defined.
+pseudo.element.position = \
+Pseudo element cannot occur before the end of the selector.
+
pseudo.function = \
Invalid pseudo-function.
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/css/parser/Parser.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/css/parser/Parser.java?rev=569967&r1=569966&r2=569967&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/css/parser/Parser.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/css/parser/Parser.java Sun Aug 26 19:54:20 2007
@@ -631,10 +631,8 @@
* Parses a selector.
*/
protected Selector parseSelector() {
- SimpleSelector ss = parseSimpleSelector();
- Selector result = ss;
-
pseudoElement = null;
+ Selector result = parseSimpleSelector();
loop: for (;;) {
switch (current) {
@@ -646,11 +644,17 @@
case LexicalUnits.DOT:
case LexicalUnits.LEFT_BRACKET:
case LexicalUnits.COLON:
+ if (pseudoElement != null) {
+ throw createCSSParseException("pseudo.element.position");
+ }
result = selectorFactory.createDescendantSelector
(result,
parseSimpleSelector());
break;
case LexicalUnits.PLUS:
+ if (pseudoElement != null) {
+ throw createCSSParseException("pseudo.element.position");
+ }
nextIgnoreSpaces();
result = selectorFactory.createDirectAdjacentSelector
((short)1,
@@ -658,6 +662,9 @@
parseSimpleSelector());
break;
case LexicalUnits.PRECEDE:
+ if (pseudoElement != null) {
+ throw createCSSParseException("pseudo.element.position");
+ }
nextIgnoreSpaces();
result = selectorFactory.createChildSelector
(result,