Re: recursive rule not used

"James K. Lowden" <[email protected]> Wed, 19 Oct 2022 10:13:12 -0400
Newsgroups gmane.comp.parsers.bison.general
Message-ID <[email protected]>
On Tue, 18 Oct 2022 13:02:21 -0400
"James K. Lowden" <[email protected]> wrote:

> The grammar is meant to handle a series of phrases
> 
> 	WHEN conditional search_stmts
> 	WHEN conditional search_stmts

Further study of the report shows identical terms use different states: 

794 search_linear: SEARCH search_1_body ? search_1_cases
795              | SEARCH search_1_body ? at END statements
search_1_cases

Rule 794 successfully parses search_1_cases.  

Rule 795 does not.  After it completes 

	at END statements

it does not proceed as 794 does.  It enters a similar state that
*could* recurse, but it's never used that way.   The only point of entry
has the top of the stack as search_1_cases, not search_1_case.  

Is that expected behavior?  

It occurred to me that the observed token sequence leading to the error
might be helpful, if only for reference: 

	SEARCH NAME VARYING NAME 
		AT END 
			MOVE SPACES TO NAME 
		WHEN NAME '(' NAME ')' EQUAL NUMSTR 
			MOVE NAME '(' NAME ')' TO NAME 
		WHEN

The salient precedences are NAME, which is very high, and WHEN, which
is equal to that of SEARCH.  

I don't understand why the input token WHEN doesn't cause the parser to
follow the recursive rule.  

--jkl