Skip to content

Commit

Permalink
Merge pull request #222 from fscheffer/master
Browse files Browse the repository at this point in the history
upgraded to antlr-runtime 3.5.2
  • Loading branch information
SomMeri committed Jul 24, 2014
2 parents 0e530be + 7b63f89 commit 740d8cd
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Less4j is a port. The original compiler was written in JavaScript and is called
<properties>
<slf4j.version>1.6.6</slf4j.version>
<wro4j.version>1.4.6</wro4j.version>
<antlr.version>3.4</antlr.version>
<antlr.version>3.5.2</antlr.version>
</properties>
<dependencies>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ tokens {
public Token nextToken() {
super.nextToken();
if ( tokens.size()==0 ) {
return Token.EOF_TOKEN;
return getEOFToken();
}
return (Token)tokens.remove(0);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,11 @@ public HiddenTokenAwareTree getChild(int i) {

@SuppressWarnings("unchecked")
public List<HiddenTokenAwareTree> getChildren() {
List<HiddenTokenAwareTree> result = super.getChildren();
List<? extends Object> result = super.getChildren();
if (result == null)
result = Collections.emptyList();
return result;

return (List<HiddenTokenAwareTree>) result;
}

public boolean hasChildren() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,11 @@ public Object post(Object t) {
}

private int countOnChannelTokes(int start, int end) {
@SuppressWarnings("unchecked")
List<CommonToken> list = tokens.get(start, end);
List<? extends Token> list = tokens.get(start, end);
int count = 0;
for (CommonToken token : list) {
if (isOnChannel(token) && !isDummy(token))
for (Token token : list) {
CommonToken commonToken = CommonToken.class.cast(token);
if (isOnChannel(commonToken) && !isDummy(commonToken))
count++;
}
return count;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public void testThreeErrors() {
@Test
public void testAntlrError() {
String less = ".class { margin: 1 1 1 1; ";
String expectedError = "Could not compile less. 1 error(s) occurred:\nERROR 0:0 no viable alternative at input '<EOF>' in ruleset (which started at 1:1)\n";
String expectedError = "Could not compile less. 1 error(s) occurred:\nERROR 1:27 no viable alternative at input '<EOF>' in ruleset (which started at 1:1)\n";

expectCompileError(less, expectedError);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Errors produced by compilation of testCase
ERROR import#FILE_SEPARATOR#syntactically-incorrect-unclosed-ruleset.less 0:0 no viable alternative at input '<EOF>' in ruleset (which started at 2:1)
ERROR import#FILE_SEPARATOR#syntactically-incorrect-unclosed-ruleset.less 4:3 no viable alternative at input '<EOF>' in ruleset (which started at 2:1)
2 changes: 1 addition & 1 deletion src/test/resources/error-handling/lexer-errors.err
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Errors produced by compilation of testCase
ERROR 2:29 no viable alternative at character ';'
ERROR 7:2 mismatched character '<EOF>' expecting '*'
ERROR 0:0 no viable alternative at input '<EOF>' in ruleset (which started at 5:1)
ERROR 7:2 no viable alternative at input '<EOF>' in ruleset (which started at 5:1)
2 changes: 1 addition & 1 deletion src/test/resources/error-handling/parser-errors.err
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Errors produced by compilation of testCase
ERROR 1:10 no viable alternative at input ':' in unknown ruleset (which started at 1:1)
ERROR 1:12 extraneous input '2' expecting 'identifier' in selectors (which started at 1:10)
ERROR 0:0 no viable alternative at input '<EOF>' in ruleset (which started at 1:10)
ERROR 5:1 no viable alternative at input '<EOF>' in ruleset (which started at 1:10)

0 comments on commit 740d8cd

Please sign in to comment.