Skip to content
This repository has been archived by the owner on May 6, 2022. It is now read-only.

Commit

Permalink
Fix #151: Some minor refactoring to make the source code clear.
Browse files Browse the repository at this point in the history
  • Loading branch information
Florian Lautenschlager committed Aug 24, 2019
1 parent fd5acdf commit f159d5a
Showing 1 changed file with 3 additions and 20 deletions.
Expand Up @@ -26,7 +26,6 @@
import de.qaware.chronix.server.types.ChronixTypes;
import org.antlr.v4.runtime.ANTLRErrorListener;
import org.antlr.v4.runtime.ANTLRInputStream;
import org.antlr.v4.runtime.CharStream;
import org.antlr.v4.runtime.CommonToken;
import org.antlr.v4.runtime.CommonTokenStream;
import org.antlr.v4.runtime.Parser;
Expand Down Expand Up @@ -83,29 +82,13 @@ public CQLCFResult parseCF(String cf) throws CQLException {
if (cf == null || cf.isEmpty()) {
return new CQLCFResult();
}
init(cf);
this.errorListener.setQuery(cf);
this.lexer.setInputStream(new ANTLRInputStream(cf));
this.parser.setTokenStream(new UnbufferedTokenStream(lexer));

return parseChronixFunctionParameter(this.parser.cqlcf());
}

private void init(String cql) {
this.errorListener.setQuery(cql);

// Antlr 4.7.1
// CodePointCharStream input = CharStreams.fromString(cql);

CharStream charStream = new ANTLRInputStream(cql);

this.lexer.setInputStream(charStream);
// Antlr 4.7.1
//this.tokenStream.setTokenSource(lexer);

UnbufferedTokenStream tokenStream = new UnbufferedTokenStream(lexer);

this.parser.setTokenStream(tokenStream);

}

private CQLCFResult parseChronixFunctionParameter(CQLCFParser.CqlcfContext tree) throws CQLException {

CQLCFParser.ChronixTypedFunctionsContext chronixTypedFunctions = tree.chronixTypedFunctions();
Expand Down

0 comments on commit f159d5a

Please sign in to comment.