org.pz.platypus.commandTypes
Class CommandR
java.lang.Object
org.pz.platypus.Command
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
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 java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
replacementRoot
private java.lang.String replacementRoot
cTable
private CommandTable cTable
CommandR
public CommandR(java.lang.String commandRoot,
java.lang.String attributes,
CommandTable ct)
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
- GDDtl
- TokenList to which the generated tokens are addedinCode
- 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 GDDsource
- the file and line # infocommandStr
- 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