W3C home > Mailing lists > Public > www-validator-cvs@w3.org > October 2011

2002/css-validator/org/w3c/css/parser/analyzer CssParser.java,1.78,1.79 CssParser.jj,1.77,1.78

From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
Date: Fri, 21 Oct 2011 12:52:32 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1RHEaO-0006Zt-10@lionel-hutz.w3.org>
Update of /sources/public/2002/css-validator/org/w3c/css/parser/analyzer
In directory hutz:/tmp/cvs-serv25180/css/parser/analyzer

Modified Files:
	CssParser.java CssParser.jj 
Log Message:
parsing of mediaquerylist for html links is now done reusing the same logic (parsing mediaquerylist form the parser, using a String Reader), so that should finish media queries per http://www.w3.org/TR/2010/CR-css3-mediaqueries-20100727/

Index: CssParser.jj
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/parser/analyzer/CssParser.jj,v
retrieving revision 1.77
retrieving revision 1.78
diff -u -d -r1.77 -r1.78
--- CssParser.jj	21 Oct 2011 01:49:09 -0000	1.77
+++ CssParser.jj	21 Oct 2011 12:52:29 -0000	1.78
@@ -284,7 +284,8 @@
      *
      * @see              org.w3c.css.css.CssProperty
      */
-    public abstract MediaFeature handleMediaFeature(String mediaFeature,
+    public abstract MediaFeature handleMediaFeature(AtRuleMedia rule,
+                                                    String mediaFeature,
 						                            CssExpression expr)
 	       throws InvalidParamException;
 
@@ -335,9 +336,17 @@
      * Return the next selector from the inputstream
      */    
     public CssSelectors parseSelector() throws ParseException {
-	return externalSelector();
+	    return externalSelector();
+    }
+
+    /**
+     * Return the next @media rule from the inputstream
+     */
+    public AtRuleMedia parseMediaDeclaration()  throws ParseException {
+        AtRuleMedia newRule = AtRuleMedia.getInstance(ac.getCssVersion());
+	    mediaquerylist(newRule);
+	    return newRule;
     }
-    
     /*
      * Add a value to an expression
      */
@@ -860,7 +869,7 @@
 /**
  * @exception ParseException exception during the parse
  */
-void media() :
+AtRuleMedia media() :
 {
     AtRule old = getAtRule();
     AtRuleMedia newRule = AtRuleMedia.getInstance(ac.getCssVersion());
@@ -899,8 +908,10 @@
 	    if (!isCss1) {
 	        addError(e, skipStatement());
 	    }
+	    newRule = null;
 	} finally {
 	    setAtRule(old);
+	    return newRule;
     }
 }
 
@@ -951,7 +962,7 @@
     ( <S> )*
     ( <COLON> ( <S> )* val=expr() )?
     <LPARAN>  ( <S> )*  {
-        MediaFeature mf = handleMediaFeature(mediaFeatureName, val);
+        MediaFeature mf = handleMediaFeature(mediaRule, mediaFeatureName, val);
         mediaRule.addMediaFeature(mf, ac);
     }
 }

Index: CssParser.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/parser/analyzer/CssParser.java,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -d -r1.78 -r1.79
--- CssParser.java	21 Oct 2011 01:49:09 -0000	1.78
+++ CssParser.java	21 Oct 2011 12:52:29 -0000	1.79
@@ -264,7 +264,8 @@
      *
      * @see              org.w3c.css.css.CssProperty
      */
-    public abstract MediaFeature handleMediaFeature(String mediaFeature,
+    public abstract MediaFeature handleMediaFeature(AtRuleMedia rule,
+                                                    String mediaFeature,
                                                                             CssExpression expr)
                throws InvalidParamException;
 
@@ -315,9 +316,17 @@
      * Return the next selector from the inputstream
      */
     public CssSelectors parseSelector() throws ParseException {
-        return externalSelector();
+            return externalSelector();
     }
 
+    /**
+     * Return the next @media rule from the inputstream
+     */
+    public AtRuleMedia parseMediaDeclaration()  throws ParseException {
+        AtRuleMedia newRule = AtRuleMedia.getInstance(ac.getCssVersion());
+            mediaquerylist(newRule);
+            return newRule;
+    }
     /*
      * Add a value to an expression
      */
@@ -887,7 +896,7 @@
 /**
  * @exception ParseException exception during the parse
  */
-  final public void media() throws ParseException {
+  final public AtRuleMedia media() throws ParseException {
     AtRule old = getAtRule();
     AtRuleMedia newRule = AtRuleMedia.getInstance(ac.getCssVersion());
     setAtRule(newRule);
@@ -985,9 +994,12 @@
             if (!isCss1) {
                 addError(e, skipStatement());
             }
+            newRule = null;
     } finally {
             setAtRule(old);
+            {if (true) return newRule;}
     }
+    throw new Error("Missing return statement in function");
   }
 
   final public void mediaquerylist(AtRuleMedia mediaRule) throws ParseException {
@@ -1197,7 +1209,7 @@
       }
       jj_consume_token(S);
     }
-        MediaFeature mf = handleMediaFeature(mediaFeatureName, val);
+        MediaFeature mf = handleMediaFeature(mediaRule, mediaFeatureName, val);
         mediaRule.addMediaFeature(mf, ac);
   }
 
Received on Friday, 21 October 2011 12:52:33 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:17:47 UTC