// first see if we have an image and if we do write it
if(structKeyExists(rc,“image”)) and len(rc.image){
uploadFile = fileUpload(“/userFiles”, rc.image, " ", “makeunique”);
writeDump var=uploadFile, abort=1
}
I’ve tried it the traditional way with parens () too and always get the same error. What’s the right way to do this? Has to be common in cfcs right? Is it the file upload? The write dump? The syntax? I see this in a feew posts but haven’t found a definitive answer, seems to be related to how lucee parses scripts.
The error should have a line number in the tag context that tells you want line is at fault.
writeDump var=uploadFile, abort=1
This is not valid. writeDump() is a function call and needs parens. You’re trying to treat it as a tag. But even if it were, you’d need a semicolon at the end.
Ok, so this is my specific point, and I mentioned that I tried the TRADITIONAL methods with PARENS AKA parenthesis. This includes with and without semi-colons. So I’ve tried “ECMA Script Syntax” and “Modified Tag Syntax”.
55: 56: // first see if we have an image and if we do write it 57: if(structKeyExists(rc,“image”)) and len(rc.image){ 58: 59: uploadFile = fileUpload(“/userFiles”, rc.image, " ", “makeunique”);
Brad, I don’t know you personally but we have many secondary and tertiary contacts. I have no problem giving you full access to show me how to do it, but I’m not doing that in public.
There are three basic rules of semicolon insertion:
When, as the program is parsed from left to right, a token (called the offending token) is encountered that is not allowed by any production of the grammar, then a semicolon is automatically inserted before the offending token if one or more of the following conditions is true:
The offending token is separated from the previous token by at least one LineTerminator.
No, Lucee does not put an implicit semocolon before a closing brace
Perhaps it would be a good idea, but CFML is also not ECMA script, or at least doesn’t follow all its rules
New line or next safe word?
In CFML whitespace is not taken into consideration in the parser. You can put as many line breaks as you wish into any tag or function call. Therefore, it cannot be used to tell when your tag is ended. There is also no such safe word. Perhaps in a more strict language like Java, but in CFML how would the parser know the difference between
content reset=true;
and
content;
variables.reset=true;
if you wrote it like so:
content
reset=true
// or even ...
content reset=true
The token reset is not safe at all since the ambiguity still exists. It could be either an attribute to the tag or an unrelated variable set. Therefore, in Lucee’s generic “tag-in-script” syntax it reads until it finds the next semicolon. If it doesn’t find one, it errors.
Adobe is moving in the ECMA script direction, I think the specific rule about the closing brace would be ok, but could also be confusing… Lucee has bigger syntax problems to fry
totally agree that the whitespace rules shouldn’t apply.
They SAY that, but they also have yet to define what the heck it even means. I’m 98% sure they have no clue what it means and they stuck it on a conference slide because it looked good and someone mentioned it in a forum. Adobe would need to break compatibility to turn cfscript into a fully ECMA compliant language and that would be a pretty stupid and worthless venture in my opinion. I’m pretty sure the ACF 2021 release showed us what they will end up doing-- and it was basically them randomly grabbing a few ideas from JavaScript and tacking them onto CFScript. And that, I’m fine with-- so long as the ideas they borrow actually make sense in CFML.