[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: gnubol: problem 9; data list collisions.
More on the INSPECT verb as an exercise in eliminate data list collisions:
/* this ref_data is the 'inspected item' */
stmt_INSPECT :
INSPECT ref_data inspect_tallying_clause
{;}
| INSPECT ref_data inspect_replacing_clause
{;}
| INSPECT ref_data inspect_tallying_clause
inspect_replacing_clause
{;}
;
inspect_replacing_clause :
REPLACING
{;}
;
/* REPLACING clause not coded here */
/* TALLYING clause can not repeat,
but entire object clause of it can
*/
inspect_tallying_clause :
inspect_tallying_init inspect_tallying_phrase_recurse
{;}
;
inspect_tallying_init :
TALLYING
{;}
| TALLYING TALLYING
{/* error productions etc. */;}
;
/* iteratively select a FOR, ALL/LEADING/CHARACTER phrase */
inspect_tallying_phrase_recurse :
inspect_for_phrase_alt
{;}
| inspect_tallying_phrase_recurse inspect_for_phrase_alt
{;}
;
inspect_for_phrase_alt :
FOR
{ /* error _FOR has no data_ref infront */
;}
| ref_data_list_1_n FOR
{ /*
a list here is either an error at the start (or an error after CHARACTER)
(a list after an AFTER/BEFORE
should actually be caught in the
inspect_tallying_tallying_field_recurse
recurse)
*/
;}
| ALL inspect_tallying_tallying_field_recurse FOR
{ /* steal last element on list for data_ref FOR clause */
;}
| ALL inspect_tallying_tallying_field_recurse
%prec PREC_SHIFT_LA_FOR
{;}
| LEADING inspect_tallying_tallying_field_recurse FOR
{ /* steal last element on list for data_ref FOR clause */
;}
| LEADING inspect_tallying_tallying_field_recurse
%prec PREC_SHIFT_LA_FOR
{;}
| CHARACTER before_or_after_phrase_recurse
%prec PREC_REDUCE_LA_SYMT_DATA
{ ;}
;
inspect_tallying_tallying_field_recurse :
inspect_tallying_tallying_field
{;}
| inspect_tallying_tallying_field_recurse
inspect_tallying_tallying_field
{;}
;
/*
note in the following
1) a ref_data list can grow one too large on end of a clause
2) if grown before the AFTER/BEFORE phrase its is okay
3) AFTER/BEFORE phrases only grab one,
outer rule inspect_for_phrase_alt
must look for list in front of FOR only because an error
could occur after a CHARACTER [BEFORE/AFTER data_ref]
*/
inspect_tallying_tallying_field :
ref_data_list_1_n
%prec PREC_REDUCE_LA_SYMT_DATA
{;}
| ref_data_list_1_n before_or_after_phrase_recurse
{;}
;
before_or_after_phrase_recurse :
before_or_after_phrase
{;}
| before_or_after_phrase_recurse
before_or_after_phrase
{ /* recurse can actually be an error production
error:
if more than one each per ALL/LEADING/CHARACTER
message may get emitted above
*/
;}
;
/* BEFORE / AFTER phrase picks up one data ref at a time */
/* this ref_data is the TALLYING
'B/A/ bounding field(s) ', a delimiter
*/
before_or_after_phrase :
BEFORE_INITIAL ref_data
{;}
| AFTER_INITIAL ref_data
{;}
;
BEFORE_INITIAL :
BEFORE
{;}
| BEFORE INITIAL
{;}
;
AFTER_INITIAL :
AFTER
{;}
| AFTER INITIAL
{;}
;
--
This message was sent through the gnu-cobol mailing list. To remove yourself
from this mailing list, send a message to majordomo@lusars.net with the
words "unsubscribe gnu-cobol" in the message body. For more information on
the GNU COBOL project, send mail to gnu-cobol-owner@lusars.net.