org.extex.base.parser
Class ConstantGlueParser

java.lang.Object
  extended by org.extex.base.parser.ConstantGlueParser
All Implemented Interfaces:
GlueParser, Parser<Glue>

public class ConstantGlueParser
extends java.lang.Object
implements Parser<Glue>, GlueParser

This class provides a parser for constant glue entities.

Version:
$Revision:4399 $
Author:
Gerd Neugebauer, Michael Niedermair

Field Summary
protected static long serialVersionUID
          The constant serialVersionUID contains the id for serialization.
 
Constructor Summary
ConstantGlueParser()
          Creates a new object.
 
Method Summary
 Glue parse(Context context, TokenSource source, Typesetter typesetter)
          Parse a value of the given type
 Glue parseGlue(Context context, TokenSource source, Typesetter typesetter)
          Parse a glue value and return the result.
static Glue scan(TokenSource source, Context context, Typesetter typesetter)
          Creates a new object by parsing a token source.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

protected static final long serialVersionUID
The constant serialVersionUID contains the id for serialization.

See Also:
Constant Field Values
Constructor Detail

ConstantGlueParser

public ConstantGlueParser()
Creates a new object.

Method Detail

scan

public static Glue scan(TokenSource source,
                        Context context,
                        Typesetter typesetter)
                 throws HelpingException,
                        TypesetterException
Creates a new object by parsing a token source.
   ⟨glue⟩
     → ⟨component⟩
      |  ⟨component⟩ plus ⟨component⟩
      |  ⟨component⟩ minus ⟨component⟩
      |  ⟨component⟩ plus ⟨component⟩ minus ⟨component⟩

   ⟨component⟩
     → ⟨dimen;⟩
      |  ⟨float⟩ ⟨unit⟩

   ⟨unit⟩
     → fi
      |  fil
      |  fill
      |  filll    

TODO gene: documentation incomplete

Parameters:
source - the source to read new tokens from
context - the processing context
typesetter - the typesetter
Returns:
a new instance of a Glue
Throws:
HelpingException - in case of an error
TypesetterException - in case of an error in the typesetter

parse

public Glue parse(Context context,
                  TokenSource source,
                  Typesetter typesetter)
           throws HelpingException,
                  TypesetterException
Parse a value of the given type

Specified by:
parse in interface Parser<Glue>
Parameters:
context - the interpreter context
source - the source for new tokens
typesetter - the typesetter
Returns:
the value
Throws:
HelpingException - in case of an error
TypesetterException - in case of an error in the typesetter
See Also:
Parser.parse( org.extex.interpreter.context.Context, org.extex.interpreter.TokenSource, org.extex.typesetter.Typesetter)

parseGlue

public Glue parseGlue(Context context,
                      TokenSource source,
                      Typesetter typesetter)
               throws HelpingException,
                      TypesetterException
Parse a glue value and return the result. If no glue value can be obtained an exception is raised.

Specified by:
parseGlue in interface GlueParser
Parameters:
context - the interpreter context
source - the source for new tokens
typesetter - the typesetter
Returns:
the value
Throws:
HelpingException - in case of an error
TypesetterException - in case of an error in the typesetter
See Also:
GlueParser.parseGlue( org.extex.interpreter.context.Context, org.extex.interpreter.TokenSource, org.extex.typesetter.Typesetter)