peckham@svax.cs.cornell.edu (Stephen Peckham) (10/21/87)
I've run across two problems using lex that appear to be bugs. First, if the first rule in the lex specification is "\<|" (without quotes), the generated code won't compile. (A "case" outside of a switch is generated.) No lex error is given for the "|" operator followed by the end-of-line. Second, a specification with the lookahead operator doesn't work correctly, and depends on the order of rules. An excerpt follows: %% <W>([\ \n]*)/("<") {BEGIN C;} <W>([\ \n]*) {BEGIN S;} <C>"<" <INITIAL>"<|" {BEGIN W;} On input "<| <..." the following tokens are returned: "<|" (rule 4) " " (rule 1) "<" (rule 1)--this sure looks fishy. If I move rule 3 (<C>...) to the beginning of the specification, then the third token returned is "<", and it is returned by the moved rule. Of course, this rule should have matched in the first place. I'm running a Sep 15 1986 version of lex on a Sun 3/50. Are these known bugs, or am I misunderstanding something? If someone is interested, I can send more details. Steve Peckham peckham@svax.cs.cornell.edu