Skip to content

Commit

Permalink
Merge pull request #101 from Bernardo-MG/release
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
Bernardo-MG authored Jul 21, 2020
2 parents c8adf81 + d324c6f commit 34061e5
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
- name: Set up JDK ${{ matrix.jdk }}
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.jdk }}
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

<groupId>com.bernardomg.tabletop</groupId>
<artifactId>dice</artifactId>
<version>2.0.3</version>
<version>2.1.0-SNAPSHOT</version>
<packaging>jar</packaging>

<name>Dice Notation Tools for Java</name>
Expand Down
5 changes: 5 additions & 0 deletions src/changes/changes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -127,5 +127,10 @@
Added link to dice notation CLI.
</action>
</release>
<release version="2.1.0" date="2020-07-18" description="">
<action dev="bmg" type="add">
The parser's error listener is configurable.
</action>
</release>
</body>
</document>
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public final class DefaultDiceParser implements DiceParser {
/**
* Error listener for the parser and lexer.
*/
private final ANTLRErrorListener errorListener = new DefaultErrorListener();
private final ANTLRErrorListener errorListener;

/**
* Visitor used to build the returned object.
Expand All @@ -68,6 +68,21 @@ public final class DefaultDiceParser implements DiceParser {
public DefaultDiceParser() {
super();

errorListener = new DefaultErrorListener();
expressionBuilder = new DefaultDiceExpressionBuilder();
}

/**
* Constructs a parser with the error listener
*
* @param listener
* error listener
*/
public DefaultDiceParser(final ANTLRErrorListener listener) {
super();

errorListener = checkNotNull(listener,
"Received a null pointer as listener");
expressionBuilder = new DefaultDiceExpressionBuilder();
}

Expand All @@ -80,8 +95,27 @@ public DefaultDiceParser() {
public DefaultDiceParser(final DiceExpressionBuilder builder) {
super();

errorListener = new DefaultErrorListener();
expressionBuilder = checkNotNull(builder,
"Received a null pointer as expression builder");
}

/**
* Constructs a parser with the specified builder and error listener.
*
* @param builder
* builder to generate the returned tree
* @param listener
* error listener
*/
public DefaultDiceParser(final DiceExpressionBuilder builder,
final ANTLRErrorListener listener) {
super();

errorListener = checkNotNull(listener,
"Received a null pointer as listener");
expressionBuilder = checkNotNull(builder,
"Received a null pointer as expression builder");
}

@Override
Expand Down

0 comments on commit 34061e5

Please sign in to comment.