Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

CFScript parser borks on string literals containing tags #10

Open
am2605 opened this Issue · 2 comments

1 participant

@am2605
Collaborator

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
Collaborator

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
Something went wrong with that request. Please try again.