LanguageExtension
com.jsmacrosce.jsmacros.core.extensions.LanguageExtension
Provides a language implementation and file, exception, and guest-object handling to the extension system.
js
const languages = context.getCtx().runner.extensions.getAllLanguageExtensions().iterator();
while (languages.hasNext()) {
const language = languages.next();
Chat.log(language.getExtensionName() + ": " + language.defaultFileExtension());
}Nested types
Methods
defaultFileExtension
extensionMatch
extensionMatch(File file): LanguageExtension.ExtMatch#Classifies whether this extension supports a file; the result describes this extension, not the loader's final selection.
Parameters:
file: candidate file
Returns: ExtMatch.NOT_MATCH if unsupported, ExtMatch.MATCH for a match, or ExtMatch.MATCH_WITH_NAME for a language-name match preferred over ordinary matches
getLanguage
getLanguage(Core<?, ?> runner): BaseLanguage<?, ?>#Returns a language definition for the supplied core.
Parameters:
runner: the core for which to obtain a language definition
Returns: the language definition associated with
runnergetPriority
getPriority(): int#Returns the priority used to select a language extension. Higher values are normally preferred; file-match sorting negates this value, so
Integer.MIN_VALUE overflows and cannot serve as the lowest file-matching priority. Equal priorities have no guaranteed order.Returns: priority used for selection
isGuestObject
wrapException
wrapException(Throwable t): BaseWrappedException<?>#Returns a language-specific diagnostic wrapper when this extension recognizes the throwable.
Parameters:
t: throwable to inspect
Returns: language-specific wrapper, or
null if unrecognized