Reading instance files described by reader specs. More...
Classes | |
| class | Arm |
| Arm of a sections statement. More... | |
| class | Binding |
| A name bound by a comprehension, visible while the binding exists. More... | |
| class | Column |
| Array built row by row from the values of a repeated statement. More... | |
| class | Context |
| A statement being executed, for errors. More... | |
| class | Data |
| Named values read from an instance. More... | |
| class | DataImpl |
| Implementation of Data. More... | |
| class | Decl |
| A name that a block may define, with the type and depth of its values. More... | |
| class | Entry |
| A named value. More... | |
| class | Error |
| Exception for errors in specs and instance files More... | |
| class | Evaluator |
| Evaluator of the expressions of a spec on an input. More... | |
| class | Expr |
| Expression. More... | |
| class | Input |
| Instance text with a position and line tracking. More... | |
| class | Params |
| Values for the param statements of a spec. More... | |
| class | ParamsImpl |
| Implementation of Params. More... | |
| class | Pattern |
| Line pattern such as "DIMENSION : {n:int}". More... | |
| class | Place |
| A position in the input, with its line. More... | |
| class | Record |
| A record name of a check. More... | |
| class | RecordRef |
| Records or a list of records of a named repeat. More... | |
| class | Seq |
| Growable array on the Gecode heap. More... | |
| class | ShapeError |
| Error about the shape or type of a value, located by the caller. More... | |
| class | Spec |
| Reader spec for a textual instance format. More... | |
| class | SpecImpl |
| Implementation of Spec. More... | |
| class | Stmt |
| Statement. More... | |
| class | Type |
| Type of the values that a declaration or a capture reads. More... | |
| class | Value |
| A value: scalar or nested (possibly ragged) array. More... | |
| class | Witness |
| A part of the explanation of a failed check, such as "record 3 of
'jobs'", with the position of the record in the input if known. More... | |
Typedefs | |
| typedef Seq< std::unique_ptr< Stmt > > | Block |
| Sequence of statements. | |
Enumerations | |
| enum class | ValueType { INT , FLOAT , STRING } |
| Type of the values in a data entry. More... | |
| enum class | ReadType { INT , FLOAT , NUM , WORD , REST , SYMBOL } |
| What a declaration or a capture reads. More... | |
Functions | |
| std::string | quote (const std::string &s) |
| Return s in single quotes, with newlines and tabs escaped. | |
| bool | add (long long int x, long long int y, long long int &r) |
| Store x + y in r unless it overflows. | |
| bool | sub (long long int x, long long int y, long long int &r) |
| Store x - y in r unless it overflows. | |
| bool | is_digit (char c) |
| Test whether c is a digit. | |
| bool | is_letter (char c) |
| Test whether c is a letter. | |
| bool | is_alnum (char c) |
| Test whether c can occur in a name. | |
| bool | is_space (char c) |
| Test whether c is white space. | |
| bool | is_blank (char c) |
| Test whether c is white space within a line. | |
| bool | is_sign (char c) |
| Test whether c is a sign. | |
| bool | is_exponent (char c) |
| Test whether c starts the exponent of a float. | |
| size_t | number_end (const std::string &s, size_t p, bool sign, bool real) |
| Return where the number starting at position p of s ends. | |
| bool | parse_int (const std::string &t, long long int &v) |
| Parse decimal integer t into v, and return whether it is one. | |
| bool | parse_float (const std::string &t, double &v) |
| Parse decimal float t into v, and return whether it is one. | |
| std::string | record_starts (int id) |
| Return the name of the record starts of the repeat numbered id. | |
| bool | is_internal (const std::string &n) |
| Test whether n is a name used internally (see record_starts). | |
| void | declared (const Block &b, Seq< Decl > &out) |
| Add the names that block b may define to out. | |
| void | fail_at (const std::string &origin, int line, const std::string &m) |
| Throw an error with message m for line line of the spec from origin. | |
| void | resolve (Block &b, const std::string &origin) |
| Resolve the names in the expressions of b, the body of a spec from origin. | |
| std::string | read_file (const std::string &path) |
| Read file path into a string. | |
Detailed Description
Reading instance files described by reader specs.
A reader spec is a short text that describes how a textual instance format is laid out: header counts, KEY : VALUE lines, sections, matrices, lists ended by sentinels, records, and character grids. Reading a file with a spec yields named values (Data): scalars and arrays, where the fields of repeated records are stored column-wise.
Programs supply the specs for the formats they read, typically as string literals. The spec language is described in The reader spec language.
Typedef Documentation
◆ Block
| typedef Seq<std::unique_ptr<Stmt> > Gecode::Instance::Block |
Enumeration Type Documentation
◆ ValueType
|
strong |
Type of the values in a data entry.
| Enumerator | |
|---|---|
| INT | Integers. |
| FLOAT | Floating point numbers. |
| STRING | Strings. |
Definition at line 349 of file instance.hh.
◆ ReadType
|
strong |
Function Documentation
◆ quote()
| std::string Gecode::Instance::quote | ( | const std::string & | s | ) |
◆ add()
| bool Gecode::Instance::add | ( | long long int | x, |
| long long int | y, | ||
| long long int & | r ) |
◆ sub()
| bool Gecode::Instance::sub | ( | long long int | x, |
| long long int | y, | ||
| long long int & | r ) |
◆ is_digit()
|
inline |
◆ is_letter()
|
inline |
◆ is_alnum()
|
inline |
◆ is_space()
|
inline |
◆ is_blank()
|
inline |
◆ is_sign()
|
inline |
◆ is_exponent()
|
inline |
◆ number_end()
|
inline |
◆ parse_int()
| bool Gecode::Instance::parse_int | ( | const std::string & | t, |
| long long int & | v ) |
◆ parse_float()
| bool Gecode::Instance::parse_float | ( | const std::string & | t, |
| double & | v ) |
◆ record_starts()
|
inline |
◆ is_internal()
|
inline |
◆ declared()
◆ fail_at()
| void Gecode::Instance::fail_at | ( | const std::string & | origin, |
| int | line, | ||
| const std::string & | m ) |
◆ resolve()
| void Gecode::Instance::resolve | ( | Block & | b, |
| const std::string & | origin ) |
Resolve the names in the expressions of b, the body of a spec from origin.
Finds the expressions that are records or lists of records of a named repeat (see Expr) and the record names of the checks (see Record), and reports their misuse.
Definition at line 619 of file resolve.cpp.
