Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

Share Me

  • Please share this topic with your friends. Click any of the icons below:
  • Twitter
  • facebook
  • reddit
  • email

SyntaxEdit JavaScript parser bug

Looks like a bug in the JavaScript parser.

Line is:
document.write('"<span class="xxxx"><span class="xxxxx"><span>Listen all</span></span></span><span class="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"></span></a><a href="xxxxxxxxxxx" target="_blank" onclick="return pop(this.href);">xxxxxxxxxxxxxxxxxxxxxxxxxx</a></font></p>');

It's mis-highlighting - especially the end of the line in red. Strangely, if you remove some of the 'x's in the strings to make the line shorter, it fixes itself. For example, remove two 'x's and it seems to highlight properly.

image

Comments

  • 5 Comments sorted by Votes Date Added
  • I can't reproduce this coloring. However, I've got an exception, in MegaDemo, which can be eliminated by inreasing MaxMatchPrimDepth value.
    As you remeber, MaxMatchPrimDepth and RaiseMatchPrimDepthError has been added for you as a check, which prevents too deep RegExp recursion.
  • edited September 22 Posts: 81Vote Up0Vote Down
    Interesting. I had MaxMatchPrimDepth set to 1000. Setting it higher allows more (but not many) x's in the line before the parsing messes up. I don't mind raising MaxMatchPrimDepth as long as the program doesn't crash.

    Do you have any suggestion for what to set MaxMatchPrimDepth to? Perhaps the default of 1000 is not enough? The line above really isn't that long and I'm surprised it has trouble handling the line.

    I'm also a little surprised that you couldn't reproduce it. Just copying and pasting the line into the editor and enabling the JavaScript parser causes the issue for me with MaxMatchPrimDepth set to 1000.

    Also, I could not raise an exception even when I made sure to set RaiseMatchPrimDepthError=true and the parsing messed up. Not sure why. I even tried the program in AQtime with the Exception Trace Profiler and it did not show any exceptions except for one that I don't think had anything to do with this issue.

  • I set MaxMatchPrimDepth to 5000. However, I see the line like this:

    image
  • edited September 25 Posts: 81Vote Up0Vote Down
    Can you reproduce the problem if you set MaxMatchPrimDepth to 1000 and use the JavaScript line I provided above?

    I would be happy to set MaxMatchPrimDepth to 5000 if it would not cause a stack overflow... what do you think? Perhaps you could do a recursion test to determine the best value for MaxMatchPrimDepth - a value that is as high as it could possibly be (under normal stack sizes) but low enough so that stack overflows are not a danger?
  • With MaxMatchPrimDepth set to 1000 I've got prim-depth exception. If I turn off RaiseMatchPrimDepthError, then I see the same line coloring, as with MaxMatchPrimDepth set to 5000.
Sign In or Register to comment.