I've been thinking about what a CFML parser has to do and man, it isn't
all that easy... I'm not sure any ".cfm" file could be parsed properly
without knowing the state of <cfoutput> before the file is (potentially)
cfincluded. In other words, if you see some text like "this is text#hi#
and some more", how can you be sure that "#hi#" represents a variable
interpolation (so, "hi" must be a variable, and it is apparently not
scoped) vs plain text that just happens to contain the literal string
"#hi#".    Of even worse, perhaps, would be a run of text like "this is
some text#here is some more"... Is there is a missing "#" after the
variable "here" (so, a syntax error), or not?  And when should "##" be
converted to the plain text "#"?  

All of these issues require the correct determination of the "cfoutput"
state, and the potential to cfinclude any file makes that pretty hard to
do on a file-by-file basis... You almost need to know which .cfm files
are "real" pages (mapped to urls) and which are "support" files (custom
tags or cfincludes).

And that is not even considering the problem of simply having to keep
track of <cfoutput> tags within a single file, which would have to be
done properly (including <cffunction output="x"> tags).  This could
definitely get tricky!

I imagine it is possible to use the compiled classes that CF makes to
get a better idea of how to parse things but that would not allow
CFEclipse (or some other plugin) to take advantage of such a parser.

I wonder if Macromedia would ever release a parser (say, in java) to the
open source community, as a way of stimulating third-party plugin and
tool development... 

Thanks
        Mark
 

-----Original Message-----
From: Jochem van Dieten [mailto:[EMAIL PROTECTED] 
Sent: Thursday, October 11, 2007 3:46 AM
To: CF-Talk
Subject: Re: CF Coding Standards

Gaulin, Mark wrote:
> What I would find more interesting is something approaching a "coding
style validator" for important things, like "var"ing local variables in
functions and always scoping variables properly (to the degree that I
would want), checking for cfparam tags for url, form, and attribute
variables, etc.  

I have experimented with a SVN hook that ran several checks including
Mike Schierberl's vasrScoper and an attempt to compile the code with
cfcompile.bat before allowing a commit. It wasn't exactly production
quality, but it can be done.

Jochem



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Download the latest ColdFusion 8 utilities including Report Builder,
plug-ins for Eclipse and Dreamweaver updates.
http;//www.adobe.com/cfusion/entitlement/index.cfm?e=labs%5adobecf8%5Fbeta

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:290855
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to