private ByExpressionBuilder parseBy ( ) { ByExpressionBuilder by = new ByExpressionBuilder ( ) ; int x = _parseIndex ; Token token = scanToken ( ) ; if ( token == null ) throw new IllegalStateException ( L . l ( "expected field name at {0} in {1}" , x , _method . getName ( ) ) ) ; do { switch ( token ) { case IDENTIFIER : { StringBuilder sb = new StringBuilder ( ) ; sb . append ( _lexeme ) ; while ( peekToken ( ) == Token . IDENTIFIER ) { token = scanToken ( ) ; sb . append ( _lexeme ) ; } String term = fieldTerm ( sb . toString ( ) ) ; by . addField ( term ) ; break ; } case AND : { by . addAnd ( ) ; break ; } case EQ : case NE : case LT : case LE : case GT : case GE : by . term ( token ) ; break ; case GREATER : { if ( peekToken ( ) == Token . THAN ) { scanToken ( ) ; by . term ( Token . GT ) ; } else if ( peekToken ( ) == Token . EQ ) { scanToken ( ) ; by . term ( Token . GE ) ; } else { by . term ( Token . GT ) ; } break ; } case LESS : { if ( peekToken ( ) == Token . THAN ) { scanToken ( ) ; by . term ( Token . LT ) ; } else if ( peekToken ( ) == Token . EQ ) { scanToken ( ) ; by . term ( Token . LE ) ; } else { by . term ( Token . LT ) ; } break ; } case NOT : { if ( peekToken ( ) == Token . EQ ) { scanToken ( ) ; by . term ( Token . NE ) ; } else { by . term ( Token . NE ) ; } break ; } case OR : { by . addOr ( ) ; break ; } default : { throw new IllegalStateException ( _method . getName ( ) ) ; } } } while ( ( token = scanToken ( ) ) != Token . EOF ) ; return by ; }
Parse the by expression in the method name .