MCPcopy Create free account
hub / github.com/Gecode/gecode / getVarRefArg

Function getVarRefArg

gecode/flatzinc/parser.tab.cpp:206–228  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

204 return new AST::IntVar(0); // keep things consistent
205}
206AST::Node* getVarRefArg(ParserState* pp, string id, bool annotation = false) {
207 SymbolEntry e;
208 string n;
209 if (annotation)
210 n = id;
211 if (pp->symbols.get(id, e)) {
212 switch (e.t) {
213 case ST_INTVAR: return new AST::IntVar(e.i,n);
214 case ST_BOOLVAR: return new AST::BoolVar(e.i,n);
215 case ST_SETVAR: return new AST::SetVar(e.i,n);
216 case ST_FLOATVAR: return new AST::FloatVar(e.i,n);
217 default: break;
218 }
219 }
220
221 if (annotation)
222 return new AST::Atom(id);
223 pp->err << "Error: undefined variable " << id
224 << " in line no. "
225 << yyget_lineno(pp->yyscanner) << std::endl;
226 pp->hadError = true;
227 return new AST::IntVar(0); // keep things consistent
228}
229
230void addDomainConstraint(ParserState* pp, std::string id, AST::Node* var,
231 Option<AST::SetLit* >& dom) {

Callers 1

yyparseFunction · 0.85

Calls 2

yyget_linenoFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected