You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by hi...@apache.org on 2001/02/09 14:59:48 UTC

cvs commit: xml-batik/sources/org/apache/batik/css/parser Parser.java

hillion     01/02/09 05:59:47

  Modified:    sources/org/apache/batik/css/parser Parser.java
  Log:
  CSS parser fix for 'element[attribute]' selectors.
  Obtained from:  mhartle@hartle-klug.de
  
  Revision  Changes    Path
  1.8       +9 -6      xml-batik/sources/org/apache/batik/css/parser/Parser.java
  
  Index: Parser.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/css/parser/Parser.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Parser.java	2001/01/18 19:42:25	1.7
  +++ Parser.java	2001/02/09 13:59:47	1.8
  @@ -45,7 +45,7 @@
    * This class implements the {@link org.w3c.css.sac.Parser} interface.
    *
    * @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
  - * @version $Id: Parser.java,v 1.7 2001/01/18 19:42:25 hillion Exp $
  + * @version $Id: Parser.java,v 1.8 2001/02/09 13:59:47 hillion Exp $
    */
   public class Parser
       implements org.w3c.css.sac.Parser,
  @@ -769,6 +769,9 @@
                   int op = nextIgnoreSpaces();
                   switch (op) {
                   default:
  +                    throw createCSSParseException("right.bracket");
  +                case LexicalUnits.RIGHT_BRACKET:
  +                    nextIgnoreSpaces();
                       c = conditionFactory.createAttributeCondition(name, null, false,
                                                                     null);
                       break;
  @@ -1694,19 +1697,19 @@
       protected void reportError(CSSParseException e) {
           errorHandler.error(e);
   
  -        int brackets = 1;
  +        int cbraces = 1;
           for (;;) {
               switch (current) {
               case LexicalUnits.EOF:
                   return;
               case LexicalUnits.SEMI_COLON:
  -            case LexicalUnits.RIGHT_BRACKET:
  -                if (--brackets == 0) {
  +            case LexicalUnits.RIGHT_CURLY_BRACE:
  +                if (--cbraces == 0) {
                       nextIgnoreSpaces();
                       return;
                   }
  -            case LexicalUnits.LEFT_BRACKET:
  -                brackets++;
  +            case LexicalUnits.LEFT_CURLY_BRACE:
  +                cbraces++;
               }
               nextIgnoreSpaces();
           }