Re: Digest Number 492
Thomas Beale <thomas-JBqMug/[email protected]>
| Newsgroups | gmane.comp.lang.eiffel.gobo.general |
|---|---|
| Message-ID | <[email protected]> |
Eric wrote: > Thomas Beale wrote: > > in YY_PERSER_SKELETON, the definition of syntax_error is as follows: > > > > syntax_error: BOOLEAN is > > -- Has last parsing been unsuccesful? > > do > > Result := yy_parsing_status /= yyaccepted > > end > > > > However, this means that syntax_error returns True even if no parsing > > has yet been done, since just after creation, yy_parsing_status = 0, > not > > yyAccepted (I just tested this, to be sure). > > I'm not sure I understand your point. The comment talks > about the "last parsing". Therefore the value is undefined > if no parsing occurred. To be more precise, the value is > only relevant after a parsing occurred. Perhaps a precondition > is missing, but there are many similar cases in EiffelBase, > such as: Eric, I agree, if we believe the comment in the strictest possible way, but think of it in formal terms: if I call this routine before having done a parse (as is could be done in a generic parser handler routine), it returns True, meaning "syntax error occurred" even though this clearly is not the case. I think that the formal definition has to change, either with a precondition, or (my preference) relaxing the list of parsing_status values that is matched. I only believe in formal specifications! (and I wouldn't see ES's file handling routines as any kind of model to follow;-) - thomas beale