org.extex.base.parser.dimen
Class LengthParser

java.lang.Object
  extended by org.extex.base.parser.dimen.LengthParser

public final class LengthParser
extends java.lang.Object

This class provides some static methods to parse an expression and return its value.

Version:
$Revision: 4726 $
Author:
Gerd Neugebauer

Method Summary
static void evalTerm(Accumulator accumulator, Context context, TokenSource source, Typesetter typesetter)
          Evaluate a terminal.
static Dimen parse(Context context, TokenSource source, Typesetter typesetter)
          Creates a new object from a token stream.
static void register(java.lang.String name, Function function)
          Register a function.
static void register(java.lang.String name, Function0 function)
          Register a function of arity 0 alas a constant.
static void register(java.lang.String name, Function1 function)
          Register a function of arity 1.
static void register(java.lang.String name, org.extex.base.parser.dimen.Function2 function)
          Register a function of arity 2.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

evalTerm

public static void evalTerm(Accumulator accumulator,
                            Context context,
                            TokenSource source,
                            Typesetter typesetter)
                     throws HelpingException,
                            TypesetterException
Evaluate a terminal.

Parameters:
accumulator - the accumulator to receive the result
context - the interpreter context
source - the source for new tokens
typesetter - the typesetter
Throws:
HelpingException - in case of an error
TypesetterException - in case of an error in the typesetter

parse

public static Dimen parse(Context context,
                          TokenSource source,
                          Typesetter typesetter)
                   throws HelpingException,
                          TypesetterException
Creates a new object from a token stream.

Parameters:
context - the interpreter context
source - the source for next tokens
typesetter - the typesetter
Returns:
a new instance with the value acquired
Throws:
HelpingException - in case of an error
TypesetterException - in case of an error in the typesetter

register

public static void register(java.lang.String name,
                            Function function)
Register a function.

Parameters:
name - the name of the function
function - the function

register

public static void register(java.lang.String name,
                            Function0 function)
Register a function of arity 0 alas a constant.

Parameters:
name - the name of the function
function - the function

register

public static void register(java.lang.String name,
                            Function1 function)
Register a function of arity 1.

Parameters:
name - the name of the function
function - the function

register

public static void register(java.lang.String name,
                            org.extex.base.parser.dimen.Function2 function)
Register a function of arity 2.

Parameters:
name - the name of the function
function - the function