mirror of
https://github.com/Z3Prover/z3
synced 2025-06-21 21:33:39 +00:00
add multiline lisp style comments #1932
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
72400f1869
commit
8847898a7d
2 changed files with 30 additions and 1 deletions
|
@ -64,6 +64,26 @@ namespace smt2 {
|
||||||
next();
|
next();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void scanner::read_multiline_comment() {
|
||||||
|
SASSERT(curr() == '|');
|
||||||
|
next();
|
||||||
|
while (true) {
|
||||||
|
char c = curr();
|
||||||
|
if (m_at_eof)
|
||||||
|
return;
|
||||||
|
if (c == '\n') {
|
||||||
|
new_line();
|
||||||
|
next();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
next();
|
||||||
|
if (c == '|' && curr() == '#') {
|
||||||
|
next();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
scanner::token scanner::read_quoted_symbol() {
|
scanner::token scanner::read_quoted_symbol() {
|
||||||
SASSERT(curr() == '|');
|
SASSERT(curr() == '|');
|
||||||
|
@ -235,6 +255,10 @@ namespace smt2 {
|
||||||
throw scanner_exception("invalid empty bit-vector literal", m_line, m_spos);
|
throw scanner_exception("invalid empty bit-vector literal", m_line, m_spos);
|
||||||
return BV_TOKEN;
|
return BV_TOKEN;
|
||||||
}
|
}
|
||||||
|
else if ('|') {
|
||||||
|
read_multiline_comment();
|
||||||
|
return NULL_TOKEN;
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
throw scanner_exception("invalid bit-vector literal, expecting 'x' or 'b'", m_line, m_spos);
|
throw scanner_exception("invalid bit-vector literal, expecting 'x' or 'b'", m_line, m_spos);
|
||||||
}
|
}
|
||||||
|
@ -295,6 +319,8 @@ namespace smt2 {
|
||||||
scanner::token scanner::scan() {
|
scanner::token scanner::scan() {
|
||||||
while (true) {
|
while (true) {
|
||||||
signed char c = curr();
|
signed char c = curr();
|
||||||
|
token t;
|
||||||
|
|
||||||
m_pos = m_spos;
|
m_pos = m_spos;
|
||||||
|
|
||||||
if (m_at_eof)
|
if (m_at_eof)
|
||||||
|
@ -329,7 +355,9 @@ namespace smt2 {
|
||||||
case '0':
|
case '0':
|
||||||
return read_number();
|
return read_number();
|
||||||
case '#':
|
case '#':
|
||||||
return read_bv_literal();
|
t = read_bv_literal();
|
||||||
|
if (t == NULL_TOKEN) break;
|
||||||
|
return t;
|
||||||
case '-':
|
case '-':
|
||||||
if (m_smtlib2_compliant)
|
if (m_smtlib2_compliant)
|
||||||
return read_symbol();
|
return read_symbol();
|
||||||
|
|
|
@ -92,6 +92,7 @@ namespace smt2 {
|
||||||
token read_symbol();
|
token read_symbol();
|
||||||
token read_quoted_symbol();
|
token read_quoted_symbol();
|
||||||
void read_comment();
|
void read_comment();
|
||||||
|
void read_multiline_comment();
|
||||||
token read_number();
|
token read_number();
|
||||||
token read_signed_number();
|
token read_signed_number();
|
||||||
token read_string();
|
token read_string();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue