public boolean parse ( Context context ) throws NestingException { boolean flag = true ; Source source = context . getSource ( ) ; int offset = source . getOffset ( ) ; // Log start parsing if ( log . isTraceEnabled ( ) ) { log . trace ( "[{}] Begin {}" , offset , this ) ; } int i ; for ( i = 0 ; i < patternSize && flag ; i ++ ) { ProcPatternElement current = elements . get ( i ) ; ProcPatternElement next ; if ( i < patternSize - 1 ) { next = elements . get ( i + 1 ) ; } else { next = context . getTerminator ( ) ; } flag = current . parse ( context , next ) ; } if ( ! flag ) { if ( log . isTraceEnabled ( ) ) { log . trace ( "[{}] Rollback {} on {} element" , source . getOffset ( ) , this , i ) ; } source . setOffset ( offset ) ; } else { if ( log . isTraceEnabled ( ) ) { log . trace ( "[{}] Complete {}" , source . getOffset ( ) , this ) ; } } return flag ; }
Parse context with this pattern