Le 3 avr. 2013 à 20:28, Hans Aberg <haber...@telia.com> a écrit :

> On 3 Apr 2013, at 04:52, Adam Smalin <acidzombi...@gmail.com> wrote:
> 
>> ... I have no idea how i can fix this without rewriting it all.
> 
> 
> Have you tried getting the lexer to emit two '>' when it sees a ">>", say by 
> using an parenthesis-matching integer count?

Hi Hans,

I'm not sure what you mean here, if you don't teach the scanner ">>" but ">",
on ">>" it will return '>' and '>'.  I don't see what you mean with
the counter.

However, there might be means to do what Adam wants by cheating in
a comparable way: in the scanner recognize ">" followed by ">",
and make it a different token (have a look at / in Flex's documentation).

This way you would have

exp:  exp ">" exp
   |  exp ">2" ">" exp  %prec ">2"

and then you can express your precedence on ">2" vs ">".

And where ">" and ">2" are both ok, use

rbracket: ">" | ">2";


_______________________________________________
help-bison@gnu.org https://lists.gnu.org/mailman/listinfo/help-bison

Reply via email to