public class SyntaxMapper
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
MANIFEST_EXTENSIONS
"jEditor-extensions": The manifest key for the syntax extensions.
|
static java.lang.String |
MANIFEST_TYPES
"jEditor-type": The manifest key for the syntax types.
|
static java.lang.String |
MANIFEST_XMLDEF
"jEditor-def": The manifest key for the syntax XML definition.
|
Modifier and Type | Method and Description |
---|---|
boolean |
addSyntaxForExtension(java.lang.String ext,
Syntax syntax)
Add an existing syntax for a new extension.
|
TokenMarker |
createDefaultTokenMarker()
Return a default TokenMarker.
|
TokenMarker |
createTokenMarker(java.lang.String syntax)
Create the TokenMarker associated with a specified syntax.
|
java.lang.Class<TokenMarker> |
getClass(java.lang.String syntax)
Return the TokenMarker class associated with a syntax name.
|
java.lang.String |
getDefaultSyntax()
Return the default syntax.
|
static SyntaxMapper |
getInstance()
Return the unique instance.
|
Syntax |
getSyntax(java.lang.String name)
Return the Syntax for a syntax name.
|
java.util.Map<java.lang.String,Syntax> |
getSyntaxes()
Return the mapping between syntax names and their associated TokenMarker classes.
|
java.util.Map<java.lang.String,Syntax> |
getSyntaxExtensions()
Return the set of scripts extensions.
|
Syntax |
getSyntaxForExtension(java.io.File file)
Return the syntax associated with a file.
|
Syntax |
getSyntaxForExtension(java.lang.String ext)
Return the syntax associated with an extension, or null if there is no syntax for this extension.
|
java.util.SortedSet<java.lang.String> |
getSyntaxList()
Return the set of scripts names.
|
boolean |
hasSyntax(java.lang.String syntax)
Return true if there is a syntax for a specified name.
|
boolean |
hasSyntaxForExtension(java.lang.String ext)
Return true if there is a syntax for a specified file extension.
|
boolean |
installSyntax(java.lang.String key,
java.lang.String extension,
java.lang.String path)
Add a new Syntax for a Script.
|
boolean |
installSyntax(java.lang.String key,
java.lang.String extension,
java.lang.String path,
java.lang.ClassLoader loader)
Add a new Syntax for a Script.
|
boolean |
installSyntax(java.lang.String key,
java.lang.String extension,
java.lang.String path,
short type,
java.lang.ClassLoader loader)
Add a new Syntax for a Script.
|
boolean |
installSyntaxPack(java.net.URL syntaxPack)
Install all built-in Syntaxes from a syntax Pack.
|
boolean |
installSyntaxPack(java.net.URL syntaxPack,
boolean allowExisting)
Install all built-in Syntaxes from a syntax Pack.
|
void |
reset()
Reset the additional built-in Syntaxes.
|
void |
setDefaultSyntax(java.lang.String syntax)
Set the default syntax.
|
public static final java.lang.String MANIFEST_EXTENSIONS
public static final java.lang.String MANIFEST_TYPES
public static final java.lang.String MANIFEST_XMLDEF
public static SyntaxMapper getInstance()
public void reset()
public java.util.Map<java.lang.String,Syntax> getSyntaxExtensions()
public java.util.SortedSet<java.lang.String> getSyntaxList()
public boolean installSyntaxPack(java.net.URL syntaxPack)
TokenMarker
class. Two additional
properties files must be present in the jar file:
MANIFEST_EXTENSIONS
: the path of the file for the <extensions>-<syntax names> propertiesMANIFEST_TYPES
: the path of the file for the <syntax names>-<TokenMarker class path> propertiessyntaxPack
- the syntax packpublic boolean installSyntaxPack(java.net.URL syntaxPack, boolean allowExisting)
TokenMarker
class. Two additional
properties files must be present in the jar file:
MANIFEST_EXTENSIONS
: the path of the file for the <extensions>-<syntax names> propertiesMANIFEST_TYPES
: the path of the file for the <syntax names>-<TokenMarker class path> propertiessyntaxPack
- the syntax packallowExisting
- true fi it is allowed to override an existing syntaxpublic boolean installSyntax(java.lang.String key, java.lang.String extension, java.lang.String path)
key
- the syntax keyextension
- the syntax extensionpath
- the TokenMarker classpathpublic boolean installSyntax(java.lang.String key, java.lang.String extension, java.lang.String path, java.lang.ClassLoader loader)
key
- the syntax keyextension
- the syntax extensionpath
- the TokenMarker classpathloader
- the ClassLoaderpublic boolean installSyntax(java.lang.String key, java.lang.String extension, java.lang.String path, short type, java.lang.ClassLoader loader)
key
- the syntax keyextension
- the syntax extensionpath
- the TokenMarker classpathtype
- the syntax typeloader
- the ClassLoaderpublic Syntax getSyntax(java.lang.String name)
name
- the syntax namepublic java.util.Map<java.lang.String,Syntax> getSyntaxes()
public java.lang.Class<TokenMarker> getClass(java.lang.String syntax)
syntax
- the TokenMarker classpublic boolean hasSyntax(java.lang.String syntax)
syntax
- the syntax namepublic boolean hasSyntaxForExtension(java.lang.String ext)
ext
- the file extensionpublic boolean addSyntaxForExtension(java.lang.String ext, Syntax syntax)
ext
- the extensionsyntax
- the syntaxpublic Syntax getSyntaxForExtension(java.io.File file)
file
- the filepublic Syntax getSyntaxForExtension(java.lang.String ext)
ext
- the extensionpublic void setDefaultSyntax(java.lang.String syntax)
createDefaultTokenMarker()
.syntax
- the default syntaxpublic java.lang.String getDefaultSyntax()
createDefaultTokenMarker()
.public TokenMarker createDefaultTokenMarker()
createTokenMarker(java.lang.String)
with this syntax. If the method returns null, return a
BasicTokenMarker
BasicTokenMarker
public TokenMarker createTokenMarker(java.lang.String syntax)
syntax
- the syntax nameCopyright © 2016, 2017, 2018, 2019, 2023 Herve Girod. All Rights Reserved. Documentation and source under the MIT licence