From: Michael Matz Date: Wed, 12 Jul 2023 13:10:10 +0000 (+0200) Subject: Let '^' through the lexer X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f6f78318fca803c4907fb8d7f6ded8295f1947b1;p=binutils-gdb.git Let '^' through the lexer so that the (existing) code in parser and expression evaluator actually get to see it and handle it as XOR. Also adjust docu to match what's there. --- diff --git a/ld/ld.texi b/ld/ld.texi index aa8b1aa86eb..5009f0e5a6c 100644 --- a/ld/ld.texi +++ b/ld/ld.texi @@ -6818,19 +6818,21 @@ the standard bindings and precedence levels: @ifnottex @c END TEXI2ROFF-KILL @smallexample -precedence associativity Operators Notes +precedence associativity Operators Notes (highest) -1 left ! - ~ (1) +1 left ! - ~ (1) 2 left * / % 3 left + - 4 left >> << -5 left == != > < <= >= -6 left & -7 left | -8 left && -9 left || -10 right ? : -11 right &= += -= *= /= (2) +5 left > < <= >= +6 left == != +7 left & +8 left ^ +9 left | +10 left && +11 left || +12 right ? : +13 right += -= *= /= <<= >>= &= |= (2) (lowest) @end smallexample Notes: @@ -6856,13 +6858,15 @@ height2pt&\omit&&\omit&&\omit&\cr &2&&left&&* / \%&\cr &3&&left&&+ -&\cr &4&&left&&>> <<&\cr -&5&&left&&== != > < <= >=&\cr -&6&&left&&\&&\cr -&7&&left&&|&\cr -&8&&left&&{\&\&}&\cr -&9&&left&&||&\cr -&10&&right&&? :&\cr -&11&&right&&\qquad\&= += -= *= /=\qquad\ddag&\cr +&5&&left&& > < <= >=&\cr +&6&&left&&== !=&\cr +&7&&left&&\&&\cr +&8&&left&&^&\cr +&9&&left&&|&\cr +&10&&left&&{\&\&}&\cr +&11&&left&&||&\cr +&12&&right&&? :&\cr +&13&&right&&\qquad += -= *= /= <<= >>= \&= |=\qquad\ddag&\cr &lowest&&&&&\cr height2pt&\omit&&\omit&&\omit&\cr} \hrule} diff --git a/ld/ldlex.l b/ld/ldlex.l index 1a6be1b6af2..9cb002452d8 100644 --- a/ld/ldlex.l +++ b/ld/ldlex.l @@ -247,6 +247,7 @@ V_IDENTIFIER [*?.$_a-zA-Z\[\]\-\!\^\\]([*?.$_a-zA-Z0-9\[\]\-\!\^\\]|::)* "/" { RTOKEN('/'); } "%" { RTOKEN('%'); } "<" { RTOKEN('<'); } +"^" { RTOKEN('^'); } "=" { RTOKEN('='); } "}" { RTOKEN('}'); } "{" { RTOKEN('{'); }