Hello !
Now I realize that in the function re_balanced I also need restore the
ReInput back in case of not matching:
_______
static int re_balanced(
??? ReInput *p,
??? int cb, /* char that opens a balanced expression */
??? int ce? /* char that closes a balanced expression */
){
? int c = re_next_char(p);
? if(c != cb) return 0; // string doesnt start with open char /////need
restore? ReInput to it's original state before return
? int cont = 1;
? while ((c = re_next_char(p)) {
??? if (c == ce) {
????? if (--cont == 0) {
????????? return ce;
????? }
??? }
??? else if (c == cb) cont++;
? }
///////need restore? ReInput to it's original state before return
? return 0; // string ends out of balance
}
_______
?