Skip to content

Commit d16912f

Browse files
committed
try ph-javacc
1 parent 8168518 commit d16912f

File tree

3 files changed

+20
-47
lines changed

3 files changed

+20
-47
lines changed

pom.xml

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@
7575
</plugin>
7676
<plugin>
7777
<!-- generate parsers and lexers before compiling -->
78-
<groupId>org.codehaus.mojo</groupId>
79-
<artifactId>javacc-maven-plugin</artifactId>
80-
<version>3.0.1</version>
78+
<groupId>com.helger.maven</groupId>
79+
<artifactId>ph-javacc-maven-plugin</artifactId>
80+
<version>4.1.5</version>
8181
<executions>
8282
<execution>
8383
<id>javacc</id>
@@ -86,13 +86,6 @@
8686
</goals>
8787
</execution>
8888
</executions>
89-
<dependencies>
90-
<dependency>
91-
<groupId>net.java.dev.javacc</groupId>
92-
<artifactId>javacc</artifactId>
93-
<version>7.0.12</version>
94-
</dependency>
95-
</dependencies>
9689
</plugin>
9790
<plugin>
9891
<groupId>com.google.code.maven-replacer-plugin</groupId>
@@ -112,7 +105,7 @@
112105
<include>CSS3Parser.java</include>
113106

114107
<include>Token.java</include>
115-
<include>TokenMgrError.java</include>
108+
<include>TokenMgrException.java</include>
116109
</includes>
117110
<regex>true</regex>
118111
<regexFlags>
@@ -140,7 +133,7 @@
140133
<value>throw $1$2</value>
141134
</replacement>
142135
<replacement>
143-
<token>\s*throw new Error\("Missing return statement in function"\);</token>
136+
<token>\s*throw new IllegalStateException \("Missing return statement in function"\);</token>
144137
<value></value>
145138
</replacement>
146139
</replacements>

src/main/java/org/htmlunit/cssparser/parser/AbstractCSSParser.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
import org.htmlunit.cssparser.parser.javacc.CharStream;
2525
import org.htmlunit.cssparser.parser.javacc.ParseException;
2626
import org.htmlunit.cssparser.parser.javacc.Token;
27-
import org.htmlunit.cssparser.parser.javacc.TokenMgrError;
27+
import org.htmlunit.cssparser.parser.javacc.TokenMgrException;
2828
import org.htmlunit.cssparser.parser.media.MediaQueryList;
2929
import org.htmlunit.cssparser.parser.selector.SelectorList;
3030
import org.w3c.dom.DOMException;
@@ -292,10 +292,10 @@ protected CSSParseException toCSSParseException(final DOMException e) {
292292
}
293293

