knowrob  2.1.0
A Knowledge Base System for Cognition-enabled Robots
knowrob::parsers::terms Namespace Reference

Typedefs

using TermRule = boost::spirit::qi::rule< std::string::const_iterator, std::shared_ptr< Term >(), boost::spirit::ascii::space_type >
 
using VariableRule = boost::spirit::qi::rule< std::string::const_iterator, std::shared_ptr< Variable >(), boost::spirit::ascii::space_type >
 
using AtomRule = boost::spirit::qi::rule< std::string::const_iterator, std::shared_ptr< Atom >(), boost::spirit::ascii::space_type >
 
using FunctionRule = boost::spirit::qi::rule< std::string::const_iterator, std::shared_ptr< Function >(), boost::spirit::ascii::space_type >
 

Functions

AtomRuleiri ()
 
AtomRuleatom_regular ()
 
AtomRuleatom ()
 
TermRulestring ()
 
TermRulenumber ()
 
TermRuleblank ()
 
TermRulexsd ()
 
TermRuleatomic ()
 
VariableRulevar_upper ()
 
VariableRulevar_question ()
 
VariableRulevar ()
 
TermRuleatomic_list ()
 
TermRulenil ()
 
TermRulekey_value_pair ()
 
TermRuleoption ()
 
TermRuleoptions ()
 
TermRuleoptions_or_nil ()
 
TermRuleterm ()
 
FunctionRulefunction ()
 
auto & term_and_function ()
 

Typedef Documentation

◆ AtomRule

typedef boost::spirit::qi::rule< std::string::const_iterator, std::shared_ptr< Atom >(), boost::spirit::ascii::space_type > knowrob::parsers::terms::AtomRule

Definition at line 18 of file terms.h.

◆ FunctionRule

typedef boost::spirit::qi::rule< std::string::const_iterator, std::shared_ptr< Function >(), boost::spirit::ascii::space_type > knowrob::parsers::terms::FunctionRule

Definition at line 19 of file terms.h.

◆ TermRule

typedef boost::spirit::qi::rule< std::string::const_iterator, std::shared_ptr< Term >(), boost::spirit::ascii::space_type > knowrob::parsers::terms::TermRule

Definition at line 16 of file terms.h.

◆ VariableRule

typedef boost::spirit::qi::rule< std::string::const_iterator, std::shared_ptr< Variable >(), boost::spirit::ascii::space_type > knowrob::parsers::terms::VariableRule

Definition at line 17 of file terms.h.

Function Documentation

◆ atom()

AtomRule & knowrob::parsers::terms::atom ( )

Definition at line 59 of file terms.cpp.

59  {
61  }
StringRule & iri()
Definition: strings.cpp:49
AtomRule & atom_regular()
Definition: terms.cpp:55
#define RETURN_ATOM_RULE(expr)
Definition: terms.cpp:19

◆ atom_regular()

AtomRule & knowrob::parsers::terms::atom_regular ( )

Definition at line 55 of file terms.cpp.

55  {
56  RETURN_ATOM_RULE(str::atom()[qi::_val = boost::phoenix::bind(&makeAtom, qi::_1)]);
57  }
StringRule & atom()
Definition: strings.cpp:54

◆ atomic()

TermRule & knowrob::parsers::terms::atomic ( )

Definition at line 79 of file terms.cpp.

79  {
80  RETURN_TERM_RULE(atom() | string() | xsd() | number());
81  }
StringRule & number()
Definition: strings.cpp:66
TermRule & xsd()
Definition: terms.cpp:75
#define RETURN_TERM_RULE(expr)
Definition: terms.cpp:18

◆ atomic_list()

TermRule & knowrob::parsers::terms::atomic_list ( )

Definition at line 95 of file terms.cpp.

95  {
96  RETURN_TERM_RULE(('[' >> (atomic() % ',') >> ']')[qi::_val = ptr_<ListTerm>()(qi::_1)]);
97  }
TermRule & atomic()
Definition: terms.cpp:79

◆ blank()

TermRule & knowrob::parsers::terms::blank ( )

Definition at line 71 of file terms.cpp.

71  {
72  RETURN_TERM_RULE(str::blank()[qi::_val = ptr_<String>()(qi::_1)]);
73  }
StringRule & blank()
Definition: strings.cpp:62

◆ function()

FunctionRule & knowrob::parsers::terms::function ( )

Definition at line 140 of file terms.cpp.

