- From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
- Date: Mon, 16 Feb 2009 17:53:41 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/2002/css-validator/org/w3c/css/parser/analyzer In directory hutz:/tmp/cvs-serv1973/org/w3c/css/parser/analyzer Modified Files: CssParser.jj Log Message: Support for namespaces finished Index: CssParser.jj =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/parser/analyzer/CssParser.jj,v retrieving revision 1.57 retrieving revision 1.58 diff -u -d -r1.57 -r1.58 --- CssParser.jj 16 Feb 2009 12:16:34 -0000 1.57 +++ CssParser.jj 16 Feb 2009 17:53:39 -0000 1.58 @@ -765,7 +765,7 @@ ) { if (!ac.getCssVersion().equals("css3")) { addError(new InvalidParamException("at-rule", "@namespace", ac), - n.toString()); + (n==null)?"default":n.toString()); } else { if (v != null) { handleNamespaceDeclaration(getURL(), prefix, nsname, is_url); @@ -1407,7 +1407,8 @@ Token t = getToken(1); StringBuffer s = new StringBuffer(); s.append(getToken(0).image); - while ((t.kind != COMMA) && (t.kind != LBRACE) && (t.kind != EOF)) { + while ((t.kind != COMMA) && (t.kind != LBRACE) && + (t.kind != EOF)) { s.append(t.image); getNextToken(); t = getToken(1); @@ -1569,8 +1570,11 @@ * @exception ParseException exception during the parse */ void element_name(CssSelectors s) : -{Token n=null; - Token p=null; } +{ + Token n=null; + Token p=null; + String prefix = null; +} { ( LOOKAHEAD(2) (n=<IDENT> | n=<ANY>)? p="|" )? { // FIXME namespace, check versions of CSS in a better way. @@ -1587,25 +1591,27 @@ // addError(new ParseException("namespace"), sb.toString()); // ignoreStatement(); } else if (n!=null) { - String nsprefix = convertIdent(n.image); - if (!ac.isNamespaceDefined(getURL(), nsprefix)) { + prefix = convertIdent(n.image); + if (!ac.isNamespaceDefined(getURL(), prefix)) { // ns is not defined addError(new ParseException("Undefined namespace"), - ": The namespace \""+nsprefix + ": The namespace \""+prefix +"\" is not defined. " - + nsprefix ); - ignoreStatement(); - // skipStatement(); + + prefix ); + removeThisRule(); } + } else { + prefix = ""; } } } ( n=<IDENT> { // s.setElement(convertIdent(n.image), ac); - s.addType(new TypeSelector(convertIdent(n.image)));} + s.addType(new TypeSelector(prefix, convertIdent(n.image))); + } | <ANY> { if (!ac.getCssVersion().equals("css1")) { // s.setElement(null); - s.addUniversal(new UniversalSelector()); + s.addUniversal(new UniversalSelector(prefix)); } else { ac.getFrame().addError(new CssError(new InvalidParamException("notversion", "*", ac.getCssVersion(), ac)));
Received on Monday, 16 February 2009 17:53:56 UTC