mirror of
https://github.com/Z3Prover/z3
synced 2025-08-13 14:40:55 +00:00
parent
566bdf3a82
commit
28a5a515a8
2 changed files with 24 additions and 1 deletions
|
@ -323,6 +323,15 @@ struct asymbol {
|
||||||
asymbol(rational const& r, unsigned l): m_is_num(true), m_num(r), m_line(l) {}
|
asymbol(rational const& r, unsigned l): m_is_num(true), m_num(r), m_line(l) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
std::ostream& operator<<(std::ostream& out, asymbol const& c) {
|
||||||
|
if (c.m_is_num) {
|
||||||
|
return out << c.m_num;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return out << c.m_sym;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class lp_tokenizer {
|
class lp_tokenizer {
|
||||||
vector<asymbol> m_tokens;
|
vector<asymbol> m_tokens;
|
||||||
unsigned m_pos;
|
unsigned m_pos;
|
||||||
|
@ -416,6 +425,7 @@ private:
|
||||||
}
|
}
|
||||||
if (c == '.') {
|
if (c == '.') {
|
||||||
in.next();
|
in.next();
|
||||||
|
c = in.ch();
|
||||||
while (is_num(c) && !in.eof()) {
|
while (is_num(c) && !in.eof()) {
|
||||||
n = n*rational(10) + rational(c - '0');
|
n = n*rational(10) + rational(c - '0');
|
||||||
in.next();
|
in.next();
|
||||||
|
@ -426,6 +436,7 @@ private:
|
||||||
if (div > 1) n = n / rational(div);
|
if (div > 1) n = n / rational(div);
|
||||||
if (neg) n.neg();
|
if (neg) n.neg();
|
||||||
m_tokens.push_back(asymbol(n, in.line()));
|
m_tokens.push_back(asymbol(n, in.line()));
|
||||||
|
IF_VERBOSE(10, verbose_stream() << "num: " << m_tokens.back() << "\n");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
m_buffer.reset();
|
m_buffer.reset();
|
||||||
|
@ -445,6 +456,7 @@ private:
|
||||||
}
|
}
|
||||||
m_buffer.push_back(0);
|
m_buffer.push_back(0);
|
||||||
m_tokens.push_back(asymbol(symbol(m_buffer.c_ptr()), in.line()));
|
m_tokens.push_back(asymbol(symbol(m_buffer.c_ptr()), in.line()));
|
||||||
|
IF_VERBOSE(10, verbose_stream() << "tok: " << m_tokens.back() << "\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -466,6 +478,7 @@ private:
|
||||||
is_num(c) ||
|
is_num(c) ||
|
||||||
c == '!' ||
|
c == '!' ||
|
||||||
c == '"' ||
|
c == '"' ||
|
||||||
|
c == '-' ||
|
||||||
c == '#' ||
|
c == '#' ||
|
||||||
c == '$' ||
|
c == '$' ||
|
||||||
c == '%' ||
|
c == '%' ||
|
||||||
|
@ -612,6 +625,7 @@ private:
|
||||||
name = peek(0);
|
name = peek(0);
|
||||||
tok.next(2);
|
tok.next(2);
|
||||||
}
|
}
|
||||||
|
IF_VERBOSE(10, verbose_stream() << name << "\n");
|
||||||
rational val(0);
|
rational val(0);
|
||||||
symbol var;
|
symbol var;
|
||||||
parse_indicator(var, val);
|
parse_indicator(var, val);
|
||||||
|
@ -624,6 +638,9 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
void parse_expr(lin_term& terms) {
|
void parse_expr(lin_term& terms) {
|
||||||
|
if (is_relation()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
bool pos = true;
|
bool pos = true;
|
||||||
if (peek(0) == "-") {
|
if (peek(0) == "-") {
|
||||||
pos = false;
|
pos = false;
|
||||||
|
@ -693,6 +710,7 @@ private:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool is_relation() { return peek(0) == "=" || peek(0) == "=<" || peek(0) == ">=" || peek(0) == "=>" || peek(0) == "<="; }
|
||||||
bool is_section() { return is_general() || is_binary() || is_bounds() || is_end();}
|
bool is_section() { return is_general() || is_binary() || is_bounds() || is_end();}
|
||||||
bool is_bounds() { return peek(0) == "bounds"; }
|
bool is_bounds() { return peek(0) == "bounds"; }
|
||||||
bool is_general() { return peek(0) == "general" || peek(0) == "gen" || peek(0) == "generals"; }
|
bool is_general() { return peek(0) == "general" || peek(0) == "gen" || peek(0) == "generals"; }
|
||||||
|
@ -770,6 +788,11 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
void parse_general() {
|
void parse_general() {
|
||||||
|
if (peek(1) == ":" && peek(3) == "=") {
|
||||||
|
symbol const& v = peek(2);
|
||||||
|
std::cout << "TBD: " << v << "\n";
|
||||||
|
return;
|
||||||
|
}
|
||||||
symbol const& v = peek(0);
|
symbol const& v = peek(0);
|
||||||
bound b;
|
bound b;
|
||||||
m_bounds.find(v, b);
|
m_bounds.find(v, b);
|
||||||
|
|
|
@ -20,7 +20,7 @@ Revision History:
|
||||||
#ifndef STOPWATCH_H_
|
#ifndef STOPWATCH_H_
|
||||||
#define STOPWATCH_H_
|
#define STOPWATCH_H_
|
||||||
|
|
||||||
#if defined(_WINDOWS) || defined(_CYGWIN)
|
#if defined(_WINDOWS) || defined(_CYGWIN) || defined(_MINGW)
|
||||||
|
|
||||||
// Does this redefinition work?
|
// Does this redefinition work?
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue