@@ -21,6 +21,7 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWA
21
21
#ifndef Minisat_ParseUtils_h
22
22
#define Minisat_ParseUtils_h
23
23
24
+ #include < assert.h>
24
25
#include < stdlib.h>
25
26
#include < stdio.h>
26
27
#include < math.h>
@@ -102,17 +103,17 @@ static double parseDouble(B& in) // only in the form X.XXXXXe-XX
102
103
if (*in == EOF) { return 0 ; }
103
104
if (*in == ' -' ) { neg = true , ++in; }
104
105
else if (*in == ' +' ) { ++in; }
105
- if (*in < ' 1' || *in > ' 9' ) { printf (" PARSE ERROR! Unexpected char: %c\n " , *in), exit (3 ); }
106
+ if (*in < ' 1' || *in > ' 9' ) { assert ( false && " This should not happen " ); printf (" PARSE ERROR! Unexpected char: %c\n " , *in), exit (3 ); }
106
107
accu = (double )(*in - ' 0' );
107
108
++in;
108
- if (*in != ' .' ) { printf (" PARSE ERROR! Unexpected char: %c\n " , *in), exit (3 ); }
109
+ if (*in != ' .' ) { assert ( false && " This should not happen " ); printf (" PARSE ERROR! Unexpected char: %c\n " , *in), exit (3 ); }
109
110
++in; // skip dot
110
111
currentExponent = 0.1 ;
111
112
while (*in >= ' 0' && *in <= ' 9' )
112
113
accu = accu + currentExponent * ((double )(*in - ' 0' )),
113
114
currentExponent /= 10 ,
114
115
++in;
115
- if (*in != ' e' ) { printf (" PARSE ERROR! Unexpected char: %c\n " , *in), exit (3 ); }
116
+ if (*in != ' e' ) { assert ( false && " This should not happen " ); printf (" PARSE ERROR! Unexpected char: %c\n " , *in), exit (3 ); }
116
117
++in; // skip dot
117
118
exponent = parseInt (in); // read exponent
118
119
accu *= pow (10 , exponent);
@@ -128,7 +129,7 @@ static int64_t parseInt(B& in)
128
129
skipWhitespace (in);
129
130
if (*in == ' -' ) { neg = true , ++in; }
130
131
else if (*in == ' +' ) { ++in; }
131
- if (*in < ' 0' || *in > ' 9' ) { fprintf (stderr, " PARSE ERROR! Unexpected char: %c\n " , *in), exit (3 ); }
132
+ if (*in < ' 0' || *in > ' 9' ) { assert ( false && " This should not happen " ); fprintf (stderr, " PARSE ERROR! Unexpected char: %c\n " , *in), exit (3 ); }
132
133
while (*in >= ' 0' && *in <= ' 9' )
133
134
val = val * 10 + (*in - ' 0' ),
134
135
++in;
0 commit comments