private MemoEntry recall ( String production , int position , int line ) throws TreeException , ParserException { /* * Retrieve the current memoized item for the production and the head on the * current position. */ final MemoEntry m = memo . getMemo ( production , position ) ; final Head h = heads . get ( position ) ; /* * "If not growing a seed parse, just return what is stored in the memo table." */ if ( h == null ) { return m ; } /* * "Do not evaluate any rule that is not involved in this left recursion." * * If we have never been at this position (NONE) and the head rule (production) * is not the current production and the involved rules in the heads also do not * fit, then we are on a wrong pass here. We need to return a failure. */ if ( ( m == null ) && ( ! h . getProduction ( ) . equals ( production ) ) && ( ! h . getInvolvedSet ( ) . contains ( production ) ) ) { return MemoEntry . failed ( ) ; } /* * "Allow involved rules to be evaluated, but only once, during a seed-growing * iteration." * * If we have been here already, we check the eval set for the containing rule * and evaluate it necessary. If the rule is within the eval set, we need to * parse it once. */ if ( h . getEvalSet ( ) . contains ( production ) ) { h . getEvalSet ( ) . remove ( production ) ; final MemoEntry ans = eval ( production , position , line ) ; m . set ( ans ) ; } return m ; }
This method is an extended getMemo function which also takes into account the seed growing processes which might be underway .