Close all open ranges by single regex/rule

All questions regarding lexer highlighting schemes are discussed here...
Post Reply
iferius
Posts: 12
Joined: 30.06.2017 08:57

Close all open ranges by single regex/rule

Post by iferius »

So I'm still using my own custom lexer to view logs, which is a massive improvement over the simple highlighting that Notepad++ offered. For the next version, I want to really make use of the tree view to navigate the log; however, I'm having trouble resetting the tree when a session is ended abruptly (closing a tab instead of clicking return in the application).

Is there a way to have a single token/regex end all open ranges?
Alexey
Posts: 1633
Joined: 05.10.2012 22:10

Post by Alexey »

1- "trouble resetting the tab"--? I know lexer with "grammar rules" can give errors. but what is this?
2- ??
I know you can set one rule as closing rule for many ranges.
iferius
Posts: 12
Joined: 30.06.2017 08:57

Post by iferius »

I'll give you an example.

Code: Select all

<a>
    <b>
    </b>
    <b>
          <c>
Log terminated at this point. This is what I get when a new session starts (in the same log file):
               <a>
This is what I want to achieve:
<a>
Essentially, I want one token (the string "\session\start'", to be exact) to close all unclosed ranges so I can start from zero indentation.
Alexey
Posts: 1633
Joined: 05.10.2012 22:10

Post by Alexey »

You need to those ranges (<a> <c> etc) set ending rule, which works also on "\session\start".
iferius
Posts: 12
Joined: 30.06.2017 08:57

Post by iferius »

We're halfway there! This works with different ranges, but not with nested versions of the same range:

Code: Select all

<a>
       <a>
       </a>
       <a>
                  <a>
                   \session\start
       <a>
Alexey
Posts: 1633
Joined: 05.10.2012 22:10

Post by Alexey »

I dont have solution: \sess\start can close ONE block <a> but it cannot close many of them.
ps.
\sess\start can start sub-lexer range, and other can close sub-lexer range. in this range rules <a> </a>wont work.
iferius
Posts: 12
Joined: 30.06.2017 08:57

Post by iferius »

Thanks for the help! Maybe a sub-lexer will do the trick, and if not, I'll just figure out a way to close as much as possible. I haven't tried macro's in Synw yet, this might be a good opportunity to learn!
Post Reply