001    /*
002     * Copyright 2000-2006 Omnicore Software, Hans Kratz & Dennis Strein GbR,
003     *                     Geert Bevin <gbevin[remove] at uwyn dot com>.
004     * Distributed under the terms of either:
005     * - the common development and distribution license (CDDL), v1.0; or
006     * - the GNU Lesser General Public License, v2.1 or later
007     * $Id: ExplicitStateHighlighter.java 3108 2006-03-13 18:03:00Z gbevin $
008     */
009    package com.uwyn.jhighlight.highlighter;
010    
011    import java.io.IOException;
012    import java.io.Reader;
013    
014    /**
015     * Provides access to the lexical scanning of a highlighted language.
016     * 
017     * @author Omnicore Software
018     * @author Hans Kratz &amp; Dennis Strein GbR
019     * @author Geert Bevin (gbevin[remove] at uwyn dot com)
020     * @version $Revision: 3108 $
021     * @since 1.0
022     */
023    public interface ExplicitStateHighlighter
024    {
025            /**
026             * Sets the reader that will be used to receive the text data.
027             * 
028             * @param reader the <code>Reader</code> that has to be used
029             */
030            void setReader(Reader reader);
031    
032            /**
033             * Obtain the next token from the scanner.
034             * 
035             * @return one of the tokens that are define in the scanner
036             * @exception IOException when an error occurred during the parsing of
037             * the reader
038             */
039            byte getNextToken() throws IOException;
040    
041            /**
042             * Returns the length of the matched text region.
043             * 
044             * @return the length of the matched text region
045             */
046            int getTokenLength();
047    }