Here is a sample of my y file.

    | rval '<' rval
    | rval '<' '<' rval
    | rval '>' rval
    | rval '>' '>' rval

    | rval LSHIFT rval
    | rval RSHIFT rval

I'd like to allow < < and > > to work like << and >>. I thought they would
be difficult but found "Context-Dependent Precedence"
http://www.gnu.org/software/bison/manual/html_node/Contextual-Precedence.html

However it doesnt seem to work. Writing
    | rval '<' '<' rval %prec LSHIFT

seems to do nothing. I tried putting it here where * = "%prec LSHIFT"
except i only had one at a time

    | * rval * '<' * '<' * rval  *

Every slot didnt seem to work. I didnt notice any warnings except when I
had more than one %prec LSHIFT in a rule.

How do I get bison to treat > > and << as >> and <<. Note: I can't make
rshift >\s*> in the lexer because that would interfere with other things
_______________________________________________
help-bison@gnu.org https://lists.gnu.org/mailman/listinfo/help-bison

Reply via email to