W3C home > Mailing lists > Public > www-validator-cvs@w3.org > February 2009

2002/css-validator/org/w3c/css/parser/analyzer CssParser.java,1.49,1.50 CssParser.jj,1.49,1.50 CssParserTokenManager.java,1.29,1.30

From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
Date: Thu, 12 Feb 2009 10:32:54 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1LXYsI-0000EP-Qn@lionel-hutz.w3.org>

Update of /sources/public/2002/css-validator/org/w3c/css/parser/analyzer
In directory hutz:/tmp/cvs-serv630/org/w3c/css/parser/analyzer

Modified Files:
	CssParser.java CssParser.jj CssParserTokenManager.java 
Log Message:
Pseudo Elements and Pseudo Classes are now distinct, and pseudo-elements
are displayed as they should.
General Siblig connectos (CSS3) handled properly.



Index: CssParserTokenManager.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/parser/analyzer/CssParserTokenManager.java,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- CssParserTokenManager.java	11 Feb 2009 21:45:35 -0000	1.29
+++ CssParserTokenManager.java	12 Feb 2009 10:32:52 -0000	1.30
@@ -37,11 +37,12 @@
 import org.w3c.css.util.Util;
 import org.w3c.css.util.Messages;
 import org.w3c.css.css.StyleSheetCom;
-import org.w3c.css.selectors.AdjacentSelector;
+import org.w3c.css.selectors.AdjacentSiblingSelector;
 import org.w3c.css.selectors.AttributeSelector;
 import org.w3c.css.selectors.ChildSelector;
 import org.w3c.css.selectors.ClassSelector;
 import org.w3c.css.selectors.DescendantSelector;
+import org.w3c.css.selectors.GeneralSiblingSelector;
 import org.w3c.css.selectors.IdSelector;
 import org.w3c.css.selectors.TypeSelector;
 import org.w3c.css.selectors.UniversalSelector;

Index: CssParser.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/parser/analyzer/CssParser.java,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -d -r1.49 -r1.50
--- CssParser.java	11 Feb 2009 23:15:02 -0000	1.49
+++ CssParser.java	12 Feb 2009 10:32:51 -0000	1.50
@@ -40,11 +40,12 @@
 import org.w3c.css.util.Messages;
 import org.w3c.css.css.StyleSheetCom;
 
-import org.w3c.css.selectors.AdjacentSelector;
+import org.w3c.css.selectors.AdjacentSiblingSelector;
 import org.w3c.css.selectors.AttributeSelector;
 import org.w3c.css.selectors.ChildSelector;
 import org.w3c.css.selectors.ClassSelector;
 import org.w3c.css.selectors.DescendantSelector;
+import org.w3c.css.selectors.GeneralSiblingSelector;
 import org.w3c.css.selectors.IdSelector;
 import org.w3c.css.selectors.TypeSelector;
 import org.w3c.css.selectors.UniversalSelector;
@@ -1829,11 +1830,14 @@
                 }
                 switch(comb) {
                 case '+':
-                current.addAdjacent(new AdjacentSelector());
+                current.addAdjacentSibling(new AdjacentSiblingSelector());
                 break;
                 case '>':
                 current.addChild(new ChildSelector());
                 break;
+                case '~':
+                current.addGeneralSibling(new GeneralSiblingSelector());
+                break;
                 default:
                 current.addDescendant(new DescendantSelector());
                 }
@@ -2386,18 +2390,18 @@
     case PSEUDOCLASS_SYM:
       jj_consume_token(PSEUDOCLASS_SYM);
       n = jj_consume_token(IDENT);
-                try {
-                        if (ac.getCssVersion().equals("css3")) {
-                                s.addPseudo(convertIdent(n.image).toLowerCase());
-                        } else {
-                                {if (true) throw new InvalidParamException("pseudo-element", ":" + convertIdent(n.image).toLowerCase() ,
-                                        ac.getCssVersion() ,ac);}
-                        }
-                } catch(InvalidParamException e) {
-                     //e.printStackTrace();	
-                     removeThisRule();
-                     ac.getFrame().addError(new CssError(e));
+            try {
+                if (ac.getCssVersion().equals("css3")) {
+                    s.addPseudoElement(convertIdent(n.image).toLowerCase());
+                } else {
+                    {if (true) throw new InvalidParamException("pseudo-element", "::" + convertIdent(n.image).toLowerCase() ,
+                                                    ac.getCssVersion() ,ac);}
                 }
+            } catch(InvalidParamException e) {
+                //e.printStackTrace();	
+                removeThisRule();
+                ac.getFrame().addError(new CssError(e));
+            }
       break;
     case COLON:
       jj_consume_token(COLON);
@@ -2405,11 +2409,11 @@
       case IDENT:
         n = jj_consume_token(IDENT);
                 try {
-                     s.addPseudo(convertIdent(n.image).toLowerCase());
+                    s.addPseudoClass(convertIdent(n.image).toLowerCase());
                 } catch(InvalidParamException e) {
-                     //e.printStackTrace();	
-                     removeThisRule();
-                     ac.getFrame().addError(new CssError(e));
+                    //e.printStackTrace();	
+                    removeThisRule();
+                    ac.getFrame().addError(new CssError(e));
                 }
         break;
       case FUNCTIONLANG:
@@ -3028,19 +3032,17 @@
     switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
     case HASHIDENT:
       n = jj_consume_token(HASHIDENT);
-     n.image = Util.strip(n.image);
-     setValue(new org.w3c.css.values.CssColor(), exp, ' ', n, HASH);
       break;
     case HASH:
       n = jj_consume_token(HASH);
-     n.image = Util.strip(n.image);
-     setValue(new org.w3c.css.values.CssColor(), exp, ' ', n, HASH);
       break;
     default:
       jj_la1[112] = jj_gen;
       jj_consume_token(-1);
       throw new ParseException();
     }
