Skip to content

Commit a8039ea

Browse files
committed
javacc results moved to a different package
more cleanup javadoc added
1 parent 769a567 commit a8039ea

File tree

19 files changed

+424
-87
lines changed

19 files changed

+424
-87
lines changed

checkstyle.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@
130130

131131
<!-- Checks for Javadoc comments. -->
132132
<!-- See http://checkstyle.sf.net/config_javadoc.html -->
133-
<!-- TODO
134133
<module name="JavadocMethod">
135134
<property name="scope" value="protected"/>
136135
<property name="logLoadErrors" value="true"/>
@@ -149,7 +148,6 @@
149148
<property name="checkEmptyJavadoc" value="false"/>
150149
<property name="checkHtml" value="true"/>
151150
</module>
152-
-->
153151

154152
<!-- Checks for Naming Conventions. -->
155153
<!-- See http://checkstyle.sf.net/config_naming.html -->

pom.xml

Lines changed: 43 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<modelVersion>4.0.0</modelVersion>
55
<groupId>net.sourceforge.htmlunit</groupId>
66
<artifactId>htmlunit-cssparser</artifactId>
7-
<version>1.0.0</version>
7+
<version>1.0.0-SNAPSHOT</version>
88
<name>HtmlUnit CSS Parser</name>
99
<url>https://github.com/HtmlUnit/htmlunit-cssparser</url>
1010
<packaging>jar</packaging>
@@ -74,7 +74,7 @@
7474
</execution>
7575
</executions>
7676
<configuration>
77-
<basedir>${project.build.directory}/generated-sources/javacc/com/gargoylesoftware/css/parser</basedir>
77+
<basedir>${project.build.directory}/generated-sources/javacc/com/gargoylesoftware/css/parser/javacc</basedir>
7878
<includes>
7979
<include>CSS3Parser.java</include>
8080
<include>CSS3ParserTokenManager.java</include>
@@ -167,6 +167,35 @@
167167
<artifactId>maven-site-plugin</artifactId>
168168
<version>3.6</version>
169169
</plugin>
170+
<plugin>
171+
<groupId>org.apache.maven.plugins</groupId>
172+
<artifactId>maven-javadoc-plugin</artifactId>
173+
<version>3.0.0</version>
174+
<configuration>
175+
<additionalparam>--allow-script-in-comments</additionalparam>
176+
<excludePackageNames>com.gargoylesoftware.css.parser.javacc</excludePackageNames>
177+
</configuration>
178+
<executions>
179+
<execution>
180+
<goals>
181+
<goal>jar</goal>
182+
</goals>
183+
</execution>
184+
</executions>
185+
</plugin>
186+
<plugin>
187+
<groupId>org.apache.maven.plugins</groupId>
188+
<artifactId>maven-gpg-plugin</artifactId>
189+
<version>1.6</version>
190+
<executions>
191+
<execution>
192+
<phase>verify</phase>
193+
<goals>
194+
<goal>sign</goal>
195+
</goals>
196+
</execution>
197+
</executions>
198+
</plugin>
170199
<plugin>
171200
<groupId>org.apache.maven.plugins</groupId>
172201
<artifactId>maven-eclipse-plugin</artifactId>
@@ -210,6 +239,18 @@
210239
</build>
211240
<reporting>
212241
<plugins>
242+
<plugin>
243+
<groupId>org.apache.maven.plugins</groupId>
244+
<artifactId>maven-javadoc-plugin</artifactId>
245+
<version>3.0.0</version>
246+
<configuration>
247+
<additionalparam>--allow-script-in-comments</additionalparam>
248+
<links>
249+
<link>http://docs.oracle.com/javase/8/docs/api/</link>
250+
</links>
251+
<excludePackageNames>com.gargoylesoftware.css.parser.javacc</excludePackageNames>
252+
</configuration>
253+
</plugin>
213254
<plugin>
214255
<groupId>org.apache.maven.plugins</groupId>
215256
<artifactId>maven-changes-plugin</artifactId>
@@ -227,16 +268,6 @@
227268
</issueLinkTemplatePerSystem>
228269
</configuration>
229270
</plugin>
230-
<plugin>
231-
<groupId>org.apache.maven.plugins</groupId>
232-
<artifactId>maven-javadoc-plugin</artifactId>
233-
<version>2.10.4</version>
234-
<configuration>
235-
<links>
236-
<link>http://java.sun.com/j2se/1.5.0/docs/api/</link>
237-
</links>
238-
</configuration>
239-
</plugin>
240271
</plugins>
241272
</reporting>
242273

src/main/java/com/gargoylesoftware/css/dom/CSSValueImpl.java

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
import com.gargoylesoftware.css.parser.InputSource;
3434
import com.gargoylesoftware.css.parser.LexicalUnit;
3535
import com.gargoylesoftware.css.parser.LexicalUnitImpl;
36-
import com.gargoylesoftware.css.parser.Locatable;
3736
import com.gargoylesoftware.css.parser.LexicalUnit.LexicalUnitType;
3837
import com.gargoylesoftware.css.util.LangUtils;
3938

