Close all open ranges by single regex/rule

All questions regarding lexer highlighting schemes are discussed here...

Postby iferius » 14.07.2017 13:59

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?
iferius
 
Posts: 6
Joined: 30.06.2017 08:57

Postby Alexey » 14.07.2017 15:00

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.
Alexey
 
Posts: 611
Joined: 05.10.2012 22:10

Postby iferius » 14.07.2017 15:10

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.
iferius
 
Posts: 6
Joined: 30.06.2017 08:57

Postby Alexey » 14.07.2017 15:45

You need to those ranges (<a> <c> etc) set ending rule, which works also on "\session\start".
Alexey
 
Posts: 611
Joined: 05.10.2012 22:10

Postby iferius » 17.07.2017 08:50

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>
iferius
 
Posts: 6
Joined: 30.06.2017 08:57

Postby Alexey » 17.07.2017 11:05

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.
Alexey
 
Posts: 611
Joined: 05.10.2012 22:10

Postby iferius » 17.07.2017 13:23

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!
iferius
 
Posts: 6
Joined: 30.06.2017 08:57


Return to Lexers

Who is online

Users browsing this forum: No registered users and 1 guest

cron