- From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
- Date: Fri, 13 Feb 2009 14:03:38 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/2002/css-validator/org/w3c/css/parser In directory hutz:/tmp/cvs-serv5722/org/w3c/css/parser Modified Files: AtRule.java CssFouffa.java Added Files: AtRuleNamespace.java AtRuleImport.java Log Message: Imports are now printed in the output Namespace handling, they are now printed in the output, next step is to add them to the context to be checked when a definition using them matches. --- NEW FILE: AtRuleNamespace.java --- // // $Id: AtRuleNamespace.java,v 1.1 2009/02/13 14:03:36 ylafon Exp $ // // (c) COPYRIGHT MIT, Keio University and ERCIM, 2009. // Please first read the full copyright statement in file COPYRIGHT.html /* * AtRuleMedia.java * $Id: AtRuleNamespace.java,v 1.1 2009/02/13 14:03:36 ylafon Exp $ */ package org.w3c.css.parser; /** * This class manages all imports * * @version $Revision: 1.1 $ * @author Philippe Le Hegaret */ public class AtRuleNamespace extends AtRule { boolean is_default = false; boolean is_url = false; String prefix = null; String nsname = null; public String keyword() { return "namespace"; } public boolean isEmpty() { return true; } /** * The second must be exactly the same of this one */ public boolean canApply(AtRule atRule) { return false; } /** * The second must only match this one */ public boolean canMatched(AtRule atRule) { return false; } /** * Returns a string representation of the object. */ public String toString() { StringBuilder ret = new StringBuilder(); ret.append('@'); ret.append(keyword()); ret.append(' '); if (!is_default) { ret.append(prefix); ret.append(' '); } ret.append((is_url) ? "url(\"" : '\"'); ret.append(nsname); ret.append((is_url) ? "\")" : '\"'); ret.append(';'); return ret.toString(); } public AtRuleNamespace(String prefix, String nsname, boolean is_url) { this.prefix = prefix; is_default = (prefix == null); this.nsname = nsname; this.is_url = is_url; } } Index: AtRule.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/parser/AtRule.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- AtRule.java 26 Nov 2007 05:07:17 -0000 1.4 +++ AtRule.java 13 Feb 2009 14:03:36 -0000 1.5 @@ -32,6 +32,6 @@ public abstract boolean canMatched(AtRule atRule); public boolean isEmpty() { - return false; - } + return false; + } } Index: CssFouffa.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/parser/CssFouffa.java,v retrieving revision 1.45 retrieving revision 1.46 diff -u -d -r1.45 -r1.46 --- CssFouffa.java 12 Feb 2009 21:26:34 -0000 1.45 +++ CssFouffa.java 13 Feb 2009 14:03:36 -0000 1.46 @@ -396,6 +396,21 @@ } /** + * Call the namespace declaration statement + * @param url, the style sheet where this declaration statement appears. + * @param prefix, the namespace prefix + * @param nsname, the file/url name in the declaration statement + * @param is_url, if the nsname is a file or an url + */ + public void handleNamespaceDeclaration(URL url, String prefix, + String nsname, + boolean is_url) { + AtRuleNamespace nsrule = new AtRuleNamespace(prefix, nsname, is_url); + newAtRule(nsrule); + endOfAtRule(); + // FIXME add in the NS declaration for the document + } + /** * Call by the import statement. * * @param url @@ -403,8 +418,12 @@ * @param file * the file name in the import statement */ - public void handleImport(URL url, String file, AtRuleMedia media) { + public void handleImport(URL url, String file, boolean is_url, + AtRuleMedia media) { // CssError cssError = null; + AtRuleImport importrule = new AtRuleImport(file, is_url, media); + newAtRule(importrule); + endOfAtRule(); //if it's not permitted to import... (direct input) if (url.getProtocol().equals("file")) { --- NEW FILE: AtRuleImport.java --- // // $Id: AtRuleImport.java,v 1.1 2009/02/13 14:03:36 ylafon Exp $ // // (c) COPYRIGHT MIT, Keio University and ERCIM, 2009. // Please first read the full copyright statement in file COPYRIGHT.html /* * AtRuleMedia.java * $Id: AtRuleImport.java,v 1.1 2009/02/13 14:03:36 ylafon Exp $ */ package org.w3c.css.parser; import java.net.URL; /** * This class manages all imports * * @version $Revision: 1.1 $ * @author Philippe Le Hegaret */ public class AtRuleImport extends AtRule { boolean is_url = false; String linkname = null; AtRuleMedia media = null; public String keyword() { return "import"; } public boolean isEmpty() { return true; } /** * The second must be exactly the same of this one */ public boolean canApply(AtRule atRule) { return false; } /** * The second must only match this one */ public boolean canMatched(AtRule atRule) { return false; } /** * Returns a string representation of the object. */ public String toString() { StringBuilder ret = new StringBuilder(); ret.append('@'); ret.append(keyword()); ret.append(' '); if (is_url) { ret.append("url(\'"); ret.append(linkname); ret.append("\')"); } else { ret.append('\"'); ret.append(linkname); ret.append('\"'); } if (media != null && !media.isEmpty()) { ret.append(' '); ret.append(media.getValueString()); } ret.append(';'); return ret.toString(); } public AtRuleImport(String linkname, boolean is_url, AtRuleMedia media) { this.media = media; this.linkname = linkname; this.is_url = is_url; } }
Received on Friday, 13 February 2009 14:03:46 UTC