[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
%prec doesn't seem to work?
From: |
Adam Smalin |
Subject: |
%prec doesn't seem to work? |
Date: |
Sat, 30 Mar 2013 12:48:59 -0400 |
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
- %prec doesn't seem to work?,
Adam Smalin <=