Skip to content

Commit

Permalink
update to ANTLR 4.5
Browse files Browse the repository at this point in the history
  • Loading branch information
thomaskrause committed Feb 15, 2016
1 parent ae77bb8 commit 3198712
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 21 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -16,3 +16,5 @@ rebel.xml
*.classpath
.settings/
*.jrebel_disabled
/.idea/
*.iml
8 changes: 4 additions & 4 deletions annis-service/pom.xml
Expand Up @@ -286,9 +286,9 @@
</dependency>

<dependency>
<groupId>com.tunnelvisionlabs</groupId>
<groupId>org.antlr</groupId>
<artifactId>antlr4-runtime</artifactId>
<version>4.2.2</version>
<version>4.5.2-1</version>
<scope>compile</scope>
</dependency>

Expand Down Expand Up @@ -332,9 +332,9 @@
<plugins>

<plugin>
<groupId>com.tunnelvisionlabs</groupId>
<groupId>org.antlr</groupId>
<artifactId>antlr4-maven-plugin</artifactId>
<version>4.2.2</version>
<version>4.5.2-1</version>
<executions>
<execution>
<goals>
Expand Down
26 changes: 10 additions & 16 deletions annis-service/src/main/java/annis/ql/parser/AnnisParserAntlr.java
Expand Up @@ -187,10 +187,9 @@ public StringListErrorListener(List<String> errors)
{
this.errors = errors;
}

@Override
public void syntaxError(Recognizer recognizer, Token offendingSymbol,
int line, int charPositionInLine, String msg, RecognitionException e)

@Override
public void syntaxError(Recognizer<?, ?> recognizer, Object offendingSymbol, int line, int charPositionInLine, String msg, RecognitionException e)
{
if(errors != null)
{
Expand All @@ -199,7 +198,7 @@ public void syntaxError(Recognizer recognizer, Token offendingSymbol,
}
}

public static class AqlLexerErrorListener implements ANTLRErrorListener<Integer>
public static class AqlLexerErrorListener extends BaseErrorListener
{

private final List<AqlParseError> errors;
Expand All @@ -208,13 +207,9 @@ public AqlLexerErrorListener(List<AqlParseError> errors)
{
this.errors = errors;
}




@Override
public <T extends Integer> void syntaxError(
Recognizer<T, ?> recognizer, T offendingSymbol, int line,
int charPositionInLine, String msg, RecognitionException e)
public void syntaxError(Recognizer<?, ?> recognizer, Object offendingSymbol, int line, int charPositionInLine, String msg, RecognitionException e)
{
if(errors != null)
{
Expand All @@ -236,16 +231,15 @@ public AqlParseErrorListener(List<AqlParseError> errors)
}

@Override
public <T extends Token> void syntaxError(
Recognizer<T, ?> recognizer, T offendingSymbol, int line,
int charPositionInLine, String msg, RecognitionException e)
public void syntaxError(Recognizer<?, ?> recognizer, Object offendingSymbol, int line, int charPositionInLine, String msg, RecognitionException e)
{
if(errors != null)
if(errors != null && offendingSymbol instanceof Token)
{
Token t = offendingSymbol;
Token t = (Token) offendingSymbol;
errors.add(new AqlParseError(getLocation(t, t), msg));
}
}

}


Expand Down
Expand Up @@ -86,7 +86,8 @@
<value><![CDATA[( (tok))]]></value>
<value><![CDATA[node _ident_ node _ident_ pos="NN"]]></value>
<value><![CDATA[pos . lemma . pos & #1 == #2]]></value>
<value><![CDATA[pos . lemma . pos & #1 != #2]]></value>
<value><![CDATA[pos . lemma . pos & #1 != #2]]></value>
<!-- <value><![CDATA[ZH1Diff="INS" . tok!=""]]></value> -->
<!-- corner cases of OR -->
<value><![CDATA["das" | "die" | "der"]]></value>
<value><![CDATA["das" | ("die" & pos="NN" & #2 . #3) | "der"]]></value>
Expand Down

0 comments on commit 3198712

Please sign in to comment.