SyntaxElement
Interface
A syntax element. This instance controls the matching and compiling for a specific element. The library it comes from controls where it can be matched.
public abstract
Methods
compile (Context, Match)
Abstract MethodThis is called during the second compiler pass, In->Out, L->R. Non-trivial syntax may need to override this to provide special behaviour.
Index | Type | Name |
---|---|---|
1 | Context | context |
2 | Match | match |
void
public abstract
getReturnType ()
MethodThe return type of this element, used for type tracking during compilation.
Type
public
match (String, Context)
MethodAttempts to match this element to a source string. The context can be accessed, but should not be modified here.
If the source does not match this element, return null
.
If the source does match this element, return a match object with the match data in.
Complex patterns are advised to override this and attempt faster
checks with string.contains(part)
before running the super matcher.
This will circumvent a complex regex having to be checked every time.
Index | Type | Name |
---|---|---|
1 | String | thing |
2 | Context | context |
Match
public
getHandler (HandlerType)
Abstract MethodFor basic syntax, this can return a method that will be used as a handle.
Index | Type | Name |
---|---|---|
1 | HandlerType | type |
Method
public abstract
getProvider ()
Abstract MethodThe library that provides this syntax element.
Library
public abstract
getPattern ()
Abstract MethodThe pattern metadata object.
Pattern
public abstract
hasHandler (HandlerType)
Abstract MethodIndex | Type | Name |
---|---|---|
1 | HandlerType | type |
boolean
public abstract
setHandler (HandlerType, Method)
Abstract MethodIndex | Type | Name |
---|---|---|
1 | HandlerType | type |
2 | Method | method |
void
public abstract
getSubState ()
MethodCompileState
public
prepareExpectedTypes (Context, Method)
MethodIndex | Type | Name |
---|---|---|
1 | Context | context |
2 | Method | target |
void
public
allowAsInputFor (Type)
MethodIndex | Type | Name |
---|---|---|
1 | Type | type |
boolean
public
preCompile (Context, Match)
MethodThis is called during the first compiler pass, Out->In, L->R. Simple elements will not need this, but lookahead or re-ordering operations can be run here.
Index | Type | Name |
---|---|---|
1 | Context | context |
2 | Match | match |
void
public
writeCall (MethodBuilder, Method, Context)
MethodThis writes a smart method call for the syntax, obeying rewrite rules. This can perform inlining, extraction and basic rewrites. This also has access to the bridge compiler.
Index | Type | Name |
---|---|---|
1 | MethodBuilder | builder |
2 | Method | method |
3 | Context | context |
void
public
findMethod (Class, String, Class...)
MethodA wrapped version of class.getMethod(...)
to avoid catching exceptions.
Index | Type | Name |
---|---|---|
1 | Class | owner |
2 | String | name |
3 | Class[] | parameters |
Method
public varargs
assemble (int, String...)
MethodFor script reassembly - taking the post-parse structure and generating a (new) text script from it.
This has not been implemented yet.
Index | Type | Name |
---|---|---|
1 | int | line |
2 | String[] | inputs |
String
public varargs
createDocument ()
MethodCreate the Skript documentation for this syntax.
Document
public