PerformAutomaticOutlining change

SyntaxEditor for Windows Forms Forum

Posted 12 years ago by Vincent Parrett
Version: 4.0.0258
Avatar
Hi

Just installed build 258 and copied the change to PerformAutomaticOutlining from the simple language into my vbscript language.

This seems to break something in my outlining, if I start typing above the first collapsible block, outlining disappears and never returns. If I turn off outlining and then turn it on again the outlining returns. I was able to reproduce this with the simple language, but not consistently. Any ideas?

Regards

Vincent.

Comments (5)

Posted 12 years ago by Vincent Parrett
Avatar
Actually I don't think that change was it... event without that change this is still happening. What I found was, outlining only starts again for a block if I start typing in it

Regard

Vincent.
Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Vincent,

Can you try and narrow down a scenario in the sample application using a few lines of code in the editor and making a change to it, which repros this issue? Then please post that so we can debug this and see what exactly is wrong. Thanks!


Actipro Software Support

Posted 12 years ago by Vincent Parrett
Avatar
Ok, I am now able to reproduce it 100&% of the time.

1) Load up the sample app and open the sdi editor.
2) Switch to the Simple addon language
3) At the top of the file, hit enter to insert a line
4) type the following :

function anything()
{

}

This new function will have outlining, but the others will not. If you go and modifiy the code in the other functions, outlining returns for the modified function, you have to do this for each function though.

I see the exact same behavior in my vbscript language, I wasn't able to reproduce in the C# or VB.NET languages though.

HTH

Vincent.
Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Vincent,

The issue here seems to be that the Simple language didn't have proper error recovery. When a function production failed to match, it would simply stop parsing anything and that in turn corrupted the incremental update nature of the outlining.

Here is the update to the CompilationUnit production:
curlyBraceLevel = 0;
compilationUnit = new CompilationUnit();
compilationUnit.StartOffset = this.LookAheadToken.StartOffset;
System.Boolean errorReported = false;
while (!this.IsAtEnd) {
    if (IsNonTerminal("FunctionDeclaration")) {
        errorReported = false;
%>
        { "FunctionDeclaration<- ->" }
<% 
    }
    else {
        // Error recovery:  Advance to the next token since nothing was matched
        if (!errorReported) {
            this.ReportSyntaxError("Function declaration expected.");
            errorReported = true;
        }
        this.AdvanceToNext();
    }
}
compilationUnit.EndOffset = this.LookAheadToken.EndOffset;
The only change was to add the <- -> to the FunctionDeclaration. That keeps the semantic parser in the loop, even if a function declaration fails to match.


Actipro Software Support

Posted 12 years ago by Vincent Parrett
Avatar
Thanks, that was it for my VBScript parser too, since much of it was copied from the simple language.

Regards

Vincent
The latest build of this product (v2018.1 build 0341) was released 3 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.