Package org.eclipse.ease
Class AbstractCodeParser
java.lang.Object
org.eclipse.ease.AbstractCodeParser
- All Implemented Interfaces:
ICodeParser
- Direct Known Subclasses:
GroovyCodeParser,JavaScriptCodeParser,JVMCompiledHeaderParser,PythonCodeParser,RubyCodeParser
public abstract class AbstractCodeParser extends Object implements ICodeParser
-
Field Summary
Fields Modifier and Type Field Description static PatternPARAMETER_PATTERN -
Constructor Summary
Constructors Constructor Description AbstractCodeParser() -
Method Summary
Modifier and Type Method Description static Map<String,String>extractKeywords(String comment)StringgetHeaderComment(InputStream stream)Default implementation to extract the first comment area from a stream.SignatureInfogetSignatureInfo(InputStream stream)Gets signature, certificates, provider and message-digest algorithm of signature, and content excluding signature block.booleanisAcceptedBeforeHeader(String line)Verify if a line of code is accepted before the header comment section.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.eclipse.ease.ICodeParser
getContext
-
Field Details
-
PARAMETER_PATTERN
-
-
Constructor Details
-
AbstractCodeParser
public AbstractCodeParser()
-
-
Method Details
-
extractKeywords
-
getHeaderComment
Default implementation to extract the first comment area from a stream. Looks for block and line comments. Might be replaced by more specific implementations for dedicated languages.- Specified by:
getHeaderCommentin interfaceICodeParser- Parameters:
stream- code content stream- Returns:
- comment data without decoration characters (eg: '*' at beginning of each line)
-
isAcceptedBeforeHeader
Description copied from interface:ICodeParserVerify if a line of code is accepted before the header comment section. This allows special magic tokens to be placed before the header comment as some script languages depend on that.- Specified by:
isAcceptedBeforeHeaderin interfaceICodeParser- Parameters:
line- line of code- Returns:
truewhen line is accepted before the comment header
-
getSignatureInfo
Description copied from interface:ICodeParserGets signature, certificates, provider and message-digest algorithm of signature, and content excluding signature block.- Specified by:
getSignatureInfoin interfaceICodeParser- Parameters:
stream- provideInputStreamto get signature from- Returns:
SignatureInfoinstance containing signature, certificates, provider and message-digest algorithm, and content excluding signature block ornullif signature is not found or is not in proper format- Throws:
ScriptSignatureException- when there is text after signature block or error occurs while reading from provided input stream
-