@@ -52,16 +51,17 @@ public class CSSValueImpl extends AbstractLocatable implements CSSPrimitiveValue
5251

5352
private Object value_;
5453

54+
/**
55+
* @return the value
56+
*/
5557
public Object getValue() {
5658
return value_;
5759
}
5860

59-
public void setValue(final Object value) {
60-
value_ = value;
61-
}
62-
6361
/**
64-
* Constructor
62+
* Constructor.
63+
* @param value the lexical unit value
64+
* @param forcePrimitive true or false
6565
*/
6666
public CSSValueImpl(final LexicalUnit value, final boolean forcePrimitive) {
6767
LexicalUnit parameters = null;
@@ -98,8 +98,8 @@ else if (value.getLexicalUnitType() == LexicalUnitType.COUNTERS_FUNCTION) {
9898
value_ = value;
9999
}
100100

101-
if (value instanceof Locatable) {
102-
setLocator(((Locatable) value).getLocator());
101+
if (value != null) {
102+
setLocator(value.getLocator());
103103
}
104104
}
105105

@@ -113,6 +113,10 @@ private List<CSSValueImpl> getValues(final LexicalUnit value) {
113113
return values;
114114
}
115115

116+
/**
117+
* Ctor.
118+
* @param value the value
119+
*/
116120
public CSSValueImpl(final LexicalUnit value) {
117121
this(value, false);
118122
}
@@ -304,7 +308,7 @@ public void setStringValue(final short stringType, final String stringValue) thr
304308
}
305309

