jed-users mailing list

[2015 Date Index] [2015 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

[jed-users] Re: find outer brace


On Tue 2015-09-29 (12:51), Ulli Horlacher wrote:
> How can I find the outer brace within a code block in C, slang or perl
> mode? 

Ok, it was easy:



define goto_brace_next() {
  variable bc = 0;
  
  while (not bobp()) {
    go_left(1);
    switch (what_char())
      { case '}' : bc++; }
      { case '{' : 
        if (bc > 0) bc--;
        if (bc == 0) return;
      }
  }
}


define goto_brace_outer() {
  variable bc = 0;
  
  while (not bobp()) {
    go_left(1);
    switch (what_char())
      { case '}' : bc++; }
      { case '{' : 
        if (bc == 0) return;
        bc--;
      }
  }
}

-- 
Ullrich Horlacher              Server und Virtualisierung
Rechenzentrum IZUS/TIK         E-Mail: horlacher@xxxxxxxxxxxxxxxxxxxx
Universitaet Stuttgart         Tel:    ++49-711-68565868
Allmandring 30a                Fax:    ++49-711-682357
70550 Stuttgart (Germany)      WWW:    http://www.tik.uni-stuttgart.de/
REF:<20150929105125.GA4590@xxxxxxxxxxxxxxxxxxxx>
_______________________________________________
For list information, visit <http://jedsoft.org/jed/mailinglists.html>.


[2015 date index] [2015 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]