public final class SnugglePackage extends Object
SnugglePackage defines a collection of BuiltinCommands, BuiltinEnvironments,
and ErrorCodes/ErrorGroups that can be registered with a SnuggleEngine
to add in extra functionality.
The core SnuggleTeX distribution comes with what is essentially a built-in package defined
in CorePackageDefinitions which provides its core functionality.
BuiltinCommand,
BuiltinEnvironment| Modifier and Type | Field and Description |
|---|---|
static InterpretableSimpleMathHandler |
interpretableSimpleMathBuilder
Share instance of
InterpretableSimpleMathHandler since it is stateless |
| Constructor and Description |
|---|
SnugglePackage(String name) |
| Modifier and Type | Method and Description |
|---|---|
BuiltinCommand |
addCombinerCommand(String name,
EnumSet<LaTeXMode> allowedModes,
CombinerTargetMatcher combinerTargetMatcher,
CommandHandler handler,
TextFlowContext context) |
BuiltinCommand |
addCommand(BuiltinCommand command) |
void |
addCommandInterpretation(String name,
Interpretation interpretation) |
BuiltinCommand |
addComplexCommand(String name,
boolean allowOptionalArgument,
int arguments,
EnumSet<LaTeXMode> allowedModes,
LaTeXMode[] argumentModes,
CommandHandler handler,
TextFlowContext context) |
BuiltinCommand |
addComplexCommandOneArg(String name,
boolean allowOptionalArgument,
EnumSet<LaTeXMode> allowedModes,
LaTeXMode argumentMode,
CommandHandler handler,
TextFlowContext context) |
BuiltinCommand |
addComplexCommandOneArg(String name,
boolean allowOptionalArgument,
EnumSet<LaTeXMode> allowedModes,
LaTeXMode argumentMode,
Interpretation interpretation,
CommandHandler handler,
TextFlowContext context) |
BuiltinCommand |
addComplexCommandSameArgMode(String name,
boolean allowOptionalArgument,
int arguments,
EnumSet<LaTeXMode> allowedModes,
CommandHandler handler,
TextFlowContext context) |
BuiltinCommand |
addComplexCommandSameArgMode(String name,
boolean allowOptionalArgument,
int arguments,
EnumSet<LaTeXMode> allowedModes,
Interpretation interpretation,
CommandHandler handler,
TextFlowContext context) |
BuiltinEnvironment |
addEnvironment(BuiltinEnvironment environment) |
BuiltinEnvironment |
addEnvironment(String name,
boolean allowOptionalArgument,
int argumentCount,
EnumSet<LaTeXMode> allowedModes,
LaTeXMode contentMode,
Interpretation[] interpretations,
EnvironmentHandler handler,
TextFlowContext context) |
BuiltinEnvironment |
addEnvironment(String name,
boolean allowOptionalArgument,
int argumentCount,
EnumSet<LaTeXMode> allowedModes,
LaTeXMode contentMode,
Interpretation interpretation,
EnvironmentHandler handler,
TextFlowContext context) |
BuiltinEnvironment |
addEnvironment(String name,
EnumSet<LaTeXMode> allowedModes,
LaTeXMode contentMode,
Interpretation[] interpretations,
EnvironmentHandler handler,
TextFlowContext context) |
BuiltinEnvironment |
addEnvironment(String name,
EnumSet<LaTeXMode> allowedModes,
LaTeXMode contentMode,
Interpretation interpretation,
EnvironmentHandler handler,
TextFlowContext context) |
void |
addErrorCode(ErrorCode errorCode) |
void |
addErrorCodes(ErrorCode... errorCodes) |
BuiltinCommand |
addMathCharacterCommand(MathCharacter mathCharacter) |
BuiltinCommand |
addMathCharacterCommandAlias(String name,
MathCharacter mathCharacter) |
BuiltinCommand |
addSimpleCommand(String name,
EnumSet<LaTeXMode> allowedModes,
CommandHandler handler,
TextFlowContext context) |
BuiltinCommand |
addSimpleCommand(String name,
EnumSet<LaTeXMode> allowedModes,
Interpretation[] interpretations,
CommandHandler handler,
TextFlowContext context) |
BuiltinCommand |
addSimpleCommand(String name,
EnumSet<LaTeXMode> allowedModes,
Interpretation interpretation,
CommandHandler handler,
TextFlowContext context) |
BuiltinCommand |
addSimpleMathCommand(String name,
MathInterpretation... interpretations) |
BuiltinCommand |
addSimpleMathCommand(String name,
MathInterpretation[] interpretations,
CommandHandler handler) |
BuiltinCommand |
addSimpleMathCommand(String name,
MathInterpretation interpretation,
CommandHandler handler) |
BuiltinCommand |
getBuiltinCommandByTeXName(String texName)
Returns the
BuiltinCommand corresponding to LaTeX command called
\texName defined by this package, or null if this command is not defined. |
Map<String,BuiltinCommand> |
getBuiltinCommandMap()
Returns a read-only
Map of all BuiltinCommands defined in this package,
keyed on the name texName of the command (\texName). |
BuiltinEnvironment |
getBuiltinEnvironmentByTeXName(String texName)
Returns the
BuiltinEnvironment corresponding to LaTeX environment
called texName defined by this package, or null if this environment is not defined. |
Map<String,BuiltinEnvironment> |
getBuiltinEnvironmentMap()
Returns a read-only
Map of all BuiltinEnvironments defined in this package,
keyed on the name of the environment. |
List<ErrorCode> |
getErrorCodes(ErrorGroup errorGroup)
Returns an unmodifiable view of the
ErrorCodes corresponding to the given
ErrorGroup. |
List<ErrorGroup> |
getErrorGroups()
Returns an unmodifiable view of all of the
ErrorGroups declared for this package. |
ResourceBundle |
getErrorMessageBundle()
Returns the
ResourceBundle used to format error messages. |
MathCharacter |
getMathCharacter(int codePoint)
Returns the
MathCharacter corresponding to the Unicode character at the given
input codePoint, or null if no MathCharacter is defined for this codepoint. |
Map<Integer,MathCharacter> |
getMathCharacterMap()
Returns a read-only
Map of all MathCharacters defined in this package,
keyed on input Unicode code point. |
String |
getName()
Returns the name for this package.
|
static boolean |
isInputableTeXName(String texName)
Tests whether the name of a command or environment is "inputable".
|
void |
loadMathCharacterAliases(String resourceLocation) |
void |
loadMathCharacterBigLimitTargets(String resourceLocation) |
void |
loadMathCharacterBrackets(String resourceLocation) |
void |
loadMathCharacterDefinitions(String resourceLocation) |
void |
loadMathCharacterNegations(String resourceLocation) |
void |
loadMathFunctionDefinitions(String resourceLocation) |
static EnumMap<InterpretationType,Interpretation> |
makeInterpretationMap(Interpretation... interpretations) |
static EnumMap<InterpretationType,Interpretation> |
makeInterpretationMap(Interpretation interpretation) |
void |
setErrorMessageBundle(ResourceBundle errorMessageBundle)
Sets the
ResourceBundle used to format error messages. |
public static final InterpretableSimpleMathHandler interpretableSimpleMathBuilder
InterpretableSimpleMathHandler since it is statelesspublic SnugglePackage(String name)
public String getName()
public List<ErrorGroup> getErrorGroups()
ErrorGroups declared for this package.public List<ErrorCode> getErrorCodes(ErrorGroup errorGroup)
ErrorCodes corresponding to the given
ErrorGroup.public ResourceBundle getErrorMessageBundle()
ResourceBundle used to format error messages.public void setErrorMessageBundle(ResourceBundle errorMessageBundle)
ResourceBundle used to format error messages.public Map<Integer,MathCharacter> getMathCharacterMap()
Map of all MathCharacters defined in this package,
keyed on input Unicode code point.public MathCharacter getMathCharacter(int codePoint)
MathCharacter corresponding to the Unicode character at the given
input codePoint, or null if no MathCharacter is defined for this codepoint.public Map<String,BuiltinCommand> getBuiltinCommandMap()
Map of all BuiltinCommands defined in this package,
keyed on the name texName of the command (\texName).public BuiltinCommand getBuiltinCommandByTeXName(String texName)
BuiltinCommand corresponding to LaTeX command called
\texName defined by this package, or null if this command is not defined.public Map<String,BuiltinEnvironment> getBuiltinEnvironmentMap()
Map of all BuiltinEnvironments defined in this package,
keyed on the name of the environment.public BuiltinEnvironment getBuiltinEnvironmentByTeXName(String texName)
BuiltinEnvironment corresponding to LaTeX environment
called texName defined by this package, or null if this environment is not defined.public static boolean isInputableTeXName(String texName)
texName - public void loadMathFunctionDefinitions(String resourceLocation)
public void loadMathCharacterDefinitions(String resourceLocation)
public void loadMathCharacterNegations(String resourceLocation)
public void loadMathCharacterBrackets(String resourceLocation)
public void loadMathCharacterAliases(String resourceLocation)
public void loadMathCharacterBigLimitTargets(String resourceLocation)
public BuiltinCommand addSimpleCommand(String name, EnumSet<LaTeXMode> allowedModes, CommandHandler handler, TextFlowContext context)
public BuiltinCommand addSimpleCommand(String name, EnumSet<LaTeXMode> allowedModes, Interpretation[] interpretations, CommandHandler handler, TextFlowContext context)
public BuiltinCommand addSimpleCommand(String name, EnumSet<LaTeXMode> allowedModes, Interpretation interpretation, CommandHandler handler, TextFlowContext context)
public BuiltinCommand addMathCharacterCommand(MathCharacter mathCharacter)
public BuiltinCommand addMathCharacterCommandAlias(String name, MathCharacter mathCharacter)
public BuiltinCommand addSimpleMathCommand(String name, MathInterpretation... interpretations)
public BuiltinCommand addSimpleMathCommand(String name, MathInterpretation interpretation, CommandHandler handler)
public BuiltinCommand addSimpleMathCommand(String name, MathInterpretation[] interpretations, CommandHandler handler)
public BuiltinCommand addCombinerCommand(String name, EnumSet<LaTeXMode> allowedModes, CombinerTargetMatcher combinerTargetMatcher, CommandHandler handler, TextFlowContext context)
public BuiltinCommand addComplexCommand(String name, boolean allowOptionalArgument, int arguments, EnumSet<LaTeXMode> allowedModes, LaTeXMode[] argumentModes, CommandHandler handler, TextFlowContext context)
public BuiltinCommand addComplexCommandSameArgMode(String name, boolean allowOptionalArgument, int arguments, EnumSet<LaTeXMode> allowedModes, CommandHandler handler, TextFlowContext context)
public BuiltinCommand addComplexCommandSameArgMode(String name, boolean allowOptionalArgument, int arguments, EnumSet<LaTeXMode> allowedModes, Interpretation interpretation, CommandHandler handler, TextFlowContext context)
public BuiltinCommand addComplexCommandOneArg(String name, boolean allowOptionalArgument, EnumSet<LaTeXMode> allowedModes, LaTeXMode argumentMode, CommandHandler handler, TextFlowContext context)
public BuiltinCommand addComplexCommandOneArg(String name, boolean allowOptionalArgument, EnumSet<LaTeXMode> allowedModes, LaTeXMode argumentMode, Interpretation interpretation, CommandHandler handler, TextFlowContext context)
public BuiltinCommand addCommand(BuiltinCommand command)
public void addCommandInterpretation(String name, Interpretation interpretation)
public BuiltinEnvironment addEnvironment(String name, EnumSet<LaTeXMode> allowedModes, LaTeXMode contentMode, Interpretation interpretation, EnvironmentHandler handler, TextFlowContext context)
public BuiltinEnvironment addEnvironment(String name, EnumSet<LaTeXMode> allowedModes, LaTeXMode contentMode, Interpretation[] interpretations, EnvironmentHandler handler, TextFlowContext context)
public BuiltinEnvironment addEnvironment(String name, boolean allowOptionalArgument, int argumentCount, EnumSet<LaTeXMode> allowedModes, LaTeXMode contentMode, Interpretation interpretation, EnvironmentHandler handler, TextFlowContext context)
public BuiltinEnvironment addEnvironment(String name, boolean allowOptionalArgument, int argumentCount, EnumSet<LaTeXMode> allowedModes, LaTeXMode contentMode, Interpretation[] interpretations, EnvironmentHandler handler, TextFlowContext context)
public BuiltinEnvironment addEnvironment(BuiltinEnvironment environment)
public void addErrorCode(ErrorCode errorCode)
public void addErrorCodes(ErrorCode... errorCodes)
public static EnumMap<InterpretationType,Interpretation> makeInterpretationMap(Interpretation interpretation)
public static EnumMap<InterpretationType,Interpretation> makeInterpretationMap(Interpretation... interpretations)
Copyright © 2008–2026 The University of Edinburgh. All rights reserved.