306310
/**
307-
* TODO: return a value for a list type
311+
* {@inheritDoc}
308312
*/
309313
@Override
310314
public String getStringValue() throws DOMException {

src/main/java/com/gargoylesoftware/css/parser/AbstractCSSParser.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323

2424
import org.w3c.dom.DOMException;
2525

26+
import com.gargoylesoftware.css.parser.javacc.CharStream;
27+
import com.gargoylesoftware.css.parser.javacc.ParseException;
28+
import com.gargoylesoftware.css.parser.javacc.Token;
29+
import com.gargoylesoftware.css.parser.javacc.TokenMgrError;
2630
import com.gargoylesoftware.css.parser.media.MediaQueryList;
2731
import com.gargoylesoftware.css.parser.selector.SelectorList;
2832

@@ -31,7 +35,7 @@
3135
*
3236
* @author Ronald Brill
3337
*/
34-
abstract class AbstractCSSParser implements CSSParser {
38+
public abstract class AbstractCSSParser implements CSSParser {
3539
private DocumentHandler documentHandler_;
3640
private CSSErrorHandler errorHandler_;
3741
private InputSource source_;
@@ -546,23 +550,23 @@ else if (len == 6) {
546550
}
547551
}
548552

549-
int intValue(final char op, final String s) {
553+
protected int intValue(final char op, final String s) {
550554
final int result = Integer.parseInt(s);
551555
if (op == '-') {
552556
return -1 * result;
553557
}
554558
return result;
555559
}
556560

557-
float floatValue(final char op, final String s) {
561+
protected float floatValue(final char op, final String s) {
558562
final float result = Float.parseFloat(s);
559563
if (op == '-') {
560564
return -1 * result;
561565
}
562566
return result;
563567
}
564568

565-
int getLastNumPos(final String s) {
569+
protected int getLastNumPos(final String s) {
566570
int i = 0;
567571
for ( ; i < s.length(); i++) {
568572
if (NUM_CHARS.indexOf(s.charAt(i)) < 0) {

src/main/java/com/gargoylesoftware/css/parser/CSSException.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,14 @@ public enum ErrorCode {
2929
private ErrorCode code_;
3030

3131
/**
32-
* Creates a new CSSException
32+
* Creates a new CSSException.
3333
*/
3434
public CSSException() {
3535
}
3636

3737
/**
38-
* Creates a new CSSException
38+
* Creates a new CSSException.
39+
* @param message the message
3940
*/
4041
public CSSException(final String message) {
4142
code_ = ErrorCode.UNSPECIFIED_ERR;
@@ -44,7 +45,7 @@ public CSSException(final String message) {
4445

4546
/**
4647
* Creates a new CSSException with an embeded exception.
47-
* @param a the embeded exception.
48+
* @param e the embeded exception.
4849
*/
4950
public CSSException(final Exception e) {
5051
code_ = ErrorCode.UNSPECIFIED_ERR;
@@ -53,7 +54,7 @@ public CSSException(final Exception e) {
5354

5455
/**
5556
* Creates a new CSSException with a specific code.
56-
* @param a the embeded exception.
57+
* @param code a the embeded exception.
5758
*/
5859
public CSSException(final ErrorCode code) {
5960
code_ = code;
@@ -62,8 +63,9 @@ public CSSException(final ErrorCode code) {
6263
/**
6364
* Creates a new CSSException with an embeded exception and a specified
6465
* message.
65-
* @param code the specified code.
66-
* @param e the embeded exception.
66+
* @param code the specified code
67+
* @param message the message
68+
* @param e the embeded exception
6769
*/
6870
public CSSException(final ErrorCode code, final String message, final Exception e) {
6971
code_ = code;

src/main/java/com/gargoylesoftware/css/parser/CSSOMParser.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import com.gargoylesoftware.css.dom.CSSValueImpl;
3636
import com.gargoylesoftware.css.dom.MediaListImpl;
3737
import com.gargoylesoftware.css.dom.Property;
38+
import com.gargoylesoftware.css.parser.javacc.CSS3Parser;
3839
import com.gargoylesoftware.css.parser.media.MediaQueryList;
3940
import com.gargoylesoftware.css.parser.selector.SelectorList;
4041

@@ -46,12 +47,17 @@ public class CSSOMParser {
4647
private CSSParser parser_;
4748
private CSSStyleSheetImpl parentStyleSheet_;
4849

49-
/** Creates new CSSOMParser */
50+
/**
51+
* Creates new CSSOMParser.
52+
* @param parser the parser
53+
*/
5054
public CSSOMParser(final CSSParser parser) {
5155
parser_ = parser;
5256
}
5357

54-
/** Creates new CSSOMParser */
58+
/**
59+
* Creates new CSSOMParser.
60+
*/
5561
public CSSOMParser() {
5662
parser_ = new CSS3Parser();
5763
}
@@ -64,6 +70,7 @@ public void setErrorHandler(final CSSErrorHandler eh) {
6470
* Parses a SAC input source into a CSSOM style sheet.
6571
*
6672
* @param source the SAC input source
73+
* @param href the href
6774
* @return the CSSOM style sheet
6875
* @throws IOException if the underlying SAC parser throws an IOException
6976
*/

src/main/java/com/gargoylesoftware/css/parser/CSSParser.java

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public interface CSSParser {
113113
/**
114114
* Parse a CSS style declaration (without '{' and '}').
115115
*
116-
* @param styleValue The declaration.
116+
* @param source source to be parsed
117117
* @exception CSSException Any CSS exception, possibly
118118
* wrapping another exception.
119119
* @exception java.io.IOException An IO exception from the parser,
@@ -125,6 +125,7 @@ public interface CSSParser {
125125
/**
126126
* Parse a CSS rule.
127127
*
128+
* @param source source to be parsed
128129
* @exception CSSException Any CSS exception, possibly
129130
* wrapping another exception.
130131
* @exception java.io.IOException An IO exception from the parser,
@@ -134,7 +135,7 @@ public interface CSSParser {
134135
void parseRule(InputSource source) throws CSSException, IOException;
135136

136137
/**
137-
* Returns a string about which CSS language is supported by this
138+
* @return a string about which CSS language is supported by this
138139
* parser. For CSS Level 1, it returns "http://www.w3.org/TR/REC-CSS1", for
139140
* CSS Level 2, it returns "http://www.w3.org/TR/REC-CSS2". Note that a
140141
* "CSSx" parser can return lexical unit other than those allowed by CSS
@@ -145,6 +146,8 @@ public interface CSSParser {
145146
/**
146147
* Parse a comma separated list of selectors.
147148
*
149+
* @param source source to be parsed
150+
* @return a selector list
148151
* @exception CSSException Any CSS exception, possibly
149152
* wrapping another exception.
150153
* @exception java.io.IOException An IO exception from the parser,
@@ -156,6 +159,8 @@ public interface CSSParser {
156159
/**
157160
* Parse a CSS property value.
158161
*
162+
* @param source source to be parsed
163+
* @return a lexical unit
159164
* @exception CSSException Any CSS exception, possibly
160165
* wrapping another exception.
161166
* @exception java.io.IOException An IO exception from the parser,
@@ -167,6 +172,8 @@ public interface CSSParser {
167172
/**
168173
* Parse a CSS priority value (e.g. "!important").
169174
*
175+
* @param source source to be parsed
176+
* @return true or flase
170177
* @exception CSSException Any CSS exception, possibly
171178
* wrapping another exception.
172179
* @exception java.io.IOException An IO exception from the parser,
@@ -175,6 +182,13 @@ public interface CSSParser {
175182
*/
176183
boolean parsePriority(InputSource source) throws CSSException, IOException;
177184

185+
/**
186+
* @param accepted trur if the parser should accept ie star hack
187+
*/
178188
void setIeStarHackAccepted(boolean accepted);
189+
190+
/**
191+
* @return accepted trur if the parser should accept ie star hack
192+
*/
179193
boolean isIeStarHackAccepted();
180194
}

src/main/java/com/gargoylesoftware/css/parser/CssCharStream.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
/* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
33
package com.gargoylesoftware.css.parser;
44

5+
import com.gargoylesoftware.css.parser.javacc.CharStream;
6+
57
/**
68
* An implementation of interface CharStream.
79
* There is no processing of escaping in this class because the escaping is

0 commit comments

Comments
 (0)