140  {
142  }
auto & term_and_function()
Definition: terms.cpp:131
#define RETURN_FUNCTION_RULE(expr)
Definition: terms.cpp:21

◆ iri()

AtomRule & knowrob::parsers::terms::iri ( )

Definition at line 51 of file terms.cpp.

51  {
52  RETURN_ATOM_RULE(str::iri()[qi::_val = boost::phoenix::bind(&makeIRI, qi::_1)]);
53  }

◆ key_value_pair()

TermRule & knowrob::parsers::terms::key_value_pair ( )

Definition at line 103 of file terms.cpp.

103  {
104  static auto equalFunctor = Atom::Tabled("=");
105  RETURN_TERM_RULE((atom() >> '=' >> atomic())
106  [qi::_val = ptr_<Function>()(equalFunctor,
107  boost::phoenix::bind(&createTermVector2, qi::_1, qi::_2))]);
108  }
const AtomPtr equalFunctor
Definition: GraphBuiltin.h:73

◆ nil()

TermRule & knowrob::parsers::terms::nil ( )

Definition at line 99 of file terms.cpp.

99  {
100  RETURN_TERM_RULE(qi::attr(ListTerm::nil()));
101  }
TermRule & nil()
Definition: terms.cpp:99

◆ number()

TermRule & knowrob::parsers::terms::number ( )

Definition at line 67 of file terms.cpp.

67  {
68  RETURN_TERM_RULE(qi::double_[qi::_val = ptr_<Double>()(qi::_1)]);
69  }

◆ option()

TermRule & knowrob::parsers::terms::option ( )

Definition at line 110 of file terms.cpp.

110  {
112  }
TermRule & key_value_pair()
Definition: terms.cpp:103

◆ options()

TermRule & knowrob::parsers::terms::options ( )

Definition at line 114 of file terms.cpp.

114  {
115  RETURN_TERM_RULE(('[' >> (option() % ',') >> ']')[qi::_val = ptr_<ListTerm>()(qi::_1)]);
116  }
TermRule & option()
Definition: terms.cpp:110

◆ options_or_nil()

TermRule & knowrob::parsers::terms::options_or_nil ( )

Definition at line 118 of file terms.cpp.

118  {
120  }
TermRule & options()
Definition: terms.cpp:114

◆ string()

TermRule & knowrob::parsers::terms::string ( )

Definition at line 63 of file terms.cpp.

63  {
64  RETURN_TERM_RULE(double_quotes()[qi::_val = ptr_<String>()(qi::_1)]);
65  }
StringRule & double_quotes()
Definition: strings.cpp:29

◆ term()

TermRule & knowrob::parsers::terms::term ( )

Definition at line 136 of file terms.cpp.

136  {
138  }
TermRule & term()
Definition: terms.cpp:136

◆ term_and_function()

auto& knowrob::parsers::terms::term_and_function ( )

Definition at line 131 of file terms.cpp.

131  {
132  static term_and_function_parsers p;
133  return p;
134  }

◆ var()

VariableRule & knowrob::parsers::terms::var ( )

Definition at line 91 of file terms.cpp.

91  {
93  }
VariableRule & var_question()
Definition: terms.cpp:87
VariableRule & var_upper()
Definition: terms.cpp:83
#define RETURN_VAR_RULE(expr)
Definition: terms.cpp:20

◆ var_question()

VariableRule & knowrob::parsers::terms::var_question ( )

Definition at line 87 of file terms.cpp.

87  {
88  RETURN_VAR_RULE('?' >> str::lower_prefix()[qi::_val = ptr_<Variable>()(qi::_1)]);
89  }
StringRule & lower_prefix()
Definition: strings.cpp:33

◆ var_upper()

VariableRule & knowrob::parsers::terms::var_upper ( )

Definition at line 83 of file terms.cpp.

83  {
84  RETURN_VAR_RULE(str::upper_prefix()[qi::_val = ptr_<Variable>()(qi::_1)]);
85  }
StringRule & upper_prefix()
Definition: strings.cpp:37

◆ xsd()

TermRule & knowrob::parsers::terms::xsd ( )

Definition at line 75 of file terms.cpp.

75  {
76  RETURN_TERM_RULE((xsd_value() >> "^^" >> iri())[qi::_val = boost::phoenix::bind(&makeXSD, qi::_1, qi::_2)]);
77  }
StringRule & xsd_value()
Definition: strings.cpp:70