Package org.lifstools.jgoslin.parser
Class FattyAcidParser
Parser implementation for IUPAC Fatty acids nomenclature.
- Author:
- Dominik Kopczynski, Nils Hoffmann
-
Nested Class Summary
Nested classes/interfaces inherited from class org.lifstools.jgoslin.parser.Parser
Parser.DPNode, Parser.ParsingErrors -
Field Summary
Fields inherited from class org.lifstools.jgoslin.parser.Parser
avgPair, DEFAULT_QUOTE, EOF_RULE, EOF_RULE_NAME, EOF_SIGN, grammarName, MASK, nextFreeRuleIndex, NTtoNT, NTtoRule, originalTtoNT, quote, rightPair, RULE_ASSIGNMENT, RULE_SEPARATOR, RULE_TERMINAL, ruleToNT, SHIFT, START_RULE, substitution, TtoNT, usedEof -
Constructor Summary
ConstructorsConstructorDescriptionCreate a new instance of aFattyAcidParserwith default grammarDEFAULT_GRAMMARand default quoteStringFunctions.DEFAULT_QUOTEand defaultKnownFunctionalGroups.FattyAcidParser(KnownFunctionalGroups knownFunctionalGroups) Create a new instance of aFattyAcidParserwith default grammarDEFAULT_GRAMMARand default quoteStringFunctions.DEFAULT_QUOTE.FattyAcidParser(KnownFunctionalGroups knownFunctionalGroups, String grammarContent, char quote) Create a new instance of aFattyAcidParser. -
Method Summary
Modifier and TypeMethodDescriptionparse(String text, BaseParserEventHandler eventHandler) Parse the given text, constructing the output object of type T using the provided parser event handler.parse(String text, BaseParserEventHandler eventHandler, boolean with_exception) Parse the given text, constructing the output object of type T using the provided parser event handler.Allows the user to specify, if exceptions should be thrown on errors.Methods inherited from class org.lifstools.jgoslin.parser.Parser
add_terminal, collect_backwards, collect_backwards, collect_one_backwards, compute_rule_key, de_escape, extract_text_based_rules, fill_tree, get_next_free_rule_index, is_terminal, parse_regular, raise_events, readGrammar, top_nodes
-
Constructor Details
-
FattyAcidParser
public FattyAcidParser(KnownFunctionalGroups knownFunctionalGroups, String grammarContent, char quote) Create a new instance of aFattyAcidParser.- Parameters:
knownFunctionalGroups- the known functional groupsgrammarContent- the grammar text contentquote- the quotation character used in the grammar
-
FattyAcidParser
Create a new instance of aFattyAcidParserwith default grammarDEFAULT_GRAMMARand default quoteStringFunctions.DEFAULT_QUOTE.- Parameters:
knownFunctionalGroups- the known functional groups
-
FattyAcidParser
public FattyAcidParser()Create a new instance of aFattyAcidParserwith default grammarDEFAULT_GRAMMARand default quoteStringFunctions.DEFAULT_QUOTEand defaultKnownFunctionalGroups.
-
-
Method Details
-
parse
Description copied from class:ParserParse the given text, constructing the output object of type T using the provided parser event handler.- Overrides:
parsein classParser<LipidAdduct>- Parameters:
text- the text to parse.eventHandler- the parser event handler to process events created by the parser.- Returns:
- the parsed object of type T if successful, otherwise an exception will be thrown.
-
parse
Description copied from class:ParserParse the given text, constructing the output object of type T using the provided parser event handler.Allows the user to specify, if exceptions should be thrown on errors.- Overrides:
parsein classParser<LipidAdduct>- Parameters:
text- the text to parse.eventHandler- the parser event handler to process events created by the parser.with_exception- if true, throws exception if parsing was not successful.- Returns:
- the parsed object of type T if successful, otherwise
null, if throwError isfalse.
-
newEventHandler
- Specified by:
newEventHandlerin classParser<LipidAdduct>
-