Code example for StreamTokenizer

Methods: slashSlashComments, slashStarComments, wordChars

0
 
    /** 
     * Configures passed tokenizer accordingly to supported syntax. 
     */ 
    protected StreamTokenizer configure(StreamTokenizer st) {
        st.slashSlashComments(true);
        st.slashStarComments(true);
        st.wordChars('_', '_');
        st.wordChars('$', '$');
        return st;
    } 
 
    /** 
     * Performs the main parsing loop. Starts with creating and configuring a 
     * StreamTokenizer instance; then tries to recognize <i>keystore </i> or 
     * <i>grant </i> keyword. When found, invokes read method corresponding to 
     * the clause and collects result to the passed collection. 
     *  
     * @param r 
     *            policy stream reader 
     * @param grantEntries