Inconsistencies with cfml tag syntax in cfscript


#1

I tried to fix the lucee cfml script parser last night because this code throws Missing [;] or [line feed] after expression
throw message=“test” type=“custom”;

But then I noticed this other syntax exists that I didn’t know about yet and this syntax doesn’t throw the error.
cfthrow(message=“test”, type=“custom”);

It looks like coldfusion 11 introduced this new syntax where they look like named attribute function calls. Perhaps that is now considered the “right” way to do it and old code should move in this direction for best compatibility.

https://cfdocs.org/script

It’s weird since some other tags are able to detect the semicolon and get all the attribute values. Throw and include are broken in Lucee 5.3.2.16 for the old lucee style. They are also considered single attribute tags, which seems to be part of the problem, since forcing it to a different mode (2) got some of it working when I was debugging it. The single attribute syntax is the only one that works in old style:

include “temp.cfm”;

but the lucee documentation says this should work too and it doesn’t, so at least a doc update is needed:

include “temp.cfm” runonce=true;

but then again, i can do this with no problem:

cfinclude(template=“temp.cfm”, runonce=true);

I went back to the original version of Lucee 5.3 to verify the problem exists without my mods.

Since there is an alternative syntax that works, I might just rewrite all the errors to that syntax and ignore the problem. Maybe the old syntax should throw a different kind of error like saying to use the newer tag syntax because this is not supported anymore. It causes confusion to say there is no semicolon when there is one.


#2

I find the first line very hard to read, as it seems to be out-of-syntax, whilst then function with named params is natural. I came over some code the other day that did not use functionName(), and it just did not feal right to read for debugging reasons.