Ejemplo n.º 1
0
static void exec_begin_edge_prepare(
		gravm_runstack_t *self)
{
	if(self->cb->edge_prepare != NULL && it_begin(self->edges, &self->top->out_it, self->top->edge->out_lower, self->top->edge->out_upper)) {
		self->top->out_cur = self->top->out_it.it.element;
		self->top->ip++;
	}
	else
		self->top->ip = GRAVM_RS_IP_BEGIN_OUTGOING_PRE;
}
Ejemplo n.º 2
0
static void exec_begin_outgoing_post(
		gravm_runstack_t *self)
{
	if(it_begin(self->edges, &self->top->out_it, self->top->edge->out_boundary, self->top->edge->out_upper)) {
		self->top->out_cur = self->top->out_it.it.element;
		self->top->out_upper = self->top->edge->out_upper;
		self->top->out_nextip = GRAVM_RS_IP_BEGIN_EDGE_UNPREPARE;
		self->top->ip++;
	}
	else
		self->top->ip = GRAVM_RS_IP_BEGIN_EDGE_UNPREPARE;
}
Ejemplo n.º 3
0
static void exec_begin_outgoing_pre(
		gravm_runstack_t *self)
{
	if(it_begin(self->edges, &self->top->out_it, self->top->edge->out_lower, self->top->edge->out_boundary)) {
		self->top->out_cur = self->top->out_it.it.element;
		self->top->out_upper = self->top->edge->out_boundary;
		self->top->out_nextip = GRAVM_RS_IP_NODE_RUN;
		self->top->ip++;
	}
	else
		self->top->ip = GRAVM_RS_IP_NODE_RUN;
}
Ejemplo n.º 4
0
Archivo: main.cpp Proyecto: CCJY/coliru
int main()
{
    ConditionTree oTree;

    Parser<> parser(oTree);

    std::string strTest("limit5minutes");

    std::string::const_iterator it_begin(strTest.begin());
    std::string::const_iterator it_end(strTest.end());

    bool result = phrase_parse(it_begin, it_end, parser, ascii::space);
}
Ejemplo n.º 5
0
DLVHEX_NAMESPACE_END

// Local Variables:
// mode: C++
// End:

#if 0
void
HexParserDriver::parse(std::istream& is,
                       Program& program,
                       AtomSet& EDB) throw (SyntaxError)
{
  // put whole input from stream into a string
  // (an alternative would be the boost::spirit::multi_pass iterator
  // but it was not possible to setup/simply did not compile)
  std::ostringstream buf;
  buf << is.rdbuf();
  std::string input = buf.str();

  HexGrammar grammar;
  typedef HexGrammarPTToASTConverter Converter;

  Converter::iterator_t it_begin(input.c_str(), input.c_str()+input.size());
  Converter::iterator_t it_end;

  // parse ast
  boost::spirit::tree_parse_info<Converter::iterator_t, Converter::factory_t> info =
    boost::spirit::pt_parse<Converter::factory_t>(
        it_begin, it_end, grammar, boost::spirit::space_p);

  // successful parse?
  if( !info.full )
    throw SyntaxError("Could not parse complete input!",
        info.stop.get_position().line, this->source);

  // if this is not ok, there is some bug and the following code will be incomplete
  assert(info.trees.size() == 1);

  // create dlvhex AST from spirit parser tree
  Converter converter;
  converter.convertPTToAST(*info.trees.begin(), program, EDB);
}