[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Possible bugs with SableCC states, 2nd post



Hi Jenny.

I've quickly looked at your grammar. It seems that you didn't copy the state
information in front of all token definitions. This may be your problem.
(Yes, the scope of a state transition specification is a single token
definition, not all the token definitions that follow.)

e.g.:

{normal->other}
   some_token = ...;
   another_one = ...; // No state info => valid in all states. No
transitions.

is understood by SableCC as:

{normal->other}
   some_token = ...;

{normal,other,...} // All states.
   another_one = ...;

I hope this helps.

Etienne

-----Original Message-----
From: Jenny Lam <jlam@sojournlabs.com>
To: sablecc-list@sable.mcgill.ca <sablecc-list@sable.mcgill.ca>
Date: Tuesday, August 25, 1998 1:31 AM
Subject: Possible bugs with SableCC states, 2nd post


>Sorry about the missing attachment in the previous post.  Thanks Archie.
>
>I have four states in my grammar file.  There are overlap in two of the
>tokens, but they are defined in two different states.  One of the token
>(valid_input) kept being matched even when the system is not in its
>defined states.
>
>Attached files:  basic.grm  (is the grammar file to feed to SableCC)
>            basic.html (is the input sequence to feed the test program)
>            ExtLexer.java  (will print out the debug information)
> Testmain.java (is the test program with main() )
>
>Can anyone run these files for me to verify if a bug exist?
>
>at the dos prompt>
> java -mx1024m SableCC basic.grm
>
>after parser generated successfully,
>compile ExtLexer.java and Testmain.java
>
>then run the test program with basic.html
>java Testmain basic.html
>
>Should error out at TValidinput, State: 2, text:[body bgcolor]
>parserException[5,4] TBody expected
>
>When it encounter 'body bgcolor', it should match 'body' to token body, '
>' to token blank1, and bgcolor to token bgcolor.  Any ideas why it is
>not?
>
>Thanks in Advance
>Jenny
>jlam@sojournlabs.com
>