Outlining - a token ends and starts an outlining node

SyntaxEditor for WPF Forum

Posted 2 years ago by Daisuke Nakada
Version: 17.2.0661
Avatar

I want to implement outlining functionality for my language.
My language's IF statement is like this:

IF D < 0 THEN
    statement
    statement
ELSIF D = 0 THEN
    statement
    statement
ELSE
    statement
    statement
END_IF;

Each IF/ELSIF/ELSE element is an outlining node.
Then, for example, if all nodes are closed, the code will look like this:

+ IF D < 0 THEN
+ ELSIF D = 0 THEN
+ ELSE
END_IF; 

issue 1:
An "ELSIF" token ends an outlining node for an IF element.
Furthermore, this "ELSIF" token starts another outlining node(outlining node for ELSIF element).

issue 2:
ELSIF/ELSE elements are optional.
So, when the ELSIF element is absent, an "ELSE" token ends an "IF" outlining node.
When both ELSIF and ELSE elements are absent, an "END_IF" token ends an "IF" outlining node.

Is there any way to achieve this using Token-Based Outlining Sources?
Or do I have to use Range-Based Outlining Sources?

[Modified 2 years ago]

Comments (2)

Posted 2 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Daisuke,

The problem is that a token can't end an outlining node and start one at the same time.  It can only take a single action.  You would probably need the newline character right before the ELSIF and ELSE to be the end of the outlining nodes above it.  It might be difficult to recognize that situation with token-based outlining, so you probably would be better off with range-based outlining.

[Modified 2 years ago]


Actipro Software Support

Posted 2 years ago by Daisuke Nakada
Avatar

I understand. I will try range-based outlining.

Thank you for your help.

The latest build of this product (v2019.1 build 0683) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.