// Create a scanner that reads from the input stream passed to us
SPLLexer lexer = new SPLLexer(r);
lexer.setFilename(f);
// Create a parser that reads from the scanner
SPLParser parser = new SPLParser(lexer);
parser.setASTNodeClass("org.apache.imperius.spl.parser.compiler.ASTWithLineNumber");
parser.setFilename(f);
logger.fine(Thread.currentThread().getName() + " parsing file started...");
// start parsing at the compilationUnit rule
parser.splpolicy();
if(parser.getErrorList() != null && parser.getErrorList().size() > 0)
{
throw new SPLException(Messages
.getString("SPL_POLICY_PARSING_EXCEPTION_MSG"));
}
logger.fine(Thread.currentThread().getName() + " parsing file completed here...");
AST t = parser.getAST();
if (t != null)
{
traverseTree(t);
}
else
{
logger.log(Level.SEVERE, Messages.SPLOF0007E);
}
// do something with the tree
SPLPolicy pol = doTreeAction(f, parser.getAST(), parser.getTokenNames());
logger.exiting(sourceClass, Thread.currentThread().getName() + " "
+ "parseFile");
return pol;