org.extex.interpreter
Interface Interpreter

All Superinterfaces:
CountParser, DimenParser, GlueParser, TokenSource
All Known Implementing Classes:
Max, Moritz, StringSource

public interface Interpreter
extends TokenSource

This interface represents the outside view on an interpreter. It contains everything needed to set it up and make it run.

Version:
$Revision: 6265 $
Author:
Gerd Neugebauer, Michael Niedermair
See Also:
"TeX – The Program [1029]"

Method Summary
 Context getContext()
          Getter for the context
 ErrorHandler getErrorHandler()
          Getter for the error handler.
 Interaction getInteraction()
          Getter for the interaction mode.
 Typesetter getTypesetter()
          Getter for the typesetter.
 void loadFormat(java.io.InputStream stream, java.lang.String fmt, java.lang.String contextType, java.lang.String languageType)
          Load the format from an external source.
 void loadUnit(java.lang.String name, ResourceFinder finder)
          Load a unit.
 void run()
          Process the current token streams by repeatedly reading a single token and processing it until no token is left.
 void run(TokenStream stream)
          Add a token stream and start processing it.
 Context setContext(Context context)
          Setter for the context.
 void setErrorHandler(ErrorHandler handler)
          Setter for the error handler.
 void setFontFactory(CoreFontFactory fontFactory)
          Setter for the font factory
 void setInteraction(Interaction interaction)
          Setter for the interaction mode.
 void setJobname(java.lang.String jobname)
          Setter for the job name.
 void setTokenStreamFactory(TokenStreamFactory factory)
          Setter for the token stream factory.
 void setTypesetter(Typesetter typesetter)
          Setter for the typesetter.
 
Methods inherited from interface org.extex.interpreter.TokenSource
addStream, closeAllStreams, closeNextFileStream, execute, executeGroup, expand, expand, getBox, getControlSequence, getFont, getKeyword, getLastToken, getLocator, getNonSpace, getOptionalEquals, getToken, getTokens, getTokenStreamFactory, parse, push, push, push, register, scanCharacterCode, scanNonSpace, scanRegisterName, scanToken, scanTokens, scanTokensAsString, scanUnprotectedTokens, skipSpace, update
 
Methods inherited from interface org.extex.interpreter.parser.CountParser
parseInteger, parseNumber
 
Methods inherited from interface org.extex.interpreter.parser.DimenParser
parseDimen
 
Methods inherited from interface org.extex.interpreter.parser.GlueParser
parseGlue
 

Method Detail

getContext

Context getContext()
Getter for the context

Returns:
the context
See Also:
setContext(Context)

getErrorHandler

ErrorHandler getErrorHandler()
Getter for the error handler. The error handler might not be set. In this case null is returned.

Returns:
the error handler currently registered
See Also:
setErrorHandler(ErrorHandler)

getInteraction

Interaction getInteraction()
Getter for the interaction mode.

Returns:
the interaction mode
See Also:
setInteraction(Interaction)

getTypesetter

Typesetter getTypesetter()
Getter for the typesetter.

Returns:
the typesetter
See Also:
setTypesetter(Typesetter)

loadFormat

void loadFormat(java.io.InputStream stream,
                java.lang.String fmt,
                java.lang.String contextType,
                java.lang.String languageType)
                throws LoaderException,
                       java.io.IOException
Load the format from an external source.

Parameters:
stream - stream to read from
fmt - the name of the format to be loaded
contextType - name of the context from the configuration to use
languageType - name of the language from the configuration to use
Throws:
java.io.IOException - in case of an IO error
LoaderException - in case of an error during loading

loadUnit

void loadUnit(java.lang.String name,
              ResourceFinder finder)
              throws ConfigurationException
Load a unit.

Parameters:
name - the name of the configuration
finder - the resource finder
Throws:
ConfigurationException - in case of an error

run

void run()
         throws ConfigurationException,
                ErrorLimitException,
                HelpingException,
                TypesetterException
Process the current token streams by repeatedly reading a single token and processing it until no token is left. The visitor pattern is used to branch to the appropriate method for processing a single token.

Throws:
ConfigurationException - in case of a configuration error
ErrorLimitException - in case that the error limit has been reached
HelpingException - in case of another error
TypesetterException - in case of an error in the typesetter
See Also:
run(TokenStream)

run

void run(TokenStream stream)
         throws ConfigurationException,
                ErrorLimitException,
                HelpingException,
                TypesetterException
Add a token stream and start processing it.

Parameters:
stream - the input stream to consider
Throws:
ConfigurationException - in case of a configuration error
ErrorLimitException - in case that the error limit has been reached
HelpingException - in case of an error
TypesetterException - in case of an error in the typesetter
See Also:
run()

setContext

Context setContext(Context context)
Setter for the context. Use with care!

Parameters:
context - the interpreter context
Returns:
the old context
See Also:
getContext()

setErrorHandler

void setErrorHandler(ErrorHandler handler)
Setter for the error handler. The value of null can be used to delete the error handler currently set.

Parameters:
handler - the new error handler
See Also:
getErrorHandler()

setFontFactory

void setFontFactory(CoreFontFactory fontFactory)
Setter for the font factory

Parameters:
fontFactory - the new font factory

setInteraction

void setInteraction(Interaction interaction)
                    throws GeneralException
Setter for the interaction mode.

Parameters:
interaction - the interaction mode
Throws:
GeneralException - in case of an error
See Also:
getInteraction()

setJobname

void setJobname(java.lang.String jobname)
                throws GeneralException
Setter for the job name.

Parameters:
jobname - the new value for the job name
Throws:
GeneralException - in case of an error

setTokenStreamFactory

void setTokenStreamFactory(TokenStreamFactory factory)
                           throws ConfigurationException
Setter for the token stream factory. During the processing of the input several occasions might come up where new token streams are needed. In this case the factory can be used to acquire them.

Parameters:
factory - the token stream factory
Throws:
ConfigurationException - in case of en error in the configuration

setTypesetter

void setTypesetter(Typesetter typesetter)
Setter for the typesetter.

Parameters:
typesetter - the new typesetter
See Also:
getTypesetter()