public abstract class AbstractCodeParser extends Object implements ICodeParser
Modifier and Type | Field and Description |
---|---|
static Pattern |
PARAMETER_PATTERN |
Constructor and Description |
---|
AbstractCodeParser() |
Modifier and Type | Method and Description |
---|---|
static Map<String,String> |
extractKeywords(String comment) |
ICompletionContext |
getContext(IScriptEngine scriptEngine,
Object resource,
String contents,
int position,
int selectionRange)
Parse the given piece of code into a language specific
ICompletionContext . |
String |
getHeaderComment(InputStream stream)
Default implementation to extract the first comment area from a stream.
|
SignatureInfo |
getSignatureInfo(InputStream stream)
Gets signature, certificates, provider and message-digest algorithm of signature, and content excluding signature block.
|
boolean |
isAcceptedBeforeHeader(String line)
Verify if a line of code is accepted before the header comment section.
|
public static final Pattern PARAMETER_PATTERN
public String getHeaderComment(InputStream stream)
getHeaderComment
in interface ICodeParser
stream
- code content streampublic boolean isAcceptedBeforeHeader(String line)
ICodeParser
isAcceptedBeforeHeader
in interface ICodeParser
line
- line of codetrue
when line is accepted before the comment headerpublic ICompletionContext getContext(IScriptEngine scriptEngine, Object resource, String contents, int position, int selectionRange)
ICodeParser
ICompletionContext
.getContext
in interface ICodeParser
scriptEngine
- running script engineresource
- resource instance to be parsedcontents
- code to be parsed (only up to cursor position)position
- cursor position within contentsselectionRange
- amount of selected characters from cursor positionICompletionContext
with parsed information if successful, null
in case invalid syntax given.public SignatureInfo getSignatureInfo(InputStream stream) throws ScriptSignatureException
ICodeParser
getSignatureInfo
in interface ICodeParser
stream
- provide InputStream
to get signature fromSignatureInfo
instance containing signature, certificates, provider and message-digest algorithm, and content excluding signature block
or null
if signature is not found or is not in proper formatScriptSignatureException
- when there is text after signature block or error occurs while reading from provided input stream