CFScript parser borks on string literals containing tags #10

Open
am2605 opened this Issue Mar 5, 2013 · 2 comments

Projects

None yet

1 participant

@am2605
CFEclipse member

The parser is showing some odd behaviour on strings that wrap tags. For example paste this into a .cfc file and you should notice that formatting breaks after the line declaring the str1 variable.

component output="false" persistent="false" accessors="true" {

    function wrapInStrongTag(string someText)
    {
        var str1 = "<strong>#Ucase(arguments.someText)#</strong>";
        return str1;
    }

    function sayHello()
    {
        var loc = {};
        loc.foo = "bar";
    }    
}

Also if try and format this source, you get something like this:

component output="false" persistent="false" accessors="true" { function wrapInStrongTag(string someText) { var str1 = "
<strong>
    #Ucase(arguments.someText)#
</strong>
"; return str1; } function sayHello() { var loc = {}; loc.foo = "bar"; } } 

Denny - if you're able to point me towards the right spot (how to build the parser?) I'm happy to have a crack at looking into this further?

@am2605
CFEclipse member

Heh, just found a workaround. If you put a comment on the troublesome line, syntax highlighting works for the rest of the file, eg

var str1 = "<strong>#Ucase(arguments.someText)#</strong>"; /* blah */
@ghost

That's a nice workaround. I found the same issue when I use tags in savecontent:

savecontent variable="local.mailbody"{
writeOutput('

You got an error


');
}
// this comment will have the wrong color and mess up any cfscript following - unless you use the above workaround

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment