org.pz.platypus.commandTypes
Class CommandR

java.lang.Object
  extended by org.pz.platypus.Command
      extended by org.pz.platypus.commandTypes.CommandR
All Implemented Interfaces:
ICommand

public class CommandR
extends Command

Command that is a Replacement for another command. Almost always a single command of a family Such as [fsize:12pt] which is mapped to [font|size:12pt]

Author:
alb //TODO: combine the two methods for extracting the root

Field Summary
private  CommandTable cTable
           
private  java.lang.String replacementRoot
           
 
Fields inherited from class org.pz.platypus.Command
parameterType, root, rootSubstitute, validInCode
 
Constructor Summary
CommandR(java.lang.String commandRoot, java.lang.String attributes, CommandTable ct)
           
 
Method Summary
(package private)  java.lang.String extractReplacementRoot(java.lang.String attribData)
          Reads the attribute data for the replacement command as it is found in the command table and extracts the command root that should replace the alias root.
 java.lang.String extractRoot(GDD gdd, Source source, java.lang.String commandStr)
          Extract the root.
(package private)  boolean passthroughReplacedCommands(GDD gdd)
          Looks up "....process_replaced_commands" to see whether the plugin needs a copy of the replaced command.
 int process(GDD gdd, ParseContext context, TokenList tl, boolean inCode)
          Processes the command, emits the corresponding token, and returns the number of chars in the lexeme.
 
Methods inherited from class org.pz.platypus.Command
getParamType, getRoot, getRootSubstitute, isAllowedInCode, notExecutedInCodeSection, process
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

replacementRoot

private java.lang.String replacementRoot

cTable

private CommandTable cTable
Constructor Detail

CommandR

public CommandR(java.lang.String commandRoot,
                java.lang.String attributes,
                CommandTable ct)
Method Detail

extractReplacementRoot

java.lang.String extractReplacementRoot(java.lang.String attribData)
Reads the attribute data for the replacement command as it is found in the command table and extracts the command root that should replace the alias root.

Parameters:
attribData - the data containing the replacement text for the command root
Returns:
the extracted replacement text; an empty string on error.

process

public int process(GDD gdd,
                   ParseContext context,
                   TokenList tl,
                   boolean inCode)
Processes the command, emits the corresponding token, and returns the number of chars in the lexeme.

Parameters:
gdd - GDD
tl - TokenList to which the generated tokens are added
inCode - Are we currently in a code section?
context - the parsing context
Returns:
number of chars to skip to get past the command string in the input. If negative, an error occurred.

extractRoot

public java.lang.String extractRoot(GDD gdd,
                                    Source source,
                                    java.lang.String commandStr)
Extract the root. We use the root-extraction routinein PlatypusParser.

Parameters:
gdd - the GDD
source - the file and line # info
commandStr - the substitute command from which to extract the root
Returns:
the root or empty string if an error occurred

passthroughReplacedCommands

boolean passthroughReplacedCommands(GDD gdd)
Looks up "....process_replaced_commands" to see whether the plugin needs a copy of the replaced command. Mostly used in listings.

Parameters:
gdd - the GDD*
Returns:
true if they are expanded by Platypus (the defaul); else false.


Copyright © 2008-10 Pacific Data Works LLC