Function List - Nesting

Syntax highlighting, code folding, brace matching, code indenting, and function list

Function List - Nesting

Postby nosbor » Sun Mar 30, 2008 6:29 am

hi

is this possible in function list view?

for example say i have the following c function definition :

void main_program(int in){

call_function_1();
call_function_2();
...
}


then in the function list it would show up as follows:

main_program
...call_function_1
...call_function_2

only one level of nesting would be good enough.

thanks
nosbor
Newbie
 
Posts: 2
Joined: Sat Mar 29, 2008 11:32 am

Re: Function List - Nesting

Postby Mofi » Sun Mar 30, 2008 10:05 am

No, nesting is not possible. And call_function_1(); is not a function definition, it is a call of a function. Normally only function definitions (should be) are in the function list.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4054
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: Function List - Nesting

Postby jorrasdk » Mon Mar 31, 2008 3:10 am

I agree with Mofi that the function list generally should contain, well function definitions.

But I work with NATURAL source code and beside functions (SUBROUTINES) I want some other constructs of the language in my function list nested and indented.

So I right click in the function list and remove the checkmark from the "sort list" option.

Then I make sure that the other language constructs "capture" whitespace in front of the command. Example:
/Function String = "^\d{4} DEFINE SUBROUTINE[ ]+([\w_\-]+)"
...
/Function String 3 = "^\d{4}[ ]*?([ ]CALLNAT[ ]+[']?[\w\-]+[']?)"
...

Notice that I capture a blank in front of CALLNAT:
([ ]CALLNAT
which indents the CALLNAT (function call) slightly from the functions in the function list.

It looks something like this:
Code: Select all
A-STACK-FUNKTIONSNAVNE
   STACK COMMAND 'FOOO-P82'
E-RETTELSE-TIL-TEKST
   CALLNAT 'NFOOBAR0'
F-KONTROLLER

(more than one whitespace is added to better illustrate my point).

A 'dirty' workaround but it's ok for my use.

So if you are able to write a pattern that will match your function calls in your C code you should be able to do the same when you integrate it into the existing C wordfile definition (search for "Syntax Highlighting" in the UE help for more info.).
User avatar
jorrasdk
Master
Master
 
Posts: 275
Joined: Mon Mar 19, 2007 11:00 pm
Location: Denmark

Re: Function List - Nesting

Postby nosbor » Mon Mar 31, 2008 10:53 am

thanks i will try to implement something now i know there is a sort of solution to it.
nosbor
Newbie
 
Posts: 2
Joined: Sat Mar 29, 2008 11:32 am


Return to Syntax Highlighting