|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.dante.extex.interpreter.max.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 |
enableLocalization(Localizer theLocalizer)
Setter for the getLocalizer(). |
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. |
Tokens |
expand(Tokens tokens,
Typesetter ts)
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)
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(FontFactory 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 de.dante.extex.interpreter.Interpreter |
setTokenStreamFactory |
Methods inherited from interface de.dante.extex.interpreter.TokenSource |
addStream, closeAllStreams, closeNextFileStream, getBox, getControlSequence, getFont, getKeyword, getLastToken, getLocator, getNonSpace, getOptionalEquals, getToken, getTokens, getTokenStreamFactory, push, push, push, scanCharacterCode, scanNonSpace, scanNumber, scanNumber, scanRegisterName, scanToken, scanTokens, scanTokensAsString, scanUnprotectedTokens, skipSpace, update |
Constructor Detail |
public Max()
Method Detail |
public void configure(Configuration config) throws ConfigurationException
config
- the configuration object to consider.
ConfigurationException
- in case of a configuration errorpublic void enableLocalization(Localizer theLocalizer)
enableLocalization
in interface Localizable
theLocalizer
- the getLocalizer() to useLocalizable.enableLocalization(
de.dante.util.framework.i18n.Localizer)
public void enableLogging(java.util.logging.Logger theLogger)
enableLogging
in interface LogEnabled
theLogger
- the new loggerLogEnabled.enableLogging(
java.util.logging.Logger)
public void execute(Token token, Context theContext, Typesetter theTypesetter) throws InterpreterException
TokenSource
execute
in interface TokenSource
token
- the Token to executetheContext
- the interpreter contexttheTypesetter
- the typesetter
InterpreterException
- in case of an errorTokenSource.execute(
de.dante.extex.scanner.type.token.Token, Context, Typesetter)
public void executeGroup() throws InterpreterException
TokenSource
executeGroup
in interface TokenSource
InterpreterException
- in case of an errorTokenSource.executeGroup()
protected Token expand(Token token) throws InterpreterException
token
- the token to expand
InterpreterException
- in case of an errorpublic Tokens expand(Tokens tokens, Typesetter ts) throws InterpreterException
TokenSource
expand
in interface TokenSource
tokens
- the tokens to expandts
- the typesetter to use
InterpreterException
TokenSource.expand(
de.dante.extex.interpreter.type.tokens.Tokens,
de.dante.extex.typesetter.Typesetter)
protected Token expandUnproteced(Token token, Tokens tokens) throws InterpreterException
token
- the token to expandtokens
- the token list to pass to an Expander
InterpreterException
- in case of an errorpublic Context getContext()
Interpreter
getContext
in interface Interpreter
getContext()
public ErrorHandler getErrorHandler()
null
is returned.
getErrorHandler
in interface Interpreter
Interpreter.setErrorHandler(ErrorHandler)
public Interaction getInteraction()
getInteraction
in interface Interpreter
Interpreter.setInteraction(Interaction)
protected Localizer getLocalizer()
protected java.util.logging.Logger getLogger()
public Typesetter getTypesetter()
Interpreter
getTypesetter
in interface Interpreter
Interpreter.getTypesetter()
protected void initializeDate(java.util.Calendar calendar) throws InterpreterException
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 InterpreterException
- in case of an errorpublic 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 Interpreter
stream
- 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 formatde.dante.extex.interpreter.Interpreter#loadFormat(
java.io.InputStream, java.lang.String)
public void loadUnit(java.lang.String name) throws ConfigurationException
Interpreter
loadUnit
in interface Interpreter
name
- the name of the configuration
ConfigurationException
- in case of an errorInterpreter.loadUnit(java.lang.String)
public void registerObserver(CommandObserver observer)
registerObserver
in interface CommandObservable
observer
- the observer to addpublic void registerObserver(ErrorObserver observer)
registerObserver
in interface ErrorObservable
observer
- the observer to addpublic void registerObserver(ExpandMacroObserver observer)
registerObserver
in interface ExpandMacroObservable
observer
- the observer to addpublic void registerObserver(ExpandObserver observer)
registerObserver
in interface ExpandObservable
observer
- the observer to addpublic void registerObserver(LoadObserver observer)
LoadObservable
registerObserver
in interface LoadObservable
observer
- the observer to be registeredLoadObservable.registerObserver(
de.dante.extex.interpreter.observer.load.LoadObserver)
public void registerObserver(StartObserver observer)
registerObserver
in interface StartObservable
observer
- the observer to addpublic void registerObserver(StopObserver observer)
registerObserver
in interface StopObservable
observer
- the observer to addpublic void run() throws ConfigurationException, InterpreterException
Interpreter
run
in interface Interpreter
ConfigurationException
- in case of a configuration error
InterpreterException
- in case of another errorInterpreter.run()
public void run(TokenStream stream) throws ConfigurationException, InterpreterException
Interpreter
run
in interface Interpreter
stream
- the input stream to consider
InterpreterException
- in case of another error
ConfigurationException
- in case of a configuration errorInterpreter.run(
de.dante.extex.scanner.stream.TokenStream)
public Context setContext(Context context)
Interpreter
setContext
in interface Interpreter
context
- the interpreter context
Interpreter.setContext(
de.dante.extex.interpreter.context.Context)
public void setErrorHandler(ErrorHandler handler)
null
can be
used to delete the error handler currently set.
setErrorHandler
in interface Interpreter
handler
- the new error handlerInterpreter.getErrorHandler()
public void setFontFactory(FontFactory fontFactory)
Interpreter
setFontFactory
in interface Interpreter
fontFactory
- the new font factoryInterpreter.setFontFactory(
de.dante.extex.font.FontFactory)
public void setInteraction(Interaction interaction) throws GeneralException
setInteraction
in interface Interpreter
interaction
- the interaction mode
GeneralException
- in case of an errorInterpreter.getInteraction()
public void setJobname(java.lang.String jobname) throws GeneralException
Interpreter
setJobname
in interface Interpreter
jobname
- the new value for the job name
GeneralException
- in case of an errorInterpreter.setJobname(java.lang.String)
public void setOutputStreamFactory(OutputStreamFactory factory)
OutputStreamConsumer
setOutputStreamFactory
in interface OutputStreamConsumer
factory
- the output stream factory to useOutputStreamConsumer.setOutputStreamFactory(
de.dante.extex.backend.outputStream.OutputStreamFactory)
public void setTypesetter(Typesetter typesetter)
Interpreter
setTypesetter
in interface Interpreter
typesetter
- the new typesetterInterpreter.setTypesetter(
de.dante.extex.typesetter.Typesetter)
public java.lang.Object visitActive(ActiveCharacterToken token, java.lang.Object ignore) throws InterpreterException
visitActive
in interface TokenVisitor
token
- the first argument to pass is the token to expand.ignore
- the second argument is ignored
null
InterpreterException
- in case of an errorTokenVisitor.visitActive(
de.dante.extex.scanner.type.token.ActiveCharacterToken,
java.lang.Object)
public java.lang.Object visitCr(CrToken token, java.lang.Object ignore) throws InterpreterException
visitCr
in interface TokenVisitor
token
- the first argument to pass is the token to expand.ignore
- the second argument is ignored
null
InterpreterException
- in case of an errorTokenVisitor.visitCr(
de.dante.extex.scanner.type.token.CrToken, java.lang.Object)
public java.lang.Object visitEscape(ControlSequenceToken token, java.lang.Object ignore) throws InterpreterException
visitEscape
in interface TokenVisitor
token
- the first argument to pass is the token to expand.ignore
- the second argument is ignored
null
InterpreterException
- in case of an errorTokenVisitor.visitEscape(
de.dante.extex.scanner.type.token.ControlSequenceToken,
java.lang.Object)
public java.lang.Object visitLeftBrace(LeftBraceToken token, java.lang.Object ignore) throws InterpreterException
visitLeftBrace
in interface TokenVisitor
token
- the first argument to pass is the token to expand.ignore
- the second argument is ignored
null
InterpreterException
- in case of an errorTokenVisitor.visitLeftBrace(
de.dante.extex.scanner.type.token.LeftBraceToken,
java.lang.Object)
public java.lang.Object visitLetter(LetterToken token, java.lang.Object ignore) throws InterpreterException
visitLetter
in interface TokenVisitor
token
- the first argument to pass is the token to expand.ignore
- the second argument is ignored
null
InterpreterException
- in case of an errorTokenVisitor.visitLetter(
de.dante.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
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(
de.dante.extex.scanner.type.token.MacroParamToken,
java.lang.Object)
public java.lang.Object visitMathShift(MathShiftToken token, java.lang.Object ignore) throws InterpreterException
visitMathShift
in interface TokenVisitor
token
- the first argument to pass is the token to expand.ignore
- the second argument is ignored
null
InterpreterException
- in case of an errorTokenVisitor.visitMathShift(
de.dante.extex.scanner.type.token.MathShiftToken,
java.lang.Object)
public java.lang.Object visitOther(OtherToken token, java.lang.Object ignore) throws InterpreterException
visitOther
in interface TokenVisitor
token
- the first argument to pass is the token to expand.ignore
- the second argument is ignored
null
InterpreterException
- in case of an errorTokenVisitor.visitOther(
de.dante.extex.scanner.type.token.OtherToken,
java.lang.Object)
public java.lang.Object visitRightBrace(RightBraceToken token, java.lang.Object ignore) throws InterpreterException
visitRightBrace
in interface TokenVisitor
token
- the first argument to pass is the token to expand.ignore
- the second argument is ignored
null
InterpreterException
- in case of an errorTokenVisitor.visitRightBrace(
de.dante.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
token
- the first argument to pass is the token to expand.ignore
- the second argument is ignored
null
GeneralException
- in case of an errorTokenVisitor.visitSpace(
de.dante.extex.scanner.type.token.SpaceToken,
java.lang.Object)
public java.lang.Object visitSubMark(SubMarkToken token, java.lang.Object ignore) throws InterpreterException
visitSubMark
in interface TokenVisitor
token
- the first argument to pass is the token to expand.ignore
- the second argument is ignored
null
InterpreterException
- in case of an errorTokenVisitor.visitSubMark(
de.dante.extex.scanner.type.token.SubMarkToken,
java.lang.Object)
public java.lang.Object visitSupMark(SupMarkToken token, java.lang.Object ignore) throws InterpreterException
visitSupMark
in interface TokenVisitor
token
- the first argument to pass is the token to expand.ignore
- the second argument is ignored
null
InterpreterException
- in case of an errorTokenVisitor.visitSupMark(
de.dante.extex.scanner.type.token.SupMarkToken,
java.lang.Object)
public java.lang.Object visitTabMark(TabMarkToken token, java.lang.Object ignore) throws InterpreterException
visitTabMark
in interface TokenVisitor
token
- the first argument to pass is the token to expand.ignore
- the second argument is ignored
null
InterpreterException
- in case of an errorTokenVisitor.visitTabMark(
de.dante.extex.scanner.type.token.TabMarkToken,
java.lang.Object)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |