final Token previousToken ( ) throws IllegalStateException , NoSuchElementException { if ( currentToken == null ) { if ( completed ) { if ( tokens . isEmpty ( ) ) { throw new NoSuchElementException ( CommonI18n . noMoreContent . text ( ) ) ; } return tokens . get ( tokens . size ( ) - 1 ) ; } throw new IllegalStateException ( CommonI18n . startMethodMustBeCalledBeforeConsumingOrMatching . text ( ) ) ; } if ( tokenIterator . previousIndex ( ) == 0 ) { throw new NoSuchElementException ( CommonI18n . noMoreContent . text ( ) ) ; } return tokens . get ( tokenIterator . previousIndex ( ) - 1 ) ; }
Get the previous token . This does not modify the state .