com.hdcookbook.grin.io.text
Interface ExtensionParser

All Known Implementing Classes:
ExtensionParserList, FontStripExtensionCompiler, GenericExtensionParser, MediaExtensionParser, NullExtensionParser, RyanExtensionParser

public interface ExtensionParser

The ExtensionParser interface defines methods that handle parsing of the custom (user-defined) GRIN features, modifiers and commands from text-based GRIN script. These who are defining the custom GRIN subclasses and reading them from a text GRIN file should implement these methods accordingly.

See Also:
ExtensionParserList

Method Summary
 Command getCommand(Show show, java.lang.String typeName, Lexer lexer)
          Get a modifier command of the given type.
 Feature getFeature(Show show, java.lang.String typeName, java.lang.String name, Lexer lexer)
          Get a feature of the given type.
 Modifier getModifier(Show show, java.lang.String typeName, java.lang.String name, Lexer lexer)
          Get a modifier feature of the given type.
 

Method Detail

getFeature

Feature getFeature(Show show,
                   java.lang.String typeName,
                   java.lang.String name,
                   Lexer lexer)
                   throws java.io.IOException
Get a feature of the given type. The syntax of an extension feature is fixed at
     "feature" "modifier" namespace:type_name name feature_name arguments ";"
 
This method gets a Lexer instance that is pointed to the beginning of the arguments. The implementation of this method is expected to return an instance of a feature which loads on a standard JDK. It can be different from the feature class that is going to be used with the xlet in the BD-J environment.

Parameters:
show - The show being parsed
typeName - The name of the feature's type. This will always contain a ":".
name - The name of this instance of feature a list of commands if needed.
lexer - The lexer to parse arguments for this feature. The implementation of this method should parse up to ";" which indicates the end of the feature declaration.
Returns:
A feature if one of the given type is known, null otherwise
Throws:
java.io.IOException - if there's an error.

getModifier

Modifier getModifier(Show show,
                     java.lang.String typeName,
                     java.lang.String name,
                     Lexer lexer)
                     throws java.io.IOException
Get a modifier feature of the given type. The type name will have a colon in it. The sub-feature will automatically be set up for you.

The syntax of an extension feature is fixed at

     "feature" "modifier" namespace:type_name name feature_name arguments ";"
 
where feature_name is given iff the feature is a Modifier. This method gets a Lexer instance that is pointed to the beginning of the arguments. The implementation of this method is expected to return an instance of a modifier which loads on a standard JDK. It can be different from the modifier class that is going to be used with the xlet in the BD-J environment.

Parameters:
show - The show being parsed
typeName - The name of the feature's type. This will always contain a ":".
name - The name of this instance of feature a list of commands if needed.
lexer - The lexer to parse arguments for this feature. The implementation of this method should parse up to ";" which indicates the end of the feature declaration.
Returns:
A feature if one of the given type is known, null otherwise
Throws:
java.io.IOException - if there's an error.

getCommand

Command getCommand(Show show,
                   java.lang.String typeName,
                   Lexer lexer)
                   throws java.io.IOException
Get a modifier command of the given type. The implementation of this method is expected to return an instance of a command which loads on a standard JDK. It can be different from the command class that is going to be used with the xlet in the BD-J environment.

Parameters:
show - The show being parsed
typeName - The name of the commands's type. This will always contain a ":".
lexer - The lexer to parse arguments for this feature. The implementation of this method should parse up to ";" which indicates the end of the feature declaration.
Returns:
A command if one of the given type is known, null otherwise
Throws:
java.io.IOException - if there's an error.