[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
LYNX-DEV Re: error recovery for form parsing
From: |
Laura Eaves |
Subject: |
LYNX-DEV Re: error recovery for form parsing |
Date: |
Thu, 3 Apr 1997 13:02:13 -0500 (EST) |
I just noticed an oversight in the fix I just sent for the form
parsing error recovery bug.
Below is a diff containing the corrected fix...
It handles the case where there is only one element on the stack.
Sorry for the confusion.
--le
*** old/SGML.c Thu Apr 3 07:31:36 1997
--- WWW/Library/Implementation/SGML.c Thu Apr 3 11:47:05 1997
***************
*** 521,526 ****
--- 521,527 ----
old_tag->name);
return;
}
+ again:
#ifdef WIND_DOWN_STACK
while (context->element_stack) { /* Loop is error path only */
#else
***************
*** 528,552 ****
#endif /* WIND_DOWN_STACK */
HTElement * N = context->element_stack;
HTTag * t = N->tag;
if (old_tag != t) { /* Mismatch: syntax error */
if (context->element_stack->next) { /* This is not the last level */
! if (TRACE) fprintf(stderr,
"SGML: Found </%s> when expecting </%s>. </%s> assumed.\n",
old_tag->name, t->name, t->name);
} else { /* last level */
if (TRACE) fprintf(stderr,
"SGML: Found </%s> when expecting </%s>. </%s> Ignored.\n",
old_tag->name, t->name, old_tag->name);
return; /* Ignore */
}
-
}
context->element_stack = N->next; /* Remove from stack */
! FREE(N);
! (*context->actions->end_element)(context->target,
t - context->dtd->tags, (char **)&context->include);
#ifdef WIND_DOWN_STACK
if (old_tag == t)
return; /* Correct sequence */
--- 529,572 ----
#endif /* WIND_DOWN_STACK */
HTElement * N = context->element_stack;
HTTag * t = N->tag;
+ int end_form_error = 0;
if (old_tag != t) { /* Mismatch: syntax error */
if (context->element_stack->next) { /* This is not the last level */
! if ( toupper(t->name[0]) == 'F'
! && toupper(t->name[1]) == 'O'
! && toupper(t->name[2]) == 'R'
! && toupper(t->name[3]) == 'M'
! && toupper(t->name[4]) == '\0' )
! end_form_error = 1;
! if (TRACE) {
! if ( end_form_error )
! fprintf(stderr,
! "SGML: Found </%s> when expecting </%s>. </%s> hoisted.\n",
! old_tag->name, t->name, t->name);
! else
! fprintf(stderr,
"SGML: Found </%s> when expecting </%s>. </%s> assumed.\n",
old_tag->name, t->name, t->name);
+ }
} else { /* last level */
if (TRACE) fprintf(stderr,
"SGML: Found </%s> when expecting </%s>. </%s> Ignored.\n",
old_tag->name, t->name, old_tag->name);
return; /* Ignore */
}
}
context->element_stack = N->next; /* Remove from stack */
! if ( !end_form_error ) {
! FREE(N);
! (*context->actions->end_element)(context->target,
t - context->dtd->tags, (char **)&context->include);
+ } else {
+ N->next = N->next->next;
+ context->element_stack->next = N;
+ goto again;
+ }
#ifdef WIND_DOWN_STACK
if (old_tag == t)
return; /* Correct sequence */
;
; To UNSUBSCRIBE: Send a mail message to address@hidden
; with "unsubscribe lynx-dev" (without the
; quotation marks) on a line by itself.
;