org.extex.interpreter.type
Class AbstractAssignment

java.lang.Object
  extended by org.extex.interpreter.type.AbstractCode
      extended by org.extex.interpreter.type.AbstractAssignment
All Implemented Interfaces:
java.io.Serializable, Code
Direct Known Subclasses:
AbstractColor, AbstractCount, AbstractDimen, AbstractMuskip, AbstractSkip, AbstractToks, Advance, Batchmode, BoolDef, CatcodePrimitive, Chardef, Clearocplists, Colordef, Def, Delcode, Divide, Dp, Edef, Errorstopmode, Export, Fontdimen, FontPrimitive, HashToksDef, Ht, Hyphenchar, Integer, IntegerCode, Interactionmode, JavaDef, Lccode, Let, Mathchardef, MathcodePrimitive, Multiply, MuskipParameter, NamedBool, NamedFont, NamedHashToks, NamedPair, NamedReal, NamedTransform, Namespace, NativeDef, Nonstopmode, OcplistPrimitive, OcpPrimitive, Odelcode, Omathchardef, OmathcodePrimitive, PairDef, Prevdepth, Read, Readline, RealDef, Scrollmode, Setbox, Sfcode, Skewchar, TransformDef, Uccode, Wd

public abstract class AbstractAssignment
extends AbstractCode

This is the base class for assignments. The assignments are implemented like any Code with the exception that the method assign is used instead of the method execute.

This abstract class takes care of the treatment of the \afterassignment token and the \globaldefs declaration.

The Count Parameter \globaldefs

The count register \globaldefs contains the indicator that an assignment should be performed globally. If its value is greater than zero then all assignments are global. Otherwise the grouping is honored. In this sense setting \globaldefs to a positive value implicitly prefixes all assignments with \global.

Syntax

The formal description of this primitive is the following:
    ⟨globaldefs⟩
       → \globaldefs ⟨equals⟩ ⟨number⟩  

Examples

    \globaldefs=1  

Version:
$Revision: 6447 $
Author:
Gerd Neugebauer
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.extex.interpreter.type.AbstractCode
serialVersionUID
 
Constructor Summary
AbstractAssignment(CodeToken token)
          Creates a new object.
 
Method Summary
abstract  void assign(Flags prefix, Context context, TokenSource source, Typesetter typesetter)
          The method assign is the core of the functionality of execute().
 void execute(Flags prefix, Context context, TokenSource source, Typesetter typesetter)
          This method takes the first token and executes it.
 
Methods inherited from class org.extex.interpreter.type.AbstractCode
getLocalizer, getName, getToken, isIf, isOuter, readResolve, toString, toText, toText
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractAssignment

public AbstractAssignment(CodeToken token)
Creates a new object.

Parameters:
token - the initial token for the primitive
Method Detail

assign

public abstract void assign(Flags prefix,
                            Context context,
                            TokenSource source,
                            Typesetter typesetter)
                     throws ConfigurationException,
                            HelpingException,
                            TypesetterException
The method assign is the core of the functionality of execute(). This method is preferable to execute() since the execute() method provided in this class takes care of \afterassignment and \globaldefs as well.

Parameters:
prefix - the prefix controlling the execution
context - the interpreter context
source - the token source
typesetter - the typesetter
Throws:
ConfigurationException - in case of an configuration error
HelpingException - in case of an error
TypesetterException - in case of an error in the typesetter

execute

public final void execute(Flags prefix,
                          Context context,
                          TokenSource source,
                          Typesetter typesetter)
                   throws HelpingException,
                          TypesetterException
This method takes the first token and executes it. The result is placed on the stack. This operation might have side effects. To execute a token it might be necessary to consume further tokens.

Specified by:
execute in interface Code
Overrides:
execute in class AbstractCode
Parameters:
prefix - the prefix controlling the execution
context - the interpreter context
source - the token source
typesetter - the typesetter
Throws:
HelpingException - in case of an error
TypesetterException - in case of an error in the typesetter
See Also:
Code.execute( org.extex.interpreter.Flags, org.extex.interpreter.context.Context, org.extex.interpreter.TokenSource, org.extex.typesetter.Typesetter)