Try to support Eclipse

Revert "Specify the classes generated by antlr"

This reverts commit 60b941f7072212a485e64a7db1d2370edd9868b5.
This commit is contained in:
Jiaye Wu 2017-08-03 15:02:40 +08:00
parent 30b3d233c5
commit 82f6eb57ec
No known key found for this signature in database
GPG Key ID: 75875C40D3447361
5 changed files with 28 additions and 5 deletions

18
pom.xml
View File

@ -150,6 +150,24 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>target/generated-sources/antlr3</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -292,7 +292,7 @@ public class ASTNode extends CommonTree implements cn.edu.thu.tsfiledb.sql.parse
// Leaf
if (next.children == null || next.children.size() == 0) {
String str = next.toString();
rootNode.addtoMemoizedString(next.getType() != cn.edu.thu.tsfiledb.sql.parse.TSParser.StringLiteral ? str.toLowerCase() : str);
rootNode.addtoMemoizedString(next.getType() != TSParser.StringLiteral ? str.toLowerCase() : str);
next.endIndx = rootNode.getMemoizedStringLen();
stack.pop();
continue;
@ -302,7 +302,7 @@ public class ASTNode extends CommonTree implements cn.edu.thu.tsfiledb.sql.parse
rootNode.addtoMemoizedString("(");
String str = next.toString();
rootNode.addtoMemoizedString(
(next.getType() == cn.edu.thu.tsfiledb.sql.parse.TSParser.StringLiteral || null == str) ? str : str.toLowerCase());
(next.getType() == TSParser.StringLiteral || null == str) ? str : str.toLowerCase());
rootNode.addtoMemoizedString(" ");
}

View File

@ -80,7 +80,7 @@ public class ParseDriver {
* TSLexerX.
*
*/
public class TSLexerX extends cn.edu.thu.tsfiledb.sql.parse.TSLexer {
public class TSLexerX extends TSLexer {
private final ArrayList<ParseError> errors;
@ -166,6 +166,11 @@ public class ParseDriver {
* @param command
* command to parse
*
* @param ctx
* context with which to associate this parser's token stream, or
* null if either no context is available or the context already has
* an existing stream
*
* @return parsed AST
*/
public ASTNode parse(String command) throws ParseException
@ -177,10 +182,10 @@ public class ParseDriver {
TSLexerX lexer = new TSLexerX(new ANTLRNoCaseStringStream(command));
TokenRewriteStream tokens = new TokenRewriteStream(lexer);
cn.edu.thu.tsfiledb.sql.parse.TSParser parser = new cn.edu.thu.tsfiledb.sql.parse.TSParser(tokens);
TSParser parser = new TSParser(tokens);
parser.setTreeAdaptor(adaptor);
cn.edu.thu.tsfiledb.sql.parse.TSParser.statement_return r = null;
TSParser.statement_return r = null;
try {