public class ShallowParserFactory extends java.lang.Object
Constructor and Description |
---|
ShallowParserFactory() |
Modifier and Type | Method and Description |
---|---|
static IShallowParser |
createParser(ELanguage language)
Returns a new parser for the given language.
|
static java.util.EnumSet<ELanguage> |
getSupportedLanguages()
Returns all
ELanguage s for which we have shallow parsers. |
static boolean |
supportsLanguage(ELanguage language)
Returns whether the given language is supported by the parser factory.
|
public ShallowParserFactory()
public static IShallowParser createParser(ELanguage language) throws ShallowParserException
While we call this method "create" for consistency with other factories, the parsers are actually created only once and then cached for reuse. The reason is that parser creation may be expensive, especially when many very small code fragments are to be parsed. Reusing parsers is possible as the parsers do not hold state of a specific parse and even can be used concurrently in multiple threads.
ShallowParserException
- if the language is not (yet) supported by our framework.public static boolean supportsLanguage(ELanguage language)
public static java.util.EnumSet<ELanguage> getSupportedLanguages()
ELanguage
s for which we have shallow parsers.