Merge pull request #354 from sharwell/xpath-cleanup

XPath cleanup
This commit is contained in:
Sam Harwell 2013-11-14 13:36:55 -08:00
commit df0bbf42e1
3 changed files with 21 additions and 4 deletions

View File

@ -55,6 +55,23 @@
<sourceDirectory>src</sourceDirectory> <sourceDirectory>src</sourceDirectory>
<resources/> <resources/>
<plugins>
<plugin>
<groupId>org.antlr</groupId>
<artifactId>antlr4-maven-plugin</artifactId>
<version>4.1</version>
<configuration>
<sourceDirectory>src</sourceDirectory>
</configuration>
<executions>
<execution>
<goals>
<goal>antlr4</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build> </build>
</project> </project>

View File

@ -188,9 +188,9 @@ public class Trees {
} }
public static List<ParseTree> findAllNodes(ParseTree t, int index, boolean findTokens) { public static List<ParseTree> findAllNodes(ParseTree t, int index, boolean findTokens) {
List<? super ParseTree> nodes = new ArrayList<ParseTree>(); List<ParseTree> nodes = new ArrayList<ParseTree>();
_findAllNodes(t, index, findTokens, nodes); _findAllNodes(t, index, findTokens, nodes);
return (List<ParseTree>)nodes; return nodes;
} }
public static void _findAllNodes(ParseTree t, int index, boolean findTokens, public static void _findAllNodes(ParseTree t, int index, boolean findTokens,

View File

@ -543,11 +543,11 @@ public abstract class BaseTest {
} }
public Class<? extends Lexer> loadLexerClassFromTempDir(String name) throws Exception { public Class<? extends Lexer> loadLexerClassFromTempDir(String name) throws Exception {
return (Class<? extends Lexer>)loadClassFromTempDir(name); return loadClassFromTempDir(name).asSubclass(Lexer.class);
} }
public Class<? extends Parser> loadParserClassFromTempDir(String name) throws Exception { public Class<? extends Parser> loadParserClassFromTempDir(String name) throws Exception {
return (Class<? extends Parser>)loadClassFromTempDir(name); return loadClassFromTempDir(name).asSubclass(Parser.class);
} }
protected String execParser(String grammarFileName, protected String execParser(String grammarFileName,