}
private ParseTree parse(String str, int line) {
// create new lexer and token stream for each line (expression)
ANTLRInputStream input = new ANTLRInputStream(str + "\n"); //$NON-NLS-1$
CommandsLexer lexer = new CommandsLexer(input);
lexer.setLine(line); // notify lexer of input position
lexer.setCharPositionInLine(0);
CommonTokenStream tokens = new CommonTokenStream(lexer);
parser.setInputStream(tokens); // notify parser of new token stream
lexer.reset();
return parser.command(); // start the parser
}