Was doing some hasty "debugging" and ended up with...
# lucee
a
Was doing some hasty "debugging" and ended up with this in my code:
Copy code
now()throw "this should be the exception I see";
Lucee gives
Missing [;] or [line feed] after expression on line 2
cos it's not parsing the code properly. I expect what CF does:
this should be the exception I see on line 2
. If CF can work out that the statement ends at
now()
, then Lucee oughta be able to as well, yeah? NB: sticking a line break in sorted me out, but still thing my laziness ought to be indulged here. Also perhaps points towards a general glitch in the code parser anyhow.
z
A/S/L I mean ASI again?
i think we have a ticket which covers this (probably from u?)
a
I had a squizz but could not find anything. Found one from you but it wasn't quite the same.
The ones I've raised in the past have been me not thinking through stuff like
abort [unrelatedexpression]
can seem like
abort "abort message"
(so I need to use a semi colon, eg: ``abort; [unrelatedexpression]``) and stuff like that. Am pretty sure this is different. I am completely fine with being proven wrong though.
z
yeah agree, file a new ticket
👍 1
a
BTW... "ASI"... "Adam Stupid Idiot"?
🎯 1
😆 1
😄
z
automatic semi-colon insertion
👍🏼 1
fun fact, @micha wrote the cfml parser as a uni project, that's why the code comments are in german
upside: easier to customise, downside: occasional quirks
a
automatic semi-colon insertion <<< that said in a swiss accent will also sound far more scary than that
🤣 1
a
where is the discomfort emoji when I need one?
😆 1
a
👀
g
And the "self_faceslap: enoji would be one I would use a lot!
z
having tried it myself and seen the stacktrace (always post the the top of the stacktrace and any caused by at the bottom) looks like we could conditionally teach it to treat
now()
as
now();
now it would need to ignore white space and check that the next character isn't a
.
https://github.com/zspitzer/Lucee/blob/6.0/core/src/main/java/lucee/transformer/cfml/script/AbstrCFMLScriptTransformer.java#L2254
a
I would not rush to any conclusions here. What about
someFunction() + somethingElse
. That would not serve by being interpreted as
someFunction(); + somethingElse
. It looks to me like the code parser has a glitch in that it's trying to treat
[expression] [statement]
as
[expression] [nextOperandOfExpression]
, but concludes there is a syntax error due to a missing
[operator]
or something like that. Instead of going "OK well that's clearly not
[expression] [nextOperandOfExpression]
, I had better read ahead to see if there's a
[beginningOfStatement]
there instead, in which case I need to infer an end of statement after `[expression]`" But then again I'm buggered if I know how any of this works.
z
good thing i read german 🙂 can you drop a ticket for me?
basically, if the next non whitespace character starts with a letter, it more or less covers that yeah?
hmmm, adobe says letters, code or unicode currency symbol are allowed as the first character of a variable name https://helpx.adobe.com/coldfusion/developing-applications/the-cfml-programming-language/using-coldfusion-variables/creating-variables.html
_ $, euro and pound symbols are supported in lucee
a
VARIABLE NAMING RULES
[...]
• A variable name must begin with a letter, underscore, or Unicode currency symbol.
• The initial character can by followed by any number of letters, numbers, underscore characters, and Unicode currency symbols.
From https://helpx.adobe.com/coldfusion/developing-applications/the-cfml-programming-language/using-coldfusion-variables/creating-variables.html First variant I tried failed on Lucee, btw.
Copy code
௹a = 123
writeOutput(௹a)
https://trycf.com/gist/bef7e66c005b265a935a0ca11f469322/acf2021?theme=monokai (
௹
picked @ random from https://www.compart.com/en/unicode/category/Sc) There's a chance it could be trycf.com, as the text editor behaves "oddly" around that character. Best check in a reallyreally install.
(this, btw, has been a thing since back to at least CF5... although having just checked: not explicitly stated in the docs like it is above; still seems to "work")
z
i'd be happy if only $ was supported TBH
a
You just wanna be writing PHP code. Admit it.
z
Yes -> $ido
😜 1