- From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
- Date: Mon, 29 Aug 2011 07:21:03 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/2002/css-validator/org/w3c/css/parser/analyzer In directory hutz:/tmp/cvs-serv18238/css/parser/analyzer Modified Files: CssParser.java CssParser.jj CssParserTokenManager.java Log Message: genericity + updated code to 5.0 stds Index: CssParserTokenManager.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/parser/analyzer/CssParserTokenManager.java,v retrieving revision 1.36 retrieving revision 1.37 diff -u -d -r1.36 -r1.37 --- CssParserTokenManager.java 12 Jan 2011 15:01:56 -0000 1.36 +++ CssParserTokenManager.java 29 Aug 2011 07:21:01 -0000 1.37 @@ -3,8 +3,8 @@ import java.io.InputStream; import java.io.InputStreamReader; import java.io.UnsupportedEncodingException; -import java.util.Vector; -import java.util.Enumeration; +import java.util.ArrayList; +import java.util.Iterator; import java.net.URL; import org.w3c.css.values.CssValue; import org.w3c.css.values.CssExpression; Index: CssParser.jj =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/parser/analyzer/CssParser.jj,v retrieving revision 1.72 retrieving revision 1.73 diff -u -d -r1.72 -r1.73 --- CssParser.jj 12 Jan 2011 15:01:56 -0000 1.72 +++ CssParser.jj 29 Aug 2011 07:21:00 -0000 1.73 @@ -24,8 +24,8 @@ import java.io.InputStream; import java.io.InputStreamReader; import java.io.UnsupportedEncodingException; -import java.util.Vector; -import java.util.Enumeration; +import java.util.ArrayList; +import java.util.Iterator; import java.net.URL; import org.w3c.css.values.CssValue; @@ -108,7 +108,7 @@ /** * The current context recognized by the parser (for errors). */ - protected Vector currentContext; + protected ArrayList<CssSelectors> currentContext; /** * The current property recognized by the parser (for errors). @@ -242,8 +242,8 @@ public abstract void newAtRule(AtRule atRule); public abstract void endOfAtRule(); public abstract void setImportant(boolean important); - public abstract void setSelectorList(Vector selectors); - public abstract void addProperty(Vector properties); + public abstract void setSelectorList(ArrayList<CssSelectors> selectors); + public abstract void addProperty(ArrayList<CssProperty> properties); public abstract void endOfRule(); public abstract void removeThisRule(); public abstract void removeThisAtRule(); @@ -269,7 +269,7 @@ throws InvalidParamException; /** - * Adds a vector of properties to a selector. + * Adds a ArrayList of properties to a selector. * <p> * A subclass must provide an implementation of this method. * @@ -277,7 +277,7 @@ * @param declarations Properties to associate with contexts */ public abstract void handleRule(CssSelectors selector, - Vector declarations); + ArrayList<CssProperty> declarations); /*Added by Sijtsche Smeman */ @@ -932,9 +932,9 @@ */ void page() : { - Vector v ; + ArrayList<CssProperty> v ; Token n = null ; - Vector collectv = new Vector() ; + ArrayList<CssProperty> collectv = new ArrayList<CssProperty>() ; CssSelectors s = new CssSelectors(ac); AtRule old = getAtRule() ; AtRulePage newRule = new AtRulePage() ; @@ -985,9 +985,9 @@ } } -Vector pageContent() : +ArrayList<CssProperty> pageContent() : { CssProperty prop; - Vector v = new Vector(); + ArrayList<CssProperty> v = new ArrayList<CssProperty>(); } { // <CSS3> ?? FIXME @@ -997,9 +997,9 @@ v=declarations() { return v;} /* FIXME moved here as it can match empty string */ } -Vector prefAtRule() : +ArrayList<CssProperty> prefAtRule() : { Token n; - Vector v; + ArrayList<CssProperty> v; } { try { @@ -1030,7 +1030,7 @@ void fontFace() : { - Vector v; + ArrayList<CssProperty> v; AtRule old = getAtRule(); setAtRule(new AtRuleFontFace()); CssSelectors s = new CssSelectors(ac); @@ -1074,7 +1074,7 @@ void colorprofile() : { - Vector v; + ArrayList<CssProperty> v; AtRule old = getAtRule(); setAtRule(new AtRuleColorProfile()); CssSelectors s = new CssSelectors(ac); @@ -1121,7 +1121,7 @@ void preference() : { - Vector v; + ArrayList<CssProperty> v; AtRule old = getAtRule(); setAtRule(new AtRulePreference()); CssSelectors s = new CssSelectors(ac); @@ -1167,7 +1167,6 @@ void phoneticAlphabet() : { - Vector v; AtRule old = getAtRule(); AtRulePhoneticAlphabet alphabetrule = new AtRulePhoneticAlphabet(); setAtRule(alphabetrule); @@ -1271,8 +1270,8 @@ */ void ruleSet() : { CssSelectors contextual; - Vector<CssSelectors> context_set = new Vector<CssSelectors>(); - Vector<CssProperty> value_set = null; + ArrayList<CssSelectors> context_set = new ArrayList<CssSelectors>(); + ArrayList<CssProperty> value_set = null; currentContext = context_set; } { @@ -1280,7 +1279,7 @@ contextual=selector() { if (contextual != null) { - context_set.addElement(contextual); + context_set.add(contextual); } } @@ -1288,7 +1287,7 @@ contextual=selector() { if (contextual != null) { - context_set.addElement(contextual); + context_set.add(contextual); } } )* @@ -1307,9 +1306,9 @@ if (value_set != null) { boolean first = true; CssSelectors sel = null; - Enumeration<CssSelectors> e = context_set.elements(); - while (e.hasMoreElements()) { - sel = e.nextElement(); + Iterator<CssSelectors> e = context_set.iterator(); + while (e.hasNext()) { + sel = e.next(); if (first) { handleRule(sel, value_set); first = false; @@ -1318,9 +1317,9 @@ // as property holds reference to the selectors and it interact // badly with conflict detection int vsize = value_set.size(); - Vector<CssProperty> v = new Vector<CssProperty>(vsize); + ArrayList<CssProperty> v = new ArrayList<CssProperty>(vsize); for (int i=0; i<vsize; i++) { - v.addElement(value_set.elementAt(i).duplicate()); + v.add(value_set.get(i).duplicate()); } handleRule(sel, v); } @@ -1341,7 +1340,7 @@ } } -Vector<CssProperty> declarations() : +ArrayList<CssProperty> declarations() : { if(!validSelector) { validSelector = true; @@ -1350,13 +1349,13 @@ } CssProperty values; - Vector<CssProperty> value_set = new Vector<CssProperty>(); + ArrayList<CssProperty> value_set = new ArrayList<CssProperty>(); boolean wrong_value = true; } { ( values=declaration() { if (values != null) { - value_set.addElement(values); + value_set.add(values); wrong_value = false; } /* else { wrong_value = true; @@ -1367,7 +1366,7 @@ ( ";" ( <S> )* ( values=declaration() { if (values != null) { - value_set.addElement(values); + value_set.add(values); wrong_value = false; }/* else { wrong_value = true; @@ -1542,7 +1541,7 @@ if(!profile.equals("css1")) { StringBuilder sb = new StringBuilder(); - Vector<String> param_err = new Vector<String>(2); + ArrayList<String> param_err = new ArrayList<String>(2); param_err.add(n.image); param_err.add(cl); sb.append(ac.getMsg().getString("parser.old_class", param_err)); Index: CssParser.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/parser/analyzer/CssParser.java,v retrieving revision 1.71 retrieving revision 1.72 diff -u -d -r1.71 -r1.72 --- CssParser.java 12 Jan 2011 15:01:56 -0000 1.71 +++ CssParser.java 29 Aug 2011 07:21:00 -0000 1.72 @@ -4,8 +4,8 @@ import java.io.InputStream; import java.io.InputStreamReader; import java.io.UnsupportedEncodingException; -import java.util.Vector; -import java.util.Enumeration; +import java.util.ArrayList; +import java.util.Iterator; import java.net.URL; import org.w3c.css.values.CssValue; @@ -88,7 +88,7 @@ /** * The current context recognized by the parser (for errors). */ - protected Vector currentContext; + protected ArrayList<CssSelectors> currentContext; /** * The current property recognized by the parser (for errors). @@ -136,7 +136,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; @@ -222,8 +222,8 @@ public abstract void newAtRule(AtRule atRule); public abstract void endOfAtRule(); public abstract void setImportant(boolean important); - public abstract void setSelectorList(Vector selectors); - public abstract void addProperty(Vector properties); + public abstract void setSelectorList(ArrayList<CssSelectors> selectors); + public abstract void addProperty(ArrayList<CssProperty> properties); public abstract void endOfRule(); public abstract void removeThisRule(); public abstract void removeThisAtRule(); @@ -249,7 +249,7 @@ throws InvalidParamException; /** - * Adds a vector of properties to a selector. + * Adds a ArrayList of properties to a selector. * <p> * A subclass must provide an implementation of this method. * @@ -257,7 +257,7 @@ * @param declarations Properties to associate with contexts */ public abstract void handleRule(CssSelectors selector, - Vector declarations); + ArrayList<CssProperty> declarations); /*Added by Sijtsche Smeman */ @@ -1157,9 +1157,9 @@ * @exception ParseException exception during the parse */ final public void page() throws ParseException { - Vector v ; + ArrayList<CssProperty> v ; Token n = null ; - Vector collectv = new Vector() ; + ArrayList<CssProperty> collectv = new ArrayList<CssProperty>() ; CssSelectors s = new CssSelectors(ac); AtRule old = getAtRule() ; AtRulePage newRule = new AtRulePage() ; @@ -1266,9 +1266,9 @@ } } - final public Vector pageContent() throws ParseException { + final public ArrayList<CssProperty> pageContent() throws ParseException { CssProperty prop; - Vector v = new Vector(); + ArrayList<CssProperty> v = new ArrayList<CssProperty>(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case ATTOP: case ATRIGHT: @@ -1286,9 +1286,9 @@ throw new Error("Missing return statement in function"); } - final public Vector prefAtRule() throws ParseException { + final public ArrayList<CssProperty> prefAtRule() throws ParseException { Token n; - Vector v; + ArrayList<CssProperty> v; try { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case ATTOP: @@ -1380,7 +1380,7 @@ } final public void fontFace() throws ParseException { - Vector v; + ArrayList<CssProperty> v; AtRule old = getAtRule(); setAtRule(new AtRuleFontFace()); CssSelectors s = new CssSelectors(ac); @@ -1454,7 +1454,7 @@ } final public void colorprofile() throws ParseException { - Vector v; + ArrayList<CssProperty> v; AtRule old = getAtRule(); setAtRule(new AtRuleColorProfile()); CssSelectors s = new CssSelectors(ac); @@ -1529,7 +1529,7 @@ } final public void preference() throws ParseException { - Vector v; + ArrayList<CssProperty> v; AtRule old = getAtRule(); setAtRule(new AtRulePreference()); CssSelectors s = new CssSelectors(ac); @@ -1604,7 +1604,6 @@ } final public void phoneticAlphabet() throws ParseException { - Vector v; AtRule old = getAtRule(); AtRulePhoneticAlphabet alphabetrule = new AtRulePhoneticAlphabet(); setAtRule(alphabetrule); @@ -1823,13 +1822,13 @@ */ final public void ruleSet() throws ParseException { CssSelectors contextual; - Vector<CssSelectors> context_set = new Vector<CssSelectors>(); - Vector<CssProperty> value_set = null; + ArrayList<CssSelectors> context_set = new ArrayList<CssSelectors>(); + ArrayList<CssProperty> value_set = null; currentContext = context_set; try { contextual = selector(); if (contextual != null) { - context_set.addElement(contextual); + context_set.add(contextual); } label_57: while (true) { @@ -1856,7 +1855,7 @@ } contextual = selector(); if (contextual != null) { - context_set.addElement(contextual); + context_set.add(contextual); } } jj_consume_token(LBRACE); @@ -1895,9 +1894,9 @@ if (value_set != null) { boolean first = true; CssSelectors sel = null; - Enumeration<CssSelectors> e = context_set.elements(); - while (e.hasMoreElements()) { - sel = e.nextElement(); + Iterator<CssSelectors> e = context_set.iterator(); + while (e.hasNext()) { + sel = e.next(); if (first) { handleRule(sel, value_set); first = false; @@ -1906,9 +1905,9 @@ // as property holds reference to the selectors and it interact // badly with conflict detection int vsize = value_set.size(); - Vector<CssProperty> v = new Vector<CssProperty>(vsize); + ArrayList<CssProperty> v = new ArrayList<CssProperty>(vsize); for (int i=0; i<vsize; i++) { - v.addElement(value_set.elementAt(i).duplicate()); + v.add(value_set.get(i).duplicate()); } handleRule(sel, v); } @@ -1928,7 +1927,7 @@ } } - final public Vector<CssProperty> declarations() throws ParseException { + final public ArrayList<CssProperty> declarations() throws ParseException { if(!validSelector) { validSelector = true; skip_to_matching_brace(); @@ -1936,13 +1935,13 @@ } CssProperty values; - Vector<CssProperty> value_set = new Vector<CssProperty>(); + ArrayList<CssProperty> value_set = new ArrayList<CssProperty>(); boolean wrong_value = true; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IDENT: values = declaration(); if (values != null) { - value_set.addElement(values); + value_set.add(values); wrong_value = false; } /* else { wrong_value = true; @@ -1980,7 +1979,7 @@ case IDENT: values = declaration(); if (values != null) { - value_set.addElement(values); + value_set.add(values); wrong_value = false; }/* else { wrong_value = true; @@ -2323,7 +2322,7 @@ if(!profile.equals("css1")) { StringBuilder sb = new StringBuilder(); - Vector<String> param_err = new Vector<String>(2); + ArrayList<String> param_err = new ArrayList<String>(2); param_err.add(n.image); param_err.add(cl); sb.append(ac.getMsg().getString("parser.old_class", param_err)); @@ -3744,14 +3743,6 @@ finally { jj_save(0, xla); } } - private boolean jj_3_1() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_86()) jj_scanpos = xsp; - if (jj_scan_token(98)) return true; - return false; - } - private boolean jj_3R_86() { Token xsp; xsp = jj_scanpos; @@ -3762,6 +3753,14 @@ return false; } + private boolean jj_3_1() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_86()) jj_scanpos = xsp; + if (jj_scan_token(98)) return true; + return false; + } + /** Generated Token Manager. */ public CssParserTokenManager token_source; SimpleCharStream jj_input_stream;
Received on Monday, 29 August 2011 07:21:09 UTC