17 #ifndef VAUCR_WEIGHTSET_Z_HH
18 # define VAUCR_WEIGHTSET_Z_HH
30 namespace awali {
namespace sttc {
44 std::string
vname(
bool =
true)
const
93 "z: div: invalid division: ", l,
'/',
r);
109 raise(
"z: star: invalid value: ",
format(*
this, v));
171 parse(
const std::string & s,
size_t& p)
const {
173 for(; i>0 && s[i-1]>=
'0' && s[i-1]<=
'9'; --i)
177 if(i>0 && (s[i-1]==
'-' || s[i-1]==
'+'))
179 std::istringstream st(s.substr(i, p-i));
198 const std::string& fmt =
"text")
201 return o<<
'"' << v <<
'"';
210 else if (
format ==
"text")
213 raise(
"invalid format: ",
format);
220 o <<
"{\"Semiring\":\"Z\"}";
230 throw std::runtime_error(
"json parser Z");
235 throw std::runtime_error(
"json parser Z");
The Boolean semring.
Definition: b.hh:38
bool value_t
Definition: b.hh:56
The semiring of complex numbers.
Definition: c.hh:44
std::string vname(bool=true) const
Definition: z_old.hh:44
value_t star(const value_t v) const
Definition: z_old.hh:104
static z make(std::istream &is)
Build from the description in is.
Definition: z_old.hh:50
static value_t conv(self_type, value_t v)
Definition: z_old.hh:158
static constexpr bool show_one()
Definition: z_old.hh:143
static value_t conv(std::istream &stream)
Definition: z_old.hh:187
static constexpr bool is_commutative_semiring()
Definition: z_old.hh:141
std::ostream & js_print(std::ostream &o) const
Definition: z_old.hh:218
static value_t ldiv(const value_t l, const value_t r)
Definition: z_old.hh:98
static value_t zero()
Definition: z_old.hh:59
int value_t
Definition: z_old.hh:56
static value_t conv(b, b::value_t v)
Definition: z_old.hh:164
static value_t mul(const value_t l, const value_t r)
Definition: z_old.hh:83
static bool is_zero(const value_t v)
Definition: z_old.hh:118
static value_t sub(const value_t l, const value_t r)
Definition: z_old.hh:77
value_t parse(const std::string &s, size_t &p) const
Definition: z_old.hh:171
static size_t hash(value_t v)
Definition: z_old.hh:152
static value_t add(const value_t l, const value_t r)
Definition: z_old.hh:71
std::ostream & print_set(std::ostream &o, const std::string &format="text") const
Definition: z_old.hh:206
static value_t rdiv(const value_t l, const value_t r)
Definition: z_old.hh:89
static bool equals(const value_t l, const value_t r)
Definition: z_old.hh:130
static constexpr star_status_t star_status()
Definition: z_old.hh:144
static value_t transpose(const value_t v)
Definition: z_old.hh:147
static std::string sname()
Definition: z_old.hh:39
constexpr static bool is_special(value_t)
Definition: z_old.hh:112
static std::ostream & print(const value_t v, std::ostream &o, const std::string &fmt="text")
Definition: z_old.hh:197
static bool less_than(value_t lhs, value_t rhs)
Whether lhs < rhs.
Definition: z_old.hh:136
static bool is_one(const value_t v)
Definition: z_old.hh:124
value_t js_parse(std::istream &i) const
Definition: z_old.hh:225
static value_t one()
Definition: z_old.hh:65
The semiring of floating Numbers.
Definition: r.hh:35
The semiring of Integers.
Definition: z.hh:35
star_status_t
The different behaviours a weightset may have with respect to the star.
Definition: enums.hh:163
@ NON_STARRABLE
Definition: enums.hh:166
void eat(std::istream &is, char c)
Check lookahead character and advance.
Definition: stream.hh:62
ATTRIBUTE_NORETURN void fail_reading(std::istream &is, std::string explanation)
Throw an exception after failing to read from is.
Definition: stream.hh:93
VAUCR_WEIGHTS_BINARY(z, z, z)
auto format(const ValueSet &vs, const typename ValueSet::value_t &v, Args &&... args) -> std::string
Format v via vs.print.
Definition: stream.hh:109
void require(bool b, Args &&... args)
If b is not verified, raise an error with args as message.
Definition: raise.hh:55
std::size_t hash_value(const T &v)
Definition: hash.hh:76
Main namespace of Awali.
Definition: ato.hh:22
Exceptions thrown during parsing.
Definition: parse_exception.hh:26