org.extex.unit.omega.ocp.util
Class OcpUtil

java.lang.Object
  extended by org.extex.unit.omega.ocp.util.OcpUtil

public final class OcpUtil
extends java.lang.Object

This class contains utility methods.

Version:
$Revision:4411 $
Author:
Gerd Neugebauer

Method Summary
static Ocp scanOcp(Context context, TokenSource source, Typesetter typesetter, ResourceFinder finder)
          Get an ocp.
static OcpProgram scanOcpCode(Context context, TokenSource source, Typesetter typesetter, java.lang.String primitive)
          San the input for a control sequence and extract an ΩCP from its code value.
static java.lang.String scanOcpFileName(Context context, TokenSource source, CodeToken primitive)
          Scan an ΩCP file name.
static java.lang.String scanOcpFileName(TokenSource source, Context context)
          Get an ocp file name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

scanOcpFileName

public static java.lang.String scanOcpFileName(Context context,
                                               TokenSource source,
                                               CodeToken primitive)
                                        throws HelpingException,
                                               TypesetterException
Scan an ΩCP file name. This method parses the following syntactic entity:
   ⟨ocp file name⟩ 
The scanning is performed in one of two ways:
  • If the first token is a left brace then a block is read until the matching right brace is found. On the way the tokens are expanded.
  • Otherwise tokens are read until a space token is encountered.

Parameters:
context - the processing context
source - the source for new tokens
primitive - the name of the primitive for reporting
Returns:
the file name as string
Throws:
HelpingException - in case of an error
TypesetterException - in case of an error in the typesetter

scanOcpFileName

public static java.lang.String scanOcpFileName(TokenSource source,
                                               Context context)
                                        throws HelpingException
Get an ocp file name.

Parameters:
source - the source for new tokens
context - the interpreter context
Returns:
the ocp file name
Throws:
HelpingException - in case of an error

scanOcp

public static Ocp scanOcp(Context context,
                          TokenSource source,
                          Typesetter typesetter,
                          ResourceFinder finder)
                   throws HelpingException
Get an ocp.

Parameters:
context - the interpreter context
source - the source for new tokens
typesetter - the typesetter
finder - the resource finder to use
Returns:
the ocp file name
Throws:
HelpingException - in case of an error

scanOcpCode

public static OcpProgram scanOcpCode(Context context,
                                     TokenSource source,
                                     Typesetter typesetter,
                                     java.lang.String primitive)
                              throws HelpingException
San the input for a control sequence and extract an ΩCP from its code value.

Parameters:
context - the interpreter context
source - the source for new tokens
typesetter - the typesetter
primitive - the name of the primitive for error messages
Returns:
the ΩCP program stored in the code area
Throws:
HelpingException - in case of an error