How to make the parser to continue parse the entire rule even if!_NEWLINE_!an exception occurs in the middle of the rule?
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Sivakumar_Ekambaram
Posted On:   Sunday, January 6, 2002 11:41 PM

I would like to make my parser to parse an entire rule, even if it finds an error in the middle of the rule. The parser should not abort the rule as soon as it finds an error. Ex: Consider a rule like "startRule : A B C D E SEMI" and if I give an input as "ABDE;", the parser should not abort the rule as soon as it finds that 'C' is not present. It is possible to catch an exception for the 'C' element alone which will make the parser to continue parsing even if it does not find a 'C' and hence the input "ABDE;" will succeed. But, if i have an optional element in my rule like "startRule : A (B)? C D E SEMI", then even if i have an exc   More>>

I would like to make my parser to parse an entire rule, even
if it finds an error in the middle of the rule. The parser
should not abort the rule as soon as it finds an error.

Ex: Consider a rule like "startRule : A B C D E SEMI" and if I
give an input as "ABDE;", the parser should not abort the rule
as soon as it finds that 'C' is not present.

It is possible to catch an exception for the 'C' element alone
which will make the parser to continue parsing even if it does
not find a 'C' and hence the input "ABDE;" will succeed.

But, if i have an optional element in my rule like
"startRule : A (B)? C D E SEMI", then even if i have an exception
block for the 'C' and 'B' element, the parser aborts the rule if i
give an input as "ADE;"

Please tell me how this is achievable?

   <<Less
About | Sitemap | Contact