294294
/**
295-
* @param e the TokenMgrError
295+
* @param e the TokenMgrException
296296
* @return a new CSSParseException
297297
*/
298-
protected CSSParseException toCSSParseException(final TokenMgrError e) {
298+
protected CSSParseException toCSSParseException(final TokenMgrException e) {
299299
final String messagePattern = getParserMessage("tokenMgrError");
300300
return new CSSParseException(messagePattern, getInputSource().getURI(), 1, 1);
301301
}
@@ -354,7 +354,7 @@ public void parseStyleSheet(final InputSource source) throws IOException {
354354
catch (final ParseException e) {
355355
getErrorHandler().error(toCSSParseException("invalidStyleSheet", e));
356356
}
357-
catch (final TokenMgrError e) {
357+
catch (final TokenMgrException e) {
358358
getErrorHandler().error(toCSSParseException(e));
359359
}
360360
catch (final CSSParseException e) {
@@ -381,7 +381,7 @@ public void parseStyleDeclaration(final InputSource source) throws IOException {
381381
catch (final ParseException e) {
382382
getErrorHandler().error(toCSSParseException("invalidStyleDeclaration", e));
383383
}
384-
catch (final TokenMgrError e) {
384+
catch (final TokenMgrException e) {
385385
getErrorHandler().error(toCSSParseException(e));
386386
}
387387
catch (final CSSParseException e) {
@@ -408,7 +408,7 @@ public void parseRule(final InputSource source) throws IOException {
408408
catch (final ParseException e) {
409409
getErrorHandler().error(toCSSParseException("invalidRule", e));
410410
}
411-
catch (final TokenMgrError e) {
411+
catch (final TokenMgrException e) {
412412
getErrorHandler().error(toCSSParseException(e));
413413
}
414414
catch (final CSSParseException e) {
@@ -437,7 +437,7 @@ public SelectorList parseSelectors(final InputSource source) throws IOException
437437
catch (final ParseException e) {
438438
getErrorHandler().error(toCSSParseException("invalidSelectorList", e));
439439
}
440-
catch (final TokenMgrError e) {
440+
catch (final TokenMgrException e) {
441441
getErrorHandler().error(toCSSParseException(e));
442442
}
443443
catch (final CSSParseException e) {
@@ -467,7 +467,7 @@ public LexicalUnit parsePropertyValue(final InputSource source) throws IOExcepti
467467
catch (final ParseException e) {
468468
getErrorHandler().error(toCSSParseException("invalidExpr", e));
469469
}
470-
catch (final TokenMgrError e) {
470+
catch (final TokenMgrException e) {
471471
getErrorHandler().error(toCSSParseException(e));
472472
}
473473
catch (final CSSParseException e) {
@@ -497,7 +497,7 @@ public boolean parsePriority(final InputSource source) throws IOException {
497497
catch (final ParseException e) {
498498
getErrorHandler().error(toCSSParseException("invalidPrio", e));
499499
}
500-
catch (final TokenMgrError e) {
500+
catch (final TokenMgrException e) {
501501
getErrorHandler().error(toCSSParseException(e));
502502
}
503503
catch (final CSSParseException e) {
@@ -522,7 +522,7 @@ public MediaQueryList parseMedia(final InputSource source) throws IOException {
522522
catch (final ParseException e) {
523523
getErrorHandler().error(toCSSParseException("invalidMediaList", e));
524524
}
525-
catch (final TokenMgrError e) {
525+
catch (final TokenMgrException e) {
526526
getErrorHandler().error(toCSSParseException(e));
527527
}
528528
catch (final CSSParseException e) {

src/main/java/org/htmlunit/cssparser/parser/CssCharStream.java

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ else if ((tokenBegin - available) < BUFFER_SIZE)
135135

136136
/** Start. */
137137
@Override
138-
public final char BeginToken() throws java.io.IOException
138+
public final char beginToken() throws java.io.IOException
139139
{
140140
tokenBegin = -1;
141141
char c = readChar();
@@ -207,26 +207,6 @@ public final char readChar() throws java.io.IOException
207207
return c;
208208
}
209209

210-
@Override
211-
@Deprecated
212-
/**
213-
* @deprecated
214-
* @see #getEndColumn
215-
*/
216-
public final int getColumn() {
217-
return bufcolumn[bufpos];
218-
}
219-
220-
@Override
221-
@Deprecated
222-
/**
223-
* @deprecated
224-
* @see #getEndLine
225-
*/
226-
public final int getLine() {
227-
return bufline[bufpos];
228-
}
229-
230210
/** Get token end column number. */
231211
@Override
232212
public final int getEndColumn() {
@@ -291,7 +271,7 @@ public CssCharStream(java.io.Reader dstream, int startline, int startcolumn)
291271

292272
/** Get token literal value. */
293273
@Override
294-
public final String GetImage()
274+
public final String getImage()
295275
{
296276
if (bufpos >= tokenBegin)
297277
return new String(buffer, tokenBegin, bufpos - tokenBegin + 1);
@@ -300,7 +280,7 @@ public final String GetImage()
300280

301281
/** Get the suffix. */
302282
@Override
303-
public final char[] GetSuffix(int len)
283+
public final char[] getSuffix(int len)
304284
{
305285
char[] ret = new char[len];
306286

@@ -317,7 +297,7 @@ public final char[] GetSuffix(int len)
317297

318298
/** Reset buffer when finished. */
319299
@Override
320-
public void Done()
300+
public void done()
321301
{
322302
buffer = null;
323303
bufline = null;
@@ -384,7 +364,7 @@ public int getTabSize() {
384364
}
385365

386366
@Override
387-
public boolean getTrackLineColumn() {
367+
public boolean isTrackLineColumn() {
388368
return trackLineColumn;
389369
}
390370

0 commit comments

Comments
 (0)