org.cqframework.cql.Main Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cql Show documentation
Show all versions of cql Show documentation
The cql library for the Clinical Quality Language Java reference implementation
package org.cqframework.cql;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import org.antlr.v4.runtime.CharStream;
import org.antlr.v4.runtime.CharStreams;
import org.antlr.v4.runtime.CommonTokenStream;
import org.antlr.v4.runtime.tree.ParseTree;
import org.cqframework.cql.gen.cqlLexer;
import org.cqframework.cql.gen.cqlParser;
public class Main {
public static void main(String[] args) throws IOException {
String inputFile = null;
if (args.length > 0) {
inputFile = args[0];
}
InputStream is = System.in;
if (inputFile != null) {
is = new FileInputStream(inputFile);
}
CharStream input = CharStreams.fromStream(is);
cqlLexer lexer = new cqlLexer(input);
CommonTokenStream tokens = new CommonTokenStream(lexer);
cqlParser parser = new cqlParser(tokens);
parser.setBuildParseTree(true);
ParseTree tree = parser.library();
// show tree in text form
System.out.println(tree.toStringTree(parser));
}
}