dlvhex
2.5.0
|
The complete class to perform syntactic checking on the modular logic programs. More...
#include <include/dlvhex2/MLPSyntaxChecker.h>
Public Member Functions | |
MLPSyntaxChecker (ProgramCtx &ctx1) | |
Constructor. | |
bool | verifySyntax () |
Overall validation. | |
Private Member Functions | |
int | getArity (std::string predName) |
Detects the arity of a predicate. | |
int | getArity (ID idp) |
Detects the arity of a predicate. | |
std::string | getStringBeforeSeparator (const std::string &s) |
Extracts the module prefix from a string. | |
std::string | getStringAfterSeparator (const std::string &s) |
Strips off the module prefix from a string. | |
bool | verifyPredInputsArityModuleCall (ID module, Tuple tuple) |
Checks the input arities of modules. | |
bool | verifyPredOutputArityModuleCall (ID module, ID outputpredicate) |
Checks the output arities of modules. | |
bool | verifyAllModuleCalls () |
Overall validation. | |
Private Attributes | |
ProgramCtx | ctx |
ProgramCtx. |
The complete class to perform syntactic checking on the modular logic programs.
Definition at line 30 of file MLPSyntaxChecker.h.
Constructor.
ctx1 | ProgramCtx. |
Definition at line 43 of file MLPSyntaxChecker.cpp.
References ctx.
int MLPSyntaxChecker::getArity | ( | std::string | predName | ) | [private] |
Detects the arity of a predicate.
predName | Predicate name. |
predName
. Definition at line 50 of file MLPSyntaxChecker.cpp.
References ctx, and ProgramCtx::registry().
Referenced by verifyPredInputsArityModuleCall(), and verifyPredOutputArityModuleCall().
int MLPSyntaxChecker::getArity | ( | ID | idp | ) | [private] |
Detects the arity of a predicate.
predName
. Definition at line 57 of file MLPSyntaxChecker.cpp.
References ctx, ID::isTerm(), and ProgramCtx::registry().
std::string MLPSyntaxChecker::getStringAfterSeparator | ( | const std::string & | s | ) | [private] |
Strips off the module prefix from a string.
s | String. |
s
without module prefix. Definition at line 75 of file MLPSyntaxChecker.cpp.
References MODULEPREFIXSEPARATOR.
Referenced by verifyPredInputsArityModuleCall(), and verifyPredOutputArityModuleCall().
std::string MLPSyntaxChecker::getStringBeforeSeparator | ( | const std::string & | s | ) | [private] |
Extracts the module prefix from a string.
s | String. |
s
. Definition at line 67 of file MLPSyntaxChecker.cpp.
References MODULEPREFIXSEPARATOR.
Referenced by verifyPredInputsArityModuleCall(), and verifyPredOutputArityModuleCall().
bool MLPSyntaxChecker::verifyAllModuleCalls | ( | ) | [private] |
Overall validation.
Definition at line 166 of file MLPSyntaxChecker.cpp.
References ctx, DBGLOG, ModuleAtom::inputs, ModuleAtom::outputAtom, ModuleAtom::predicate, ProgramCtx::registry(), verifyPredInputsArityModuleCall(), and verifyPredOutputArityModuleCall().
Referenced by verifySyntax().
bool MLPSyntaxChecker::verifyPredInputsArityModuleCall | ( | ID | module, |
Tuple | tuple | ||
) | [private] |
Checks the input arities of modules.
module | Program module. |
tuple | Input tuple. |
tuple
is a valid input to module
and false otherwise. Definition at line 87 of file MLPSyntaxChecker.cpp.
References ctx, DBGLOG, getArity(), getStringAfterSeparator(), getStringBeforeSeparator(), Module::inputList, MODULE_FAIL(), and ProgramCtx::registry().
Referenced by verifyAllModuleCalls().
bool MLPSyntaxChecker::verifyPredOutputArityModuleCall | ( | ID | module, |
ID | outputpredicate | ||
) | [private] |
Checks the output arities of modules.
module | Program module. |
outputpredicate | Output predicate. |
outputpredicate
is a output from module
and false otherwise. Definition at line 138 of file MLPSyntaxChecker.cpp.
References ctx, DBGLOG, getArity(), getStringAfterSeparator(), getStringBeforeSeparator(), MODULEPREFIXSEPARATOR, ProgramCtx::registry(), and Atom::tuple.
Referenced by verifyAllModuleCalls().
bool MLPSyntaxChecker::verifySyntax | ( | ) |
Overall validation.
Definition at line 189 of file MLPSyntaxChecker.cpp.
References verifyAllModuleCalls().
Referenced by BOOST_AUTO_TEST_CASE(), ModuleSyntaxCheckState::moduleSyntaxCheck(), testABBAProgram(), testAFinProgram(), testCardinalityProgram(), testCsProgram(), testDisjunctionProgram(), testInconsistentProgram(), testIndirectionProgram(), testIStratified2Program(), testIStratifiedProgram(), testNegationProgram(), testNoticStratifiedProgram(), testOneMainModules(), testReachabilityNonGroundProgram(), testTwoMainModules(), testTwoModuleCalls1(), and testTwoModuleCalls2().
ProgramCtx MLPSyntaxChecker::ctx [private] |
Definition at line 34 of file MLPSyntaxChecker.h.
Referenced by getArity(), MLPSyntaxChecker(), verifyAllModuleCalls(), verifyPredInputsArityModuleCall(), and verifyPredOutputArityModuleCall().