38 #ifndef __FLATZINC_PARSER_HH__
39 #define __FLATZINC_PARSER_HH__
46 #define YY_NO_UNISTD_H
48 extern "C" int isatty(
int);
55 #define strdup _strdup
56 #define fileno _fileno
68 #include <gecode/flatzinc/parser.tab.hh>
71 namespace Gecode {
namespace FlatZinc {
73 typedef std::pair<std::string,Option<std::vector<int>* > >
intvartype;
76 typedef std::pair<std::string, VarSpec*>
varspec;
83 const std::pair<std::string,AST::Node*>& y) {
84 return x.first < y.first;
204 std::vector<std::pair<std::string,AST::Node*> >
_output;
225 int num =
std::min(length - pos, lexBufSize);
226 memcpy(lexBuf,buf+pos,num);
232 _output.push_back(std::pair<std::string,AST::Node*>(x,n));
237 std::sort(_output.begin(),_output.end(),oo);
239 for (
unsigned int i=0;
i<_output.
size();
i++) {
240 a->a.push_back(
new AST::String(_output[
i].first+
" = "));
241 if (_output[
i].second->isArray()) {
243 for (
unsigned int j=0; j<oa->
a.size(); j++) {
244 a->
a.push_back(oa->
a[j]);
247 delete _output[
i].second;
249 a->a.push_back(_output[
i].second);
ParserState(char *buf0, int length0, std::ostream &err0, Gecode::FlatZinc::FlatZincSpace *fg0)
std::pair< std::string, VarSpec * > varspec
int size(void) const
Return size of array (number of elements)
SymbolTable< SymbolEntry > symbols
SymbolEntry se_iva(int i)
Construct integer variable array entry.
SymbolType
Types of symbols.
AST::Array * getOutput(void)
std::vector< varspec > intvars
std::vector< ConExpr * > constraints
std::pair< std::string, Option< std::vector< int > * > > intvartype
SymbolEntry se_sv(int i)
Construct set variable entry.
std::vector< double > floatvals
SymbolEntry se_sva(int i)
Construct set variable array entry.
std::vector< varspec > floatvars
Array * getArray(void)
Cast this node to an array node.
SymbolEntry(SymbolType t0, int i0)
Constructor.
SymbolEntry se_fa(int i)
Construct float array entry.
void sort(TaskViewArray< TaskView > &t)
Sort task view array t according to sto and inc (increasing or decreasing)
SymbolEntry se_i(int i)
Construct integer entry.
SymbolEntry se_sa(int i)
Construct set array entry.
const FloatNum min
Smallest allowed float value.
Gecode::IntArgs i(4, 1, 2, 3, 4)
Entries in the symbol table.
int n
Number of negative literals for node type.
SymbolEntry se_iv(int i)
Construct integer variable entry.
std::vector< varspec > setvars
std::vector< std::pair< std::string, AST::Node * > > _output
std::vector< int > arrays
SymbolEntry(void)
Default constructor.
unsigned int size(I &i)
Size of all ranges of range iterator i.
Gecode::FlatZinc::FlatZincSpace * fg
Symbol table mapping identifiers (strings) to values.
SymbolEntry se_f(int i)
Construct float entry.
bool operator()(const std::pair< std::string, AST::Node * > &x, const std::pair< std::string, AST::Node * > &y)
Return if x is less than y, based on first component.
std::vector< varspec > boolvars
SymbolEntry se_b(bool b)
Construct Boolean entry.
SymbolEntry se_s(int i)
Construct set entry.
void output(std::string x, AST::Node *n)
std::vector< ConExpr * > domainConstraints
Node * x
Pointer to corresponding Boolean expression node.
ParserState(const std::string &b, std::ostream &err0, Gecode::FlatZinc::FlatZincSpace *fg0)
SymbolEntry se_ia(int i)
Construct integer array entry.
SymbolEntry se_fv(int i)
Construct float variable entry.
SymbolEntry se_bva(int i)
Construct Boolean variable array entry.
Base class for variable specifications.
Strict weak ordering for output items.
A space that can be initialized with a FlatZinc model.
struct Gecode::@518::NNF::@57::@58 b
For binary nodes (and, or, eqv)
SymbolEntry se_fva(int i)
Construct float variable array entry.
Gecode toplevel namespace
SymbolEntry se_bv(int i)
Construct Boolean variable entry.
A node in a FlatZinc abstract syntax tree.
int fillBuffer(char *lexBuf, unsigned int lexBufSize)
SymbolEntry se_ba(int i)
Construct Boolean array entry.
std::vector< AST::SetLit > setvals
struct Gecode::@518::NNF::@57::@59 a
For atomic nodes.
State of the FlatZinc parser