NOT operator precedence not grabbing operators in the chain
Description
Activity

Brad Wood October 23, 2024 at 7:36 PM
We need to ensure our BoxLang docs show the correct precedence for the NOT operator in Boxlang with a note that says CF code will use CF’s precedence

Brad Wood October 23, 2024 at 7:35 PM
Ok, I have left the “not” operator with a higher precedence in BoxLang to match most other languages. I have modified our CF transpiler to rewrite the AST on the fly for the following expressions
into this
You can actually test this by putting the first block of code into a .cfs file and then running it through the BL transpiler, and it will spit out the second block in a .bxs file
Please let me know if I’ve missed anything. Also note, I’m only handling binary concatenation. Our parser optimizes code like
into a single BoxStringConcat
AST node with 4 expressions inside, and I’m only rewriting concats with 2 expressions for now.
Luis Majano October 21, 2024 at 10:26 AM
I refactored the code in ColdBox. I had no clue it was treating it like that anyways. I say, let’s break off and move the incompat to the compact module.

Brad Wood October 18, 2024 at 8:01 PM
Discussion opened here https://community.ortussolutions.com/t/where-to-attach-the-not-operator/10404

Brad Wood October 18, 2024 at 4:54 PM
So, in Java or JS the !
operator usually attaches to the next immediate expression it finds. In CF, this is true ONLY if you have code like
but if you have
then the !
attaches to the entire foo eq bar
expression, not just the foo
expression. This prolly won’t be great for grammar performance since it means the not operator has to look ahead and figure out what the next expression actually is.
Note, CF’s look ahead only goes one expression deep. Given
the !
ONLY attaches to foo eq bar
instead of attaching to the entire foo eq bar && baz eq bum
expression.