public BuiltinCommand addSimpleMathCommand(final String name, final MathInterpretation interpretation, final CommandHandler handler) { return addCommand(new BuiltinCommand(name, CommandType.SIMPLE, false, 0, Globals.MATH_MODE_ONLY, null, SnugglePackage.makeInterpretationMap(interpretation), handler, null, null)); }
public BuiltinEnvironment addEnvironment(final String name, final EnumSet<LaTeXMode> allowedModes, final LaTeXMode contentMode, final Interpretation interpretation, final EnvironmentHandler handler, final TextFlowContext context) { return addEnvironment(new BuiltinEnvironment(name, false, 0, allowedModes, contentMode, SnugglePackage.makeInterpretationMap(interpretation), handler, context)); }
public void addErrorCodes(ErrorCode... errorCodes) { for (ErrorCode errorCode : errorCodes) { addErrorCode(errorCode); } }
public BuiltinCommand addCombinerCommand(final String name, final EnumSet<LaTeXMode> allowedModes, final CombinerTargetMatcher combinerTargetMatcher, final CommandHandler handler, final TextFlowContext context) { return addCommand(new BuiltinCommand(name, CommandType.COMBINER, false, 0, allowedModes, null, null, handler, context, combinerTargetMatcher)); }
public BuiltinEnvironment addEnvironment(final BuiltinEnvironment environment) { if (isInputableTeXName(environment.getTeXName())) { builtinEnvironmentMap.put(environment.getTeXName(), environment); } return environment; }
/** * Returns the {@link BuiltinCommand} corresponding to LaTeX command called * <tt>\texName</tt>, or null if this command is not defined. */ public BuiltinCommand getBuiltinCommandByTeXName(String texName) { ConstraintUtilities.ensureNotNull(texName, "texName"); BuiltinCommand result = null; for (SnugglePackage snugglePackage : packages) { result = snugglePackage.getBuiltinCommandByTeXName(texName); if (result!=null) { break; } } return result; }
public static String formatErrorCodeName(ErrorCode errorCode) { String packageName = errorCode.getErrorGroup().getPackage().getName(); String errorCodeName = errorCode.getName(); return CorePackageDefinitions.CORE_PACKAGE_NAME.equals(packageName) ? errorCodeName : packageName + "/" + errorCodeName; }
public static String formatErrorGroup(ErrorGroup errorGroup) { ResourceBundle errorMessageBundle = errorGroup.getPackage().getErrorMessageBundle(); String result; if (errorMessageBundle!=null) { /* Use ResourceBundle specified to format error */ result = MessageFormat.format(errorMessageBundle.getString(errorGroup.toString()), ObjectUtilities.EMPTY_OBJECT_ARRAY); } else { /* No ResourceBundle specified, so do as best as we can */ result = "Error " + errorGroup.getName(); } return result; }
/** * Returns the {@link BuiltinEnvironment} corresponding to LaTeX environment * called <tt>texName</tt>, or null if this environment is not defined. */ public BuiltinEnvironment getBuiltinEnvironmentByTeXName(String texName) { ConstraintUtilities.ensureNotNull(texName, "texName"); BuiltinEnvironment result = null; for (SnugglePackage snugglePackage : packages) { result = snugglePackage.getBuiltinEnvironmentByTeXName(texName); if (result!=null) { break; } } return result; }
public BuiltinCommand addSimpleMathCommand(final String name, final MathInterpretation... interpretations) { return addSimpleMathCommand(name, interpretations, interpretableSimpleMathBuilder); }
protected Token(final FrozenSlice slice, final TokenType type, final LaTeXMode latexMode, final Interpretation... interpretations) { this.slice = slice; this.type = type; this.latexMode = latexMode; this.interpretationMap = SnugglePackage.makeInterpretationMap(interpretations); }
public BuiltinCommand addCombinerCommand(final String name, final EnumSet<LaTeXMode> allowedModes, final CombinerTargetMatcher combinerTargetMatcher, final CommandHandler handler, final TextFlowContext context) { return addCommand(new BuiltinCommand(name, CommandType.COMBINER, false, 0, allowedModes, null, null, handler, context, combinerTargetMatcher)); }
public BuiltinCommand addCommand(final BuiltinCommand command) { if (isInputableTeXName(command.getTeXName())) { builtinCommandMap.put(command.getTeXName(), command); } return command; }
/** * Returns the {@link BuiltinCommand} corresponding to LaTeX command called * <tt>\texName</tt>, or null if this command is not defined. */ public BuiltinCommand getBuiltinCommandByTeXName(String texName) { ConstraintUtilities.ensureNotNull(texName, "texName"); BuiltinCommand result = null; for (SnugglePackage snugglePackage : packages) { result = snugglePackage.getBuiltinCommandByTeXName(texName); if (result!=null) { break; } } return result; }
public static String formatErrorCodeName(ErrorCode errorCode) { String packageName = errorCode.getErrorGroup().getPackage().getName(); String errorCodeName = errorCode.getName(); return CorePackageDefinitions.CORE_PACKAGE_NAME.equals(packageName) ? errorCodeName : packageName + "/" + errorCodeName; }
public static String formatErrorGroup(ErrorGroup errorGroup) { ResourceBundle errorMessageBundle = errorGroup.getPackage().getErrorMessageBundle(); String result; if (errorMessageBundle!=null) { /* Use ResourceBundle specified to format error */ result = MessageFormat.format(errorMessageBundle.getString(errorGroup.toString()), ObjectUtilities.EMPTY_OBJECT_ARRAY); } else { /* No ResourceBundle specified, so do as best as we can */ result = "Error " + errorGroup.getName(); } return result; }
/** * Returns the {@link BuiltinEnvironment} corresponding to LaTeX environment * called <tt>texName</tt>, or null if this environment is not defined. */ public BuiltinEnvironment getBuiltinEnvironmentByTeXName(String texName) { ConstraintUtilities.ensureNotNull(texName, "texName"); BuiltinEnvironment result = null; for (SnugglePackage map : packages) { result = map.getBuiltinEnvironmentByTeXName(texName); if (result!=null) { break; } } return result; }
public BuiltinCommand addSimpleMathCommand(final String name, final MathInterpretation... interpretations) { return addSimpleMathCommand(name, interpretations, interpretableSimpleMathBuilder); }
protected Token(final FrozenSlice slice, final TokenType type, final LaTeXMode latexMode, final Interpretation... interpretations) { this.slice = slice; this.type = type; this.latexMode = latexMode; this.interpretationMap = SnugglePackage.makeInterpretationMap(interpretations); }
public BuiltinCommand addComplexCommandSameArgMode(final String name, final boolean allowOptionalArgument, final int arguments, final EnumSet<LaTeXMode> allowedModes, final Interpretation interpretation, final CommandHandler handler, final TextFlowContext context) { return addCommand(new BuiltinCommand(name, CommandType.COMPLEX, allowOptionalArgument, arguments, allowedModes, null, SnugglePackage.makeInterpretationMap(interpretation), handler, context, null)); }