|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.extex.interpreter.max.Max
public abstract class Max
This is a reference implementation for a MAcro eXpander. The
macro expander is the core engine driving
The count register \ignorevoid determines how an undefined active
character or control sequence is encountered. If the value is greater than 0
then undefined code is ignored. Otherwise it leads to an error message.
This count parameter has been introduced by
The tokens register \everyjob contains the tokens to be inserted
at the beginning of every job.
The Count Parameter \ignorevoid
Syntax
The formal description of this primitive is the following:
〈ignorevoid〉
→ \ignorevoid 〈equals〉 〈number〉
Examples
\ignorevoid=1
The Tokens Parameter \everyjob
Syntax
The formal description of this primitive is the following:
〈everyjob〉
→ \everyjob 〈tokens〉
Examples
\everyjob={\message{Hello world.}}
| Constructor Summary | |
|---|---|
Max()
Creates a new object. |
|
| Method Summary | |
|---|---|
void |
configure(Configuration config)
Apply the configuration options found in the given configuration object. |
void |
enableLogging(java.util.logging.Logger theLogger)
Setter for the logger. |
void |
execute(Token token,
Context theContext,
Typesetter theTypesetter)
Tries to execute a token. |
void |
executeGroup()
Scan and execute tokens until the group ends. |
protected Token |
expand(Token token)
Take the token given and expand it as possible. |
Token |
expand(Token token,
Context context,
Typesetter typesetter)
Try to expand a single token and return the result. |
Tokens |
expand(Tokens tokens,
Typesetter typesetter)
Expand some tokens. |
protected Token |
expandUnproteced(Token token,
Tokens tokens)
Take the token given and expand it as possible while honoring the protected code. |
Context |
getContext()
Getter for the context |
ErrorHandler |
getErrorHandler()
Getter for the error handler. |
Interaction |
getInteraction()
Getter for the interaction mode. |
protected Localizer |
getLocalizer()
Getter for localizer. |
protected java.util.logging.Logger |
getLogger()
Getter for logger. |
Typesetter |
getTypesetter()
Getter for the typesetter. |
protected void |
initializeDate(java.util.Calendar calendar)
Initialize the date and time related primitives. |
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 resourceFinder)
Load a unit. |
void |
registerObserver(CommandObserver observer)
Add an observer for the expand event. |
void |
registerObserver(ErrorObserver observer)
Add an observer for the error event. |
void |
registerObserver(ExpandMacroObserver observer)
Add an observer for the expand event. |
void |
registerObserver(ExpandObserver observer)
Add an observer for the expand event. |
void |
registerObserver(LoadObserver observer)
Register an format load observer for later use. |
void |
registerObserver(StartObserver observer)
Add an observer for the start event. |
void |
registerObserver(StopObserver observer)
Add an observer for the stop event. |
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 |
setOutputStreamFactory(OutputStreamFactory factory)
This method takes an output stream factory for further use. |
void |
setTypesetter(Typesetter typesetter)
Setter for the typesetter. |
java.lang.Object |
visitActive(ActiveCharacterToken token,
java.lang.Object ignore)
This visit method is invoked on an active token. |
java.lang.Object |
visitCr(CrToken token,
java.lang.Object ignore)
This visit method is invoked on a cr token. |
java.lang.Object |
visitEscape(ControlSequenceToken token,
java.lang.Object ignore)
This visit method is invoked on an escape token. |
java.lang.Object |
visitLeftBrace(LeftBraceToken token,
java.lang.Object ignore)
This visit method is invoked on a left brace token. |
java.lang.Object |
visitLetter(LetterToken token,
java.lang.Object ignore)
This visit method is invoked on a letter token. |
java.lang.Object |
visitMacroParam(MacroParamToken token,
java.lang.Object ignore)
This visit method is invoked on a macro parameter token. |
java.lang.Object |
visitMathShift(MathShiftToken token,
java.lang.Object ignore)
This visit method is invoked on a math shift token. |
java.lang.Object |
visitOther(OtherToken token,
java.lang.Object ignore)
This visit method is invoked on an other token. |
java.lang.Object |
visitRightBrace(RightBraceToken token,
java.lang.Object ignore)
This visit method is invoked on a right brace token. |
java.lang.Object |
visitSpace(SpaceToken token,
java.lang.Object ignore)
This visit method is invoked on a space token. |
java.lang.Object |
visitSubMark(SubMarkToken token,
java.lang.Object ignore)
This visit method is invoked on a sub mark token. |
java.lang.Object |
visitSupMark(SupMarkToken token,
java.lang.Object ignore)
This visit method is invoked on a sup mark token. |
java.lang.Object |
visitTabMark(TabMarkToken token,
java.lang.Object ignore)
This visit method is invoked on a tab mark token. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.extex.interpreter.Interpreter |
|---|
setTokenStreamFactory |
| Methods inherited from interface org.extex.interpreter.TokenSource |
|---|
addStream, closeAllStreams, closeNextFileStream, 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 |
| Constructor Detail |
|---|
public Max()
| Method Detail |
|---|
public void configure(Configuration config)
throws ConfigurationMissingException
config - the configuration object to consider.
ConfigurationMissingException - in case of a configuration errorpublic void enableLogging(java.util.logging.Logger theLogger)
enableLogging in interface LogEnabledtheLogger - the new loggerLogEnabled.enableLogging(
java.util.logging.Logger)
public void execute(Token token,
Context theContext,
Typesetter theTypesetter)
throws HelpingException
TokenSource
execute in interface TokenSourcetoken - the Token to executetheContext - the interpreter contexttheTypesetter - the typesetter
HelpingException - in case of an errorTokenSource.execute(
org.extex.scanner.type.token.Token, Context, Typesetter)
public void executeGroup()
throws HelpingException
executeGroup in interface TokenSourceHelpingException - in case of an errorTokenSource.executeGroup()
protected Token expand(Token token)
throws HelpingException,
ConfigurationException,
TypesetterException
token - the token to expand
HelpingException - in case of an error
TypesetterException - in case of an error in the typesetter
ConfigurationException - in case of an configuration error
public Token expand(Token token,
Context context,
Typesetter typesetter)
throws HelpingException,
ConfigurationException,
TypesetterException
expand in interface TokenSourcetoken - the token to expandcontext - the interpreter contexttypesetter - the typesetter
HelpingException - in case of an error
ConfigurationException - in case of a configuration error
TypesetterException - in case of a typesetter errorTokenSource.expand(
org.extex.scanner.type.token.Token,
org.extex.interpreter.context.Context,
org.extex.typesetter.Typesetter)
public Tokens expand(Tokens tokens,
Typesetter typesetter)
throws InterpreterException,
HelpingException
expand in interface TokenSourcetokens - the tokens to expandtypesetter - the typesetter to use
HelpingException - in case of an error
InterpreterException - in case of an error
ConfigurationException - in case of an configuration problemTokenSource.expand(
org.extex.scanner.type.tokens.Tokens,
org.extex.typesetter.Typesetter)
protected Token expandUnproteced(Token token,
Tokens tokens)
throws HelpingException,
ConfigurationException,
TypesetterException
token - the token to expandtokens - the token list to pass to an Expander
HelpingException - in case of an error
TypesetterException - in case of an error in the typesetter
ConfigurationException - in case of an configuration errorpublic Context getContext()
getContext in interface InterpretergetContext()public ErrorHandler getErrorHandler()
null is returned.
getErrorHandler in interface InterpreterInterpreter.setErrorHandler(ErrorHandler)public Interaction getInteraction()
getInteraction in interface InterpreterInterpreter.setInteraction(Interaction)protected Localizer getLocalizer()
protected java.util.logging.Logger getLogger()
public Typesetter getTypesetter()
Interpreter
getTypesetter in interface InterpreterInterpreter.getTypesetter()
protected void initializeDate(java.util.Calendar calendar)
throws HelpingException
The count parameter \day is set automatically at the start of a job to the day of the current date. Thus it always is initialized to a value in the range of 1 to 31.
In the course of processing it can be used as any count register. This means that assignments, comparisons, and arithmetical operations work as for those.
The value is stored when a format file is written. Note however that this value is overwritten when the format file is read back in.
〈day〉
→ \day 〈equals〉 〈number〉
\the\day
The count parameter \month is set automatically at the start of a job to the month of the current date. Thus it always is initialized to a value in the range of 1 to 12.
In the course of processing it can be used as any count register. This means that assignments, comparisons, and arithmetical operations work as for those.
The value is stored when a format file is written. Note however that this value is overwritten when the format file is read back in.
〈month〉
→ \month 〈equals〉 〈number〉
\the\month
The count parameter \year is set automatically at the start of a job to the year of the current date.
In the course of processing it can be used as any count register. This means that assignments, comparisons, and arithmetical operations work as for those.
The value is stored when a format file is written. Note however that this value is overwritten when the format file is read back in.
〈year〉
→ \year 〈equals〉 〈number〉
\the\year
The count parameter \time is set automatically at the start of a job to the time of the current date. The time is the number of minutes since 0:00. Thus you can extract the current hour by dividing it by 60 and the current minute by computing the remainder modulo 60.
In the course of processing it can be used as any count register. This means that assignments, comparisons, and arithmetical operations work as for those.
The value is stored when a format file is written. Note however that this value is overwritten when the format file is read back in.
〈time〉
→ \time 〈equals〉 〈number〉
{\count0=\time
\divide\count0 60
\the\count0:% here \count0 contains the hour
\multiply\count1 -60
\advance\count0\time
\the\count0% here \count0 contains the minute
}%
calendar - the time and date when HelpingException - in case of an error
public void loadFormat(java.io.InputStream stream,
java.lang.String fmt,
java.lang.String contextType,
java.lang.String languageType)
throws java.io.IOException,
LoaderException
loadFormat in interface Interpreterstream - the stream to read the format information fromfmt - the name of the format to be loadedcontextType - the configuration name for the contextlanguageType - the configuration name for the language manager
LoaderException - in case that a class could not be found on the
class path or a wrong class is contained in the format
java.io.IOException - in case that an IO error occurs during the reading of
the formatInterpreter.loadFormat( java.io.InputStream,
java.lang.String, java.lang.String, java.lang.String)
public void loadUnit(java.lang.String name,
ResourceFinder resourceFinder)
loadUnit in interface Interpretername - the name of the configurationresourceFinder - the resource finder
ConfigurationException - in case of an errorInterpreter.loadUnit(String, ResourceFinder)public void registerObserver(CommandObserver observer)
registerObserver in interface CommandObservableobserver - the observer to addpublic void registerObserver(ErrorObserver observer)
registerObserver in interface ErrorObservableobserver - the observer to addpublic void registerObserver(ExpandMacroObserver observer)
registerObserver in interface ExpandMacroObservableobserver - the observer to addpublic void registerObserver(ExpandObserver observer)
registerObserver in interface ExpandObservableobserver - the observer to addpublic void registerObserver(LoadObserver observer)
LoadObservable
registerObserver in interface LoadObservableobserver - the observer to be registeredLoadObservable.registerObserver(
org.extex.interpreter.observer.load.LoadObserver)public void registerObserver(StartObserver observer)
registerObserver in interface StartObservableobserver - the observer to addpublic void registerObserver(StopObserver observer)
registerObserver in interface StopObservableobserver - the observer to add
public void run()
throws HelpingException,
TypesetterException
run in interface InterpreterConfigurationException - 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 typesetterInterpreter.run()
public void run(TokenStream stream)
throws HelpingException,
TypesetterException
run in interface Interpreterstream - the input stream to consider
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 typesetterInterpreter.run(
org.extex.scanner.api.TokenStream)public Context setContext(Context context)
setContext in interface Interpretercontext - the interpreter context
Interpreter.setContext(
org.extex.interpreter.context.Context)public void setErrorHandler(ErrorHandler handler)
null can be
used to delete the error handler currently set.
setErrorHandler in interface Interpreterhandler - the new error handlerInterpreter.setErrorHandler(
org.extex.interpreter.ErrorHandler)public void setFontFactory(CoreFontFactory fontFactory)
setFontFactory in interface InterpreterfontFactory - the new font factoryInterpreter.setFontFactory(
org.extex.font.CoreFontFactory)
public void setInteraction(Interaction interaction)
throws GeneralException
setInteraction in interface Interpreterinteraction - the interaction mode
GeneralException - in case of an errorInterpreter.setInteraction(
org.extex.interpreter.interaction.Interaction)
public void setJobname(java.lang.String jobname)
throws GeneralException
setJobname in interface Interpreterjobname - the new value for the job name
GeneralException - in case of an errorInterpreter.setJobname(java.lang.String)public void setOutputStreamFactory(OutputStreamFactory factory)
setOutputStreamFactory in interface OutputStreamConsumerfactory - the output stream factory to useOutputStreamConsumer.setOutputStreamFactory(
org.extex.backend.outputStream.OutputStreamFactory)public void setTypesetter(Typesetter typesetter)
setTypesetter in interface Interpretertypesetter - the new typesetterInterpreter.setTypesetter(
org.extex.typesetter.Typesetter)
public java.lang.Object visitActive(ActiveCharacterToken token,
java.lang.Object ignore)
throws java.lang.Exception
visitActive in interface TokenVisitor<java.lang.Object,java.lang.Object>token - the first argument to pass is the token to expand.ignore - the second argument is ignored
null
InterpreterException - in case of an error
ConfigurationException - in case of an configuration error
java.lang.Exception - in case of an errorTokenVisitor.visitActive(
org.extex.scanner.type.token.ActiveCharacterToken, java.lang.Object)
public java.lang.Object visitCr(CrToken token,
java.lang.Object ignore)
throws java.lang.Exception
visitCr in interface TokenVisitor<java.lang.Object,java.lang.Object>token - the first argument to pass is the token to expand.ignore - the second argument is ignored
null
InterpreterException - in case of an error
java.lang.Exception - in case of an errorTokenVisitor.visitCr(
org.extex.scanner.type.token.CrToken, java.lang.Object)
public java.lang.Object visitEscape(ControlSequenceToken token,
java.lang.Object ignore)
throws java.lang.Exception
visitEscape in interface TokenVisitor<java.lang.Object,java.lang.Object>token - the first argument to pass is the token to expand.ignore - the second argument is ignored
null
InterpreterException - in case of an error
ConfigurationException - in case of an configuration error
java.lang.Exception - in case of an errorTokenVisitor.visitEscape(
org.extex.scanner.type.token.ControlSequenceToken, java.lang.Object)
public java.lang.Object visitLeftBrace(LeftBraceToken token,
java.lang.Object ignore)
throws java.lang.Exception
visitLeftBrace in interface TokenVisitor<java.lang.Object,java.lang.Object>token - the first argument to pass is the token to expand.ignore - the second argument is ignored
null
InterpreterException - in case of an error
ConfigurationException - in case of an configuration error
java.lang.Exception - in case of an errorTokenVisitor.visitLeftBrace(
org.extex.scanner.type.token.LeftBraceToken, java.lang.Object)
public java.lang.Object visitLetter(LetterToken token,
java.lang.Object ignore)
throws java.lang.Exception
visitLetter in interface TokenVisitor<java.lang.Object,java.lang.Object>token - the first argument to pass is the token to expand.ignore - the second argument is ignored
null
InterpreterException - in case of an error
java.lang.Exception - in case of an errorTokenVisitor.visitLetter(
org.extex.scanner.type.token.LetterToken, java.lang.Object)
public java.lang.Object visitMacroParam(MacroParamToken token,
java.lang.Object ignore)
throws GeneralException
visitMacroParam in interface TokenVisitor<java.lang.Object,java.lang.Object>token - the first argument to pass is the token to expand.ignore - the second argument is ignored
null
GeneralException - in case of an errorTokenVisitor.visitMacroParam(
org.extex.scanner.type.token.MacroParamToken, java.lang.Object)
public java.lang.Object visitMathShift(MathShiftToken token,
java.lang.Object ignore)
throws java.lang.Exception
visitMathShift in interface TokenVisitor<java.lang.Object,java.lang.Object>token - the first argument to pass is the token to expand.ignore - the second argument is ignored
null
InterpreterException - in case of an error
ConfigurationException - in case of an configuration error
java.lang.Exception - in case of an errorTokenVisitor.visitMathShift(
org.extex.scanner.type.token.MathShiftToken, java.lang.Object)
public java.lang.Object visitOther(OtherToken token,
java.lang.Object ignore)
throws java.lang.Exception
visitOther in interface TokenVisitor<java.lang.Object,java.lang.Object>token - the first argument to pass is the token to expand.ignore - the second argument is ignored
null
InterpreterException - in case of an error
java.lang.Exception - in case of an errorTokenVisitor.visitOther(
org.extex.scanner.type.token.OtherToken, java.lang.Object)
public java.lang.Object visitRightBrace(RightBraceToken token,
java.lang.Object ignore)
throws java.lang.Exception
visitRightBrace in interface TokenVisitor<java.lang.Object,java.lang.Object>token - the first argument to pass is the token to expand.ignore - the second argument is ignored
null
InterpreterException - in case of an error
java.lang.Exception - in case of an errorTokenVisitor.visitRightBrace(
org.extex.scanner.type.token.RightBraceToken, java.lang.Object)
public java.lang.Object visitSpace(SpaceToken token,
java.lang.Object ignore)
throws GeneralException
visitSpace in interface TokenVisitor<java.lang.Object,java.lang.Object>token - the first argument to pass is the token to expand.ignore - the second argument is ignored
null
GeneralException - in case of an error
ConfigurationException - in case of an configuration errorTokenVisitor.visitSpace(
org.extex.scanner.type.token.SpaceToken, java.lang.Object)
public java.lang.Object visitSubMark(SubMarkToken token,
java.lang.Object ignore)
throws java.lang.Exception
visitSubMark in interface TokenVisitor<java.lang.Object,java.lang.Object>token - the first argument to pass is the token to expand.ignore - the second argument is ignored
null
InterpreterException - in case of an error
java.lang.Exception - in case of an errorTokenVisitor.visitSubMark(
org.extex.scanner.type.token.SubMarkToken, java.lang.Object)
public java.lang.Object visitSupMark(SupMarkToken token,
java.lang.Object ignore)
throws java.lang.Exception
visitSupMark in interface TokenVisitor<java.lang.Object,java.lang.Object>token - the first argument to pass is the token to expand.ignore - the second argument is ignored
null
java.lang.Exception - in case of an errorTokenVisitor.visitSupMark(
org.extex.scanner.type.token.SupMarkToken, java.lang.Object)
public java.lang.Object visitTabMark(TabMarkToken token,
java.lang.Object ignore)
throws java.lang.Exception
visitTabMark in interface TokenVisitor<java.lang.Object,java.lang.Object>token - the first argument to pass is the token to expand.ignore - the second argument is ignored
null
java.lang.Exception - in case of an error
ConfigurationException - in case of an configuration errorTokenVisitor.visitTabMark(
org.extex.scanner.type.token.TabMarkToken, java.lang.Object)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||