private MemoEntry eval ( String productionName , int position , int line ) throws ParserException , TreeException { MemoEntry maxProgress = MemoEntry . failed ( ) ; for ( Production production : grammar . getProductions ( ) . get ( productionName ) ) { MemoEntry progress = parseProduction ( production , position , line ) ; if ( progress . getAnswer ( ) instanceof ParseTreeNode ) { if ( ( maxProgress . getAnswer ( ) == Status . FAILED ) || ( maxProgress . getDeltaPosition ( ) < progress . getDeltaPosition ( ) ) ) { maxProgress = progress ; } } } return maxProgress ; }
This method evaluates the production given by it s name . The different choices are tried from the first to the last . The first choice matching is returned .