2002/css-validator/org/w3c/css/parser/analyzer CssParser.java,1.75,1.76 CssParser.jj,1.75,1.76

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

Modified Files:
	CssParser.java CssParser.jj 
Log Message:
getting rid of multiple classes for Color value

Index: CssParser.jj
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/parser/analyzer/CssParser.jj,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -d -r1.75 -r1.76
--- CssParser.jj	14 Sep 2011 16:31:49 -0000	1.75
+++ CssParser.jj	29 Sep 2011 09:08:58 -0000	1.76
@@ -2132,24 +2132,18 @@
 {Token n;
  CssExpression exp;
  org.w3c.css.values.CssColor color = new org.w3c.css.values.CssColor();
- org.w3c.css.values.ATSCColor colorATSC = new org.w3c.css.values.ATSCColor();
 }
 {
     n=<FUNCTION> ( <S> )* exp=expr() 
     ")" { 
 	String funcname = n.image.toLowerCase();
 	if (funcname.equals("rgb(")) {
-	    if (!getAtRule().toString().equals("@media atsc-tv")) {
-	       color.setRGBColor(exp, ac);
-	       return color;
-            } else {
-	       colorATSC.setRGBColor(exp, ac);
-	       return colorATSC;
-            }
+	    color.setRGBColor(exp, ac);
+	    return color;
 	} else if (n.image.toLowerCase().equals("atsc-rgba(")) {
 	    if (getAtRule().toString().equals("@media atsc-tv")) {
-	        colorATSC.setATSCrgba(exp, ac);
-	        return colorATSC;
+	        color.setATSCRGBAColor(exp, ac);
+	        return color;
 	    } else {
 		addError(new InvalidParamException("onlyATSC", "", ac),
 						 getAtRule().toString());

Index: CssParser.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/parser/analyzer/CssParser.java,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -d -r1.75 -r1.76
--- CssParser.java	17 Sep 2011 06:02:26 -0000	1.75
+++ CssParser.java	29 Sep 2011 09:08:58 -0000	1.76
@@ -1,49 +1,17 @@
 /* Generated By:JavaCC: Do not edit this line. CssParser.java */
 package org.w3c.css.parser.analyzer;
 
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.UnsupportedEncodingException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.net.URL;
-
-import org.w3c.css.values.CssValue;
-import org.w3c.css.values.CssExpression;
-import org.w3c.css.values.CssString;
-import org.w3c.css.values.CssURL;
-import org.w3c.css.values.CssLength;
-import org.w3c.css.values.CssNumber;
-import org.w3c.css.values.CssColor;
-import org.w3c.css.values.CssIdent;
-import org.w3c.css.values.CssPercentage;
-import org.w3c.css.values.CssFrequency;
-import org.w3c.css.values.CssTime;
-import org.w3c.css.values.CssDate;
-import org.w3c.css.values.CssAngle;
-import org.w3c.css.values.CssFunction;
-import org.w3c.css.values.CssUnicodeRange;
-import org.w3c.css.values.CssResolution;
-import org.w3c.css.properties.css.CssProperty;
-import org.w3c.css.parser.Frame;
-import org.w3c.css.parser.CssError;
-import org.w3c.css.parser.CssSelectors;
-import org.w3c.css.parser.CssParseException;
 import org.w3c.css.parser.AtRule;
-import org.w3c.css.parser.AtRuleMedia;
 import org.w3c.css.parser.AtRuleFontFace;
+import org.w3c.css.parser.AtRuleMedia;
 import org.w3c.css.parser.AtRulePage;
-import org.w3c.css.parser.AtRulePreference;
 import org.w3c.css.parser.AtRulePhoneticAlphabet;
+import org.w3c.css.parser.AtRulePreference;
+import org.w3c.css.parser.CssError;
+import org.w3c.css.parser.CssParseException;
+import org.w3c.css.parser.CssSelectors;
+import org.w3c.css.properties.css.CssProperty;
 import org.w3c.css.properties.svg.AtRuleColorProfile;
-import org.w3c.css.util.ApplContext;
-import org.w3c.css.util.CssProfile;
-import org.w3c.css.util.CssVersion;
-import org.w3c.css.util.InvalidParamException;
-import org.w3c.css.util.WarningParamException;
-import org.w3c.css.util.Util;
-import org.w3c.css.util.Messages;
-
 import org.w3c.css.selectors.AdjacentSiblingSelector;
 import org.w3c.css.selectors.AttributeSelector;
 import org.w3c.css.selectors.ChildSelector;
@@ -60,6 +28,34 @@
 import org.w3c.css.selectors.attributes.AttributeStart;
 import org.w3c.css.selectors.attributes.AttributeSubstr;
 import org.w3c.css.selectors.attributes.AttributeSuffix;
+import org.w3c.css.util.ApplContext;
+import org.w3c.css.util.CssProfile;
+import org.w3c.css.util.CssVersion;
+import org.w3c.css.util.InvalidParamException;
+import org.w3c.css.util.Util;
+import org.w3c.css.util.WarningParamException;
+import org.w3c.css.values.CssAngle;
+import org.w3c.css.values.CssDate;
+import org.w3c.css.values.CssExpression;
+import org.w3c.css.values.CssFrequency;
+import org.w3c.css.values.CssFunction;
+import org.w3c.css.values.CssIdent;
+import org.w3c.css.values.CssLength;
+import org.w3c.css.values.CssNumber;
+import org.w3c.css.values.CssPercentage;
+import org.w3c.css.values.CssResolution;
+import org.w3c.css.values.CssString;
+import org.w3c.css.values.CssTime;
+import org.w3c.css.values.CssURL;
+import org.w3c.css.values.CssUnicodeRange;
+import org.w3c.css.values.CssValue;
+
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.UnsupportedEncodingException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Iterator;
 
 /**
  * A CSS3 parser  
@@ -137,7 +133,7 @@
     /**
      * Set the attribute mediaDeclaration
      *
-     * @param mediaDeclaration indicator if in a media expression list or not
+     * @param mediadeclaration indicator if in a media expression list or not
      */
     public void setMediaDeclaration(String mediadeclaration) {
         this.mediaDeclaration = mediadeclaration;
@@ -214,7 +210,7 @@
      *
      * @param ident  The ident for this at-rule (for example: 'font-face')
      * @param string The string associate to this at-rule
-     * @see          org.w3c.css.parser.Analyzer.Couple
+     * @see          Couple
      */
     public abstract void handleAtRule(String ident, String string);
 
@@ -242,7 +238,7 @@
      *
      * @return           <code>null</code>or a property
      * 
-     * @see              org.w3c.css.css.CssProperty
+     * @see              CssProperty
      */
     public abstract CssProperty handleDeclaration(String property,
                                                   CssExpression values,
@@ -280,7 +276,7 @@
     /**
      * Set the URL of the style sheet.
      *
-     * @param URL The URL for the style sheet
+     * @param url The URL for the style sheet
      */
     public final void setURL(URL url) {
         this.url = url;
@@ -541,7 +537,7 @@
                          (space1Token.specialToken != null) ||
                          (n.specialToken != null) ||
                          (semicolonToken.specialToken != null) ||
-                         (n.image.charAt(0) != '\u005c"')
+                         (n.image.charAt(0) != '"')
                         ) {
                         {if (true) throw new ParseException(ac.getMsg().getString(
                                                      "parser.charsetspecial"));}
@@ -730,7 +726,7 @@
               ((CssURL) val).set(v.image, ac, url);
               nsname = (String) val.get();
               if ((nsname.charAt(0) == '"')
-                  || (nsname.charAt(0) == '\u005c'')) {
+                  || (nsname.charAt(0) == '\'')) {
                   nsname = nsname.substring(1, nsname.length()-1);
               }
       break;
@@ -812,7 +808,7 @@
                 ((CssURL) val).set(n.image, ac, url);
                 importFile = (String) val.get();
                 if ((importFile.charAt(0) == '"')
-                    || (importFile.charAt(0) == '\u005c'')) {
+                    || (importFile.charAt(0) == '\'')) {
                     importFile = importFile.substring(1, importFile.length()-1);
                 }
                 is_url = true;
@@ -2451,9 +2447,9 @@
         if (p != null) {
             // FIXME should be > CSS3
             if (ac.getCssVersion().compareTo(CssVersion.CSS3) < 0) {
-                StringBuilder sb = new StringBuilder("namespace \u005c"");
+                StringBuilder sb = new StringBuilder("namespace \"");
                 if (n != null) sb.append(n.toString());
-                sb.append("\u005c"");
+                sb.append('\"');
                 ac.getFrame().addError(new CssError(new
                                           InvalidParamException("notversion",
                                                                 "namespace",
@@ -2465,8 +2461,8 @@
                 if (!ac.isNamespaceDefined(getURL(), prefix)) {
                     // ns is not defined
                     addError(new ParseException("Undefined namespace"),
-                             ": The namespace \u005c""+prefix
-                             +"\u005c" is not defined. "
+                             ": The namespace \""+prefix
+                             +"\" is not defined. "
                              + prefix );
                     removeThisRule();
                 }
@@ -2902,9 +2898,9 @@
 
               addError(new ParseException(ac.getMsg().getString(
                 "parser.old_id")),
-                "To make \u005c"." + n.image + "\u005c" a valid id, CSS2" +
+                "To make \"." + n.image + "\" a valid id, CSS2" +
                 " requires the first digit to be escaped " +
-                "(\u005c"#" + cl + "\u005c")");
+                "(\"#" + cl + "\")");
               // for css > 1, we add the rule to have a context, 
               // and we then remove it
               s.addId(new IdSelector(n.image));
@@ -3422,7 +3418,6 @@
  Token n;
  CssExpression exp;
  org.w3c.css.values.CssColor color = new org.w3c.css.values.CssColor();
- org.w3c.css.values.ATSCColor colorATSC = new org.w3c.css.values.ATSCColor();
     n = jj_consume_token(FUNCTION);
     label_85:
     while (true) {
@@ -3440,17 +3435,12 @@
     jj_consume_token(LPARAN);
         String funcname = n.image.toLowerCase();
         if (funcname.equals("rgb(")) {
-            if (!getAtRule().toString().equals("@media atsc-tv")) {
-               color.setRGBColor(exp, ac);
-               {if (true) return color;}
-            } else {
-               colorATSC.setRGBColor(exp, ac);
-               {if (true) return colorATSC;}
-            }
+            color.setRGBColor(exp, ac);
+            {if (true) return color;}
         } else if (n.image.toLowerCase().equals("atsc-rgba(")) {
             if (getAtRule().toString().equals("@media atsc-tv")) {
-                colorATSC.setATSCrgba(exp, ac);
-                {if (true) return colorATSC;}
+                color.setATSCRGBAColor(exp, ac);
+                {if (true) return color;}
             } else {
                 addError(new InvalidParamException("onlyATSC", "", ac),
                                                  getAtRule().toString());
@@ -3615,14 +3605,14 @@
     int index = start;
     int t;
     int maxCount = 0;
-    if ((start == 0) && (len == s.length()) && (s.indexOf('\u005c\u005c') == -1)) {
+    if ((start == 0) && (len == s.length()) && (s.indexOf('\\') == -1)) {
         return s;
     }
     StringBuilder buf = new StringBuilder(len);
 
     while (index < len) {
         char c = s.charAt(index);
-        if (c == '\u005c\u005c') {
+        if (c == '\\') {
             if (++index < len) {
                 c = s.charAt(index);
                 switch (c) {
@@ -3643,15 +3633,15 @@
                             numValue = (numValue<<4) | t;
                             index++;
                         } else {
-                            if (c == ' ' || c == '\u005ct' ||
-                                c == '\u005cn' || c == '\u005cf' ) {
+                            if (c == ' ' || c == '\t' ||
+                                c == '\n' || c == '\f' ) {
                                 // skip the latest white space
                                 index++;
-                            } else if ( c == '\u005cr' ) {
+                            } else if ( c == '\r' ) {
                                 index++;
                                 // special case for \r\n
                                 if (index+1 < len) {
-                                    if (s.charAt(index + 1) == '\u005cn') {
+                                    if (s.charAt(index + 1) == '\n') {
                                         index++;
                                     }
                                 }
@@ -3667,7 +3657,7 @@
                                 || (numValue == 45) // -
                                 )
                             ) {
-                            buf.append('\u005c\u005c');
+                            buf.append('\\');
                         }
                         buf.append((char) numValue);
                         break;
@@ -3678,14 +3668,14 @@
                         b[--t] = hexdigits[numValue & 0xF];
                         numValue >>>= 4;
                     }
-                    buf.append('\u005c\u005c').append(b);
+                    buf.append('\\').append(b);
                     break;
-                case '\u005cn':
-                case '\u005cf':
+                case '\n':
+                case '\f':
                     break;
-                case '\u005cr':
+                case '\r':
                     if (index + 1 < len) {
-                        if (s.charAt(index + 1) == '\u005cn') {
+                        if (s.charAt(index + 1) == '\n') {
                             index ++;
                         }
                     }
@@ -3704,7 +3694,7 @@
                     buf.append(c);
                     break;
                 default:
-                    buf.append('\u005c\u005c').append(c);
+                    buf.append('\\').append(c);
                 }
             } else {
                 throw new ParseException("invalid string");
@@ -3732,7 +3722,7 @@
 
   String hexEscapeFirst(String s) throws ParseException {
     StringBuilder sb = new StringBuilder();
-    sb.append('\u005c\u005c').append(Integer.toString(s.charAt(0), 16));
+    sb.append('\\').append(Integer.toString(s.charAt(0), 16));
     char c = s.charAt(1);
     if (((c >= '0') && (c <= '9')) ||
         ((c >= 'A') && (c <= 'F')) ||

Received on Thursday, 29 September 2011 09:09:02 UTC