Skip to content

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 ​

defaultFileExtension(): String#
Returns the default suffix used when creating a new file, without a leading period (for example, "js").
Returns: default suffix without a leading period

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 runner

getPriority ​

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 ​

isGuestObject(Object o): boolean#
Tests whether this extension recognizes an object as a language-specific guest representation.

Parameters:

  • o: value to inspect
Returns: true if recognized as a guest object; false otherwise

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