@Override
public String visitIncludeFile(QPLParser.IncludeFileContext ctx) {
String filePath = ctx.path.getText().trim();
filePath = filePath.substring(1, filePath.length() - 1);
if (filePath.charAt(0) != '/') {
filePath = Paths.get(__FILE_PATH__, filePath).toString();
}
try {
ANTLRInputStream ais = new ANTLRFileStream(filePath);
QPLLexer lex = new QPLLexer(ais);
TokenStream toks = new CommonTokenStream(lex);
QPLParser parse = new QPLParser(toks);
ParseTree tree = parse.prog();
return new ImpVisitor(filePath).visit(tree);
} catch (IOException ex) {
System.err.println(filePath + " cannot be found! Ignoring");
return "";
}
}
Main.java 文件源码
java
阅读 19
收藏 0
点赞 0
评论 0
项目:Q-Programming-Language
作者:
评论列表
文章目录