private static Token styleToken ( final Token token , final String [ ] options ) { Token styledToken = token ; for ( String option : options ) { int splitIndex = option . indexOf ( ' ' ) ; if ( splitIndex == - 1 ) { InternalLogger . log ( Level . ERROR , "No value set for '" + option . trim ( ) + "'" ) ; } else { String key = option . substring ( 0 , splitIndex ) . trim ( ) ; String value = option . substring ( splitIndex + 1 ) . trim ( ) ; int number ; try { number = parsePositiveInteger ( value ) ; } catch ( NumberFormatException ex ) { InternalLogger . log ( Level . ERROR , "'" + value + "' is an invalid value for '" + key + "'" ) ; continue ; } if ( "min-size" . equals ( key ) ) { styledToken = new MinimumSizeToken ( styledToken , number ) ; } else if ( "indent" . equals ( key ) ) { styledToken = new IndentationToken ( styledToken , number ) ; } else { InternalLogger . log ( Level . ERROR , "Unknown style option: '" + key + "'" ) ; } } } return styledToken ; }
Creates style decorators for a token .