Skip to content

jaredbeck/cfscriptify

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
bin
 
 
doc
 
 
src
 
 
 
 
 
 
 
 

CFScriptify

Converts CFML to cfscript.

Compile

mvn --quiet clean compile assembly:single

Maven 3 is assumed. For Mac users, it is available via homebrew.

The assembly:single "goal" (from maven-assembly-plugin) compiles target/cfscriptify-0.0.1.jar. This jar is self-contained, ie. includes its dependencies.

Usage

Reads CFML on stdin, writes cfscript to stdout.

echo '<cfset x = 1>' | java -jar target/cfscriptify-0.0.1.jar
# x = 1;

There's an optional bin/run.sh that may be convenient for some people.

Sublime Text 2 Plugin

Nothing polished yet, but here's a starting point:

  1. Make sure the tests (described above) pass
  2. Tools -> New Plugin ..
  3. Paste in src/main/sublime/cfscriptify.py
  4. Edit cfs_path() to return the path to run.sh
  5. Select some CFML
  6. Try your new plugin in sublime's python shell (ctrl-backtick)
    • view.run_command("cfscriptify")
  7. If it works, bind a key, eg.
    • { "keys": ["ctrl+alt+super+s"], "command": "cfscriptify" }

Limitations

  • Tags: Only the most common 20% of tags are supported (See Appendix A).
  • Operators: Mixed-case, eg. CoNtAiNs, is legal in CFML, but not supported here.

Whitespace Output

  • Line Endings: LF (but CR and CRLF are acceptable as input)
  • Indentation: Tabs, but I'd welcome a pull request for spaces

Development

PRs welcome.

bin/test.rb [--skip-compile] [test numbers ..]
  1. Write a new test in src/test
  2. Most changes start in src/main/java/CFScriptifyListener.java
  3. Sometimes, we need to improve the ANTLR grammar, src/main/antlr4/CFML.g4

References

Appendix A: Supported CFML Tags

Supported (25)

cfabort cfbreak cfcatch cfcomponent cfcontent cfcontinue cfdefaultcase cfdump cfelse cfelseif cffinally cfheader cfif cfinclude cflocation cflock cflog cfparam cfrethrow cfreturn cfscript cfset cfsilent cfswitch cfthrow cftry

Partially supported (4)

cfargument is supported except that hint and displayName attributes are discarded, because the syntax for those attributes is awkward in cfscript. I'd welcome a pull request.

cfcase is supported for single values. List values are not supported yet.

cffunction is supported for the following attributes: name, access, and returnType. The output attribute is ignored, and all other attributes will cause an error.

cfloop is supported for list, array, and from/to/step. Support is planned for loop over query, structure, and condition. Loop over date range is rare, but wouldn't be too difficult to implement. Finally, loop over file is rare and has no convenient cfscript equivalent.

No Plans to Support (118)

These tags either do not have convenient cfscript equivalents, have complicated varients (eg. cffile), or are too rare to be worth the trouble. Pull requests, however, are welcome.

cfapplication cfassociate cfajaximport cfajaxproxy cfapplet cfcache cfcalendar cfchart cfchartdata cfchartseries cfcol cfcollection cfcookie cfdbinfo cfdirectory cfdiv cfdocument cfdocumentitem cfdocumentsection cferror cfexchangecalendar cfexchangeconnection cfexchangecontact cfexchangefilter cfexchangemail cfexchangetask cfexecute cfexit cffeed cffile cffileupload cfflush cfform cfformgroup cfformitem cfftp cfgrid cfgridcolumn cfgridrow cfgridupdate cfhtmlhead cfhttp cfhttpparam cfimage cfimap cfimport cfindex cfinput cfinsert cfinterface cfinvoke cfinvokeargument cflayout cflayoutarea cfldap cflogin cfloginuser cflogout cfmail cfmailparam cfmailpart cfmap cfmapitem cfmediaplayer cfmenu cfmenuitem cfmessagebox cfNTauthenticate cfobject cfobjectcache cfoutput cfpdf cfpdfform cfpdfformparam cfpdfparam cfpdfsubform cfpod cfpop cfpresentation cfpresentationslide cfpresenter cfprint cfprocessingdirective cfprocparam cfprocresult cfprogressbar cfproperty cfquery cfqueryparam cfregistry cfreport cfreportparam cfsavecontent cfschedule cfsearch cfselect cfsetting cfsharepoint cfslider cfspreadsheet cfsprydataset cfstoredproc cftable cftextarea cfthread cftimer cftooltip cftrace cftransaction cftree cftreeitem cfupdate cfwddx cfwindow cfxml cfzip cfzipparam

About

Converts common CFML to cfscript using Java.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published