Node T ( ) throws ScanException { Token t = getCurentToken ( ) ; expectNotNull ( t , "a LITERAL or '%'" ) ; switch ( t . getType ( ) ) { case Token . LITERAL : advanceTokenPointer ( ) ; return new Node ( Node . LITERAL , t . getValue ( ) ) ; case Token . PERCENT : advanceTokenPointer ( ) ; // System.out.println("% token found"); FormatInfo fi ; Token u = getCurentToken ( ) ; FormattingNode c ; expectNotNull ( u , "a FORMAT_MODIFIER, SIMPLE_KEYWORD or COMPOUND_KEYWORD" ) ; if ( u . getType ( ) == Token . FORMAT_MODIFIER ) { fi = FormatInfo . valueOf ( ( String ) u . getValue ( ) ) ; advanceTokenPointer ( ) ; c = C ( ) ; c . setFormatInfo ( fi ) ; } else { c = C ( ) ; } return c ; default : return null ; } }
T = LITERAL | % C | % FORMAT_MODIFIER C