+     n.image = Util.strip(n.image);
+     setValue(new org.w3c.css.values.CssColor(), exp, ' ', n, HASH);
   }
 
   String skipStatement() throws ParseException {

Index: CssParser.jj
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/parser/analyzer/CssParser.jj,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -d -r1.49 -r1.50
--- CssParser.jj	11 Feb 2009 23:14:46 -0000	1.49
+++ CssParser.jj	12 Feb 2009 10:32:52 -0000	1.50
@@ -59,11 +59,12 @@
 import org.w3c.css.util.Messages;
 import org.w3c.css.css.StyleSheetCom;
 
-import org.w3c.css.selectors.AdjacentSelector;
+import org.w3c.css.selectors.AdjacentSiblingSelector;
 import org.w3c.css.selectors.AttributeSelector;
 import org.w3c.css.selectors.ChildSelector;
 import org.w3c.css.selectors.ClassSelector;
 import org.w3c.css.selectors.DescendantSelector;
+import org.w3c.css.selectors.GeneralSiblingSelector;
 import org.w3c.css.selectors.IdSelector;
 import org.w3c.css.selectors.TypeSelector;
 import org.w3c.css.selectors.UniversalSelector;
@@ -1282,11 +1283,14 @@
 		}
 		switch(comb) {
 		case '+': 
-		current.addAdjacent(new AdjacentSelector());
+		current.addAdjacentSibling(new AdjacentSiblingSelector());
 		break;
 		case '>':
 		current.addChild(new ChildSelector());
 		break;
+		case '~':
+		current.addGeneralSibling(new GeneralSiblingSelector());
+		break;
 		default:
 		current.addDescendant(new DescendantSelector());
 		}                  
@@ -1572,33 +1576,33 @@
 CssSelectors param = null;
 }
 {
-  <PSEUDOCLASS_SYM> ( ( n=<IDENT>
-	  { 
-		try {
-			if (ac.getCssVersion().equals("css3")) {
-				s.addPseudo(convertIdent(n.image).toLowerCase());
-			} else {
-			 	throw new InvalidParamException("pseudo-element", ":" + convertIdent(n.image).toLowerCase() ,
-			 		ac.getCssVersion() ,ac);
-			}
-		} catch(InvalidParamException e) {
-		     //e.printStackTrace();	
-		     removeThisRule();
-		     ac.getFrame().addError(new CssError(e));
+    <PSEUDOCLASS_SYM> ( ( n=<IDENT>
+	{ 
+	    try {
+		if (ac.getCssVersion().equals("css3")) {
+		    s.addPseudoElement(convertIdent(n.image).toLowerCase());
+		} else {
+		    throw new InvalidParamException("pseudo-element", "::" + convertIdent(n.image).toLowerCase() ,
+						    ac.getCssVersion() ,ac);
 		}
-	  } ) )
+	    } catch(InvalidParamException e) {
+		//e.printStackTrace();	
+		removeThisRule();
+		ac.getFrame().addError(new CssError(e));
+	    }
+	} ) )
 	|  
-  <COLON> ( ( n=<IDENT>
-	  { 
+	<COLON> ( ( n=<IDENT>
+	    { 
 		try {
-		     s.addPseudo(convertIdent(n.image).toLowerCase());
+		    s.addPseudoClass(convertIdent(n.image).toLowerCase());
 		} catch(InvalidParamException e) {
-		     //e.printStackTrace();	
-		     removeThisRule();
-		     ac.getFrame().addError(new CssError(e));
+		    //e.printStackTrace();	
+		    removeThisRule();
+		    ac.getFrame().addError(new CssError(e));
 		}
-	  } )
-	// FXIXME rewrite to make :lang( use a special case
+	    } )
+		  // FXIXME rewrite to make :lang( use a special case
 	| ( ( n=<FUNCTIONLANG> ( <S> )* (language=<NUMBER> | language=<IDENT> | language=<STRING> ) ) {
 		try {
 		    s.setPseudoFun(convertStringIndex(n.image, 0,
@@ -1926,14 +1930,10 @@
 {Token n; 
 }
 {
- n=<HASHIDENT> { 
+    ( n=<HASHIDENT> | n=<HASH> ) { 
      n.image = Util.strip(n.image);
      setValue(new org.w3c.css.values.CssColor(), exp, ' ', n, HASH); 
- }
- |n=<HASH> { 
-     n.image = Util.strip(n.image);
-     setValue(new org.w3c.css.values.CssColor(), exp, ' ', n, HASH);
- }
+    }
 }
 
 /*
Received on Thursday, 12 February 2009 10:33:03 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 26 April 2012 12:55:08 GMT