2002/css-validator/org/w3c/css/parser/analyzer CssParser.java,1.56,1.57 CssParser.jj,1.56,1.57

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

Modified Files:
	CssParser.java CssParser.jj 
Log Message:
More namespace support

Index: CssParser.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/parser/analyzer/CssParser.java,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -d -r1.56 -r1.57
--- CssParser.java	14 Feb 2009 09:40:55 -0000	1.56
+++ CssParser.java	16 Feb 2009 12:16:34 -0000	1.57
@@ -541,7 +541,6 @@
     }
   }
 
-/* Modified by Sijtsche Smeman, preference, colorprofile and phoneticAlphabet added for CSS3 */
   final public void afterImportDeclaration() throws ParseException {
  String ret;
     label_7:
@@ -2379,15 +2378,30 @@
       ;
     }
         // FIXME namespace, check versions of CSS in a better way.
-        if (!ac.getCssVersion().equals("css3") && (p!=null)) {
-            StringBuilder sb = new StringBuilder("namespace \"");
-            if (n != null) sb.append(n.toString());
-            sb.append("\"");
-            ac.getFrame().addError(new CssError(new InvalidParamException("notversion",
-                                                                          "namespace",
-                                                                  ac.getCssVersion(), ac)));
+        if (p != null) {
+            if (!ac.getCssVersion().equals("css3")) {
+                StringBuilder sb = new StringBuilder("namespace \"");
+                if (n != null) sb.append(n.toString());
+                sb.append("\"");
+                ac.getFrame().addError(new CssError(new
+                                          InvalidParamException("notversion",
+                                                                "namespace",
+                                                            ac.getCssVersion(),
+                                                                ac)));
             //	    addError(new ParseException("namespace"), sb.toString());
-            skipStatement();
+                //		ignoreStatement();
+            } else if (n!=null) {
+                String nsprefix = convertIdent(n.image);
+                if (!ac.isNamespaceDefined(getURL(), nsprefix)) {
+                    // ns is not defined
+                    addError(new ParseException("Undefined namespace"),
+                             ": The namespace \""+nsprefix
+                             +"\" is not defined. "
+                             + nsprefix );
+                    ignoreStatement();
+                    //		skipStatement();
+                }
+            }
         }
     switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
     case IDENT:

Index: CssParser.jj
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/parser/analyzer/CssParser.jj,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -d -r1.56 -r1.57
--- CssParser.jj	14 Feb 2009 09:40:55 -0000	1.56
+++ CssParser.jj	16 Feb 2009 12:16:34 -0000	1.57
@@ -11,7 +11,7 @@
     IGNORE_CASE  = true;
     STATIC = false;
     UNICODE_INPUT = true;
-    /*    
+    /*        
           DEBUG_TOKEN_MANAGER = true; 
 	  DEBUG_PARSER = true;      
     */
@@ -698,7 +698,6 @@
     }
 }
 
-/* Modified by Sijtsche Smeman, preference, colorprofile and phoneticAlphabet added for CSS3 */
 void afterImportDeclaration() :
 {String ret; }
 {
@@ -1575,15 +1574,30 @@
 {
     ( LOOKAHEAD(2) (n=<IDENT> | n=<ANY>)? p="|" )? {
 	// FIXME namespace, check versions of CSS in a better way.
-	if (!ac.getCssVersion().equals("css3") && (p!=null)) {
-	    StringBuilder sb = new StringBuilder("namespace \"");
-	    if (n != null) sb.append(n.toString());
-	    sb.append("\"");
-	    ac.getFrame().addError(new CssError(new InvalidParamException("notversion",
-									  "namespace",
-								  ac.getCssVersion(), ac)));
+	if (p != null) {
+	    if (!ac.getCssVersion().equals("css3")) {
+		StringBuilder sb = new StringBuilder("namespace \"");
+		if (n != null) sb.append(n.toString());
+		sb.append("\"");
+		ac.getFrame().addError(new CssError(new 
+					  InvalidParamException("notversion",
+								"namespace",
+							    ac.getCssVersion(),
+								ac)));
 	    //	    addError(new ParseException("namespace"), sb.toString());
-	    skipStatement();
+		//		ignoreStatement();
+	    } else if (n!=null) {
+		String nsprefix = convertIdent(n.image);
+		if (!ac.isNamespaceDefined(getURL(), nsprefix)) {
+		    // ns is not defined
+		    addError(new ParseException("Undefined namespace"), 
+			     ": The namespace \""+nsprefix
+			     +"\" is not defined. "
+			     + nsprefix );
+		    ignoreStatement();
+		    //		skipStatement();
+		}
+	    }
 	}
     }
     ( n=<IDENT> { //              s.setElement(convertIdent(n.image), ac);

Received on Monday, 16 February 2009 12:16:54 UTC