@@ -295,8 +295,8 @@ private static ImmutableList<Token> joinAdjacentLiteralsAndAdjacentWhitespace(Li
295295 StringBuilder accumulated = new StringBuilder ();
296296
297297 for (PeekingIterator <Token > tokens = peekingIterator (input .iterator ()); tokens .hasNext (); ) {
298- if (tokens .peek ().getType () == LITERAL ) {
299- accumulated .append (tokens .peek ().getValue ());
298+ if (tokens .peek ().type () == LITERAL ) {
299+ accumulated .append (tokens .peek ().value ());
300300 tokens .next ();
301301 continue ;
302302 }
@@ -315,14 +315,14 @@ private static ImmutableList<Token> joinAdjacentLiteralsAndAdjacentWhitespace(Li
315315 }
316316
317317 StringBuilder seenWhitespace = new StringBuilder ();
318- while (tokens .peek ().getType () == WHITESPACE ) {
319- seenWhitespace .append (tokens .next ().getValue ());
318+ while (tokens .peek ().type () == WHITESPACE ) {
319+ seenWhitespace .append (tokens .next ().value ());
320320 }
321321
322- if (tokens .peek ().getType () == LITERAL && tokens .peek ().getValue ().startsWith ("@" )) {
322+ if (tokens .peek ().type () == LITERAL && tokens .peek ().value ().startsWith ("@" )) {
323323 // OK, we're in the case described above.
324324 accumulated .append (" " );
325- accumulated .append (tokens .peek ().getValue ());
325+ accumulated .append (tokens .peek ().value ());
326326 tokens .next ();
327327 continue ;
328328 }
@@ -355,14 +355,13 @@ private static ImmutableList<Token> inferParagraphTags(List<Token> input) {
355355 ImmutableList .Builder <Token > output = ImmutableList .builder ();
356356
357357 for (PeekingIterator <Token > tokens = peekingIterator (input .iterator ()); tokens .hasNext (); ) {
358- if (tokens .peek ().getType () == LITERAL ) {
358+ if (tokens .peek ().type () == LITERAL ) {
359359 output .add (tokens .next ());
360360
361- if (tokens .peek ().getType () == WHITESPACE
362- && hasMultipleNewlines (tokens .peek ().getValue ())) {
361+ if (tokens .peek ().type () == WHITESPACE && hasMultipleNewlines (tokens .peek ().value ())) {
363362 output .add (tokens .next ());
364363
365- if (tokens .peek ().getType () == LITERAL ) {
364+ if (tokens .peek ().type () == LITERAL ) {
366365 output .add (new Token (PARAGRAPH_OPEN_TAG , "<p>" ));
367366 }
368367 }
@@ -393,11 +392,11 @@ private static ImmutableList<Token> optionalizeSpacesAfterLinks(List<Token> inpu
393392 ImmutableList .Builder <Token > output = ImmutableList .builder ();
394393
395394 for (PeekingIterator <Token > tokens = peekingIterator (input .iterator ()); tokens .hasNext (); ) {
396- if (tokens .peek ().getType () == LITERAL && tokens .peek ().getValue ().matches ("href=[^>]*>" )) {
395+ if (tokens .peek ().type () == LITERAL && tokens .peek ().value ().matches ("href=[^>]*>" )) {
397396 output .add (tokens .next ());
398397
399- if (tokens .peek ().getType () == WHITESPACE ) {
400- output .add (new Token (OPTIONAL_LINE_BREAK , tokens .next ().getValue ()));
398+ if (tokens .peek ().type () == WHITESPACE ) {
399+ output .add (new Token (OPTIONAL_LINE_BREAK , tokens .next ().value ()));
401400 }
402401 } else {
403402 output .add (tokens .next ());
@@ -422,18 +421,17 @@ private static ImmutableList<Token> deindentPreCodeBlocks(List<Token> input) {
422421 // TODO: b/323389829 - De-indent {@snippet ...} blocks, too.
423422 ImmutableList .Builder <Token > output = ImmutableList .builder ();
424423 for (PeekingIterator <Token > tokens = peekingIterator (input .iterator ()); tokens .hasNext (); ) {
425- if (tokens .peek ().getType () != PRE_OPEN_TAG ) {
424+ if (tokens .peek ().type () != PRE_OPEN_TAG ) {
426425 output .add (tokens .next ());
427426 continue ;
428427 }
429428
430429 output .add (tokens .next ());
431430 List <Token > initialNewlines = new ArrayList <>();
432- while (tokens .hasNext () && tokens .peek ().getType () == FORCED_NEWLINE ) {
431+ while (tokens .hasNext () && tokens .peek ().type () == FORCED_NEWLINE ) {
433432 initialNewlines .add (tokens .next ());
434433 }
435- if (tokens .peek ().getType () != LITERAL
436- || !tokens .peek ().getValue ().matches ("[ \t ]*[{]@code" )) {
434+ if (tokens .peek ().type () != LITERAL || !tokens .peek ().value ().matches ("[ \t ]*[{]@code" )) {
437435 output .addAll (initialNewlines );
438436 output .add (tokens .next ());
439437 continue ;
@@ -447,15 +445,15 @@ private static ImmutableList<Token> deindentPreCodeBlocks(List<Token> input) {
447445 private static void deindentPreCodeBlock (
448446 ImmutableList .Builder <Token > output , PeekingIterator <Token > tokens ) {
449447 Deque <Token > saved = new ArrayDeque <>();
450- output .add (new Token (LITERAL , tokens .next ().getValue ().trim ()));
451- while (tokens .hasNext () && tokens .peek ().getType () != PRE_CLOSE_TAG ) {
448+ output .add (new Token (LITERAL , tokens .next ().value ().trim ()));
449+ while (tokens .hasNext () && tokens .peek ().type () != PRE_CLOSE_TAG ) {
452450 Token token = tokens .next ();
453451 saved .addLast (token );
454452 }
455- while (!saved .isEmpty () && saved .peekFirst ().getType () == FORCED_NEWLINE ) {
453+ while (!saved .isEmpty () && saved .peekFirst ().type () == FORCED_NEWLINE ) {
456454 saved .removeFirst ();
457455 }
458- while (!saved .isEmpty () && saved .peekLast ().getType () == FORCED_NEWLINE ) {
456+ while (!saved .isEmpty () && saved .peekLast ().type () == FORCED_NEWLINE ) {
459457 saved .removeLast ();
460458 }
461459 if (saved .isEmpty ()) {
@@ -465,20 +463,19 @@ private static void deindentPreCodeBlock(
465463 // move the trailing `}` to its own line
466464 Token last = saved .peekLast ();
467465 boolean trailingBrace = false ;
468- if (last .getType () == LITERAL && last .getValue ().endsWith ("}" )) {
466+ if (last .type () == LITERAL && last .value ().endsWith ("}" )) {
469467 saved .removeLast ();
470468 if (last .length () > 1 ) {
471- saved .addLast (
472- new Token (LITERAL , last .getValue ().substring (0 , last .getValue ().length () - 1 )));
469+ saved .addLast (new Token (LITERAL , last .value ().substring (0 , last .value ().length () - 1 )));
473470 saved .addLast (new Token (FORCED_NEWLINE , null ));
474471 }
475472 trailingBrace = true ;
476473 }
477474
478475 int trim = -1 ;
479476 for (Token token : saved ) {
480- if (token .getType () == LITERAL ) {
481- int idx = CharMatcher .isNot (' ' ).indexIn (token .getValue ());
477+ if (token .type () == LITERAL ) {
478+ int idx = CharMatcher .isNot (' ' ).indexIn (token .value ());
482479 if (idx != -1 && (trim == -1 || idx < trim )) {
483480 trim = idx ;
484481 }
@@ -487,13 +484,11 @@ private static void deindentPreCodeBlock(
487484
488485 output .add (new Token (FORCED_NEWLINE , "\n " ));
489486 for (Token token : saved ) {
490- if (token .getType () == LITERAL ) {
487+ if (token .type () == LITERAL ) {
491488 output .add (
492489 new Token (
493490 LITERAL ,
494- trim > 0 && token .length () > trim
495- ? token .getValue ().substring (trim )
496- : token .getValue ()));
491+ trim > 0 && token .length () > trim ? token .value ().substring (trim ) : token .value ()));
497492 } else {
498493 output .add (token );
499494 }
0 commit comments