Class ActionSignatureParser
java.lang.Object
org.tweetyproject.action.signature.parser.ActionSignatureParser
This class implements a parser for signatures of action descriptions.
The BNF for such signatures is given by: (starting symbol is SIG)
SIG ::== (SORTSDEC | DECLAR)*
SORTSDEC ::== ( SORTNAME "=" "{" (CONSTANTNAME ("," CONSTANTNAME)*)? "}" "\n" )*
DECLAR ::== (ACTIONDEC | FLUENTDEC)*
ACTIONDEC ::== "action" "(" ACTIONNAME ("(" SORTNAME ("," SORTNAME)* ")")? ")" "\n"
FLUENTDEC ::== "fluent" "(" FLUENTNAME ("(" SORTNAME ("," SORTNAME)* ")")? ")" "\n"
where SORTNAME, ACTIONNAME, FLUENTNAME, CONSTANTNAME are sequences of
symbols from {a,...,z,A,...,Z,0,...,9} with a letter at the beginning.
SIG ::== (SORTSDEC | DECLAR)*
SORTSDEC ::== ( SORTNAME "=" "{" (CONSTANTNAME ("," CONSTANTNAME)*)? "}" "\n" )*
DECLAR ::== (ACTIONDEC | FLUENTDEC)*
ACTIONDEC ::== "action" "(" ACTIONNAME ("(" SORTNAME ("," SORTNAME)* ")")? ")" "\n"
FLUENTDEC ::== "fluent" "(" FLUENTNAME ("(" SORTNAME ("," SORTNAME)* ")")? ")" "\n"
where SORTNAME, ACTIONNAME, FLUENTNAME, CONSTANTNAME are sequences of
symbols from {a,...,z,A,...,Z,0,...,9} with a letter at the beginning.
- Author:
- Sebastian Homann
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionparseSignature
(Reader reader) Parses the given reader into a signature of the given type.parseSignature
(String text) Parses the given text into a signature of the given type.parseSignatureFromFile
(String filename) Parses the file of the given filename into a signature.
-
Constructor Details
-
ActionSignatureParser
public ActionSignatureParser()
-
-
Method Details
-
parseSignatureFromFile
public ActionSignature parseSignatureFromFile(String filename) throws FileNotFoundException, IOException, ParserException Parses the file of the given filename into a signature.- Parameters:
filename
- the name of a file- Returns:
- a formula
- Throws:
FileNotFoundException
- if the file is not foundIOException
- if IO failsParserException
- some parsing exceptions may be added here.
-
parseSignature
Parses the given text into a signature of the given type.- Parameters:
text
- a string- Returns:
- a formula
- Throws:
IOException
- if IO failsParserException
- some parsing exceptions may be added here.
-
parseSignature
Parses the given reader into a signature of the given type.- Parameters:
reader
- a reader- Returns:
- a formula
- Throws:
IOException
- if IO failsParserException
- some parsing exceptions may be added here.
-