Page 1 of 1

function folding question

Posted: 01 Oct 2010 02:26
by Tinhead
Sorry for a newbie question. Maybe it is answered somewhere else, but I was not able to find it.

I have to edit the post processor files for our CNC machines. The so called gpp files are a simple scripting language. Functions are defined like this:

@function1
.
. something happens here
.
endp

@anotherfunction
....
endp

So, they always start with '@....' and end with 'endp'.
At the moment I use SuperEdi to edit them. There I use the following regular expression to highlight the function line: ^[@]{[:_A-Za-z0-9]+}
( = @ at start of line, followed by some alphanumerics)
That highlights the line, but it does not support code folding.

I tried to use @ as block start, region start, etc., because I would love to use the code folding function for those areas.

Could someone show me how to set up the syntax file for this? I'd really like to drop SuperEdit, RJ TextED looks much more capable :D

Cheers,
Rainer

Posted: 01 Oct 2010 08:10
by Rickard Johansson
You should probably have something like below in your syntax ini file:

Code: Select all

[Block]
1_Name=Function
1_OnLine=1
1_AsString=1
1_Start=@
1_End=


[Fold]
1_Id=~@
1_Begin=
1_End=endp
1_EndBefore=
1_Section=
1_NoParentOfId=1
1_NotAlwaysEnded=0
1_ListItem=ceMethod

Re: function folding question

Posted: 19 Jul 2012 00:23
by Tinhead
sadly that didn't work. Back to see if the never version of RJ TextEd might be able to help me (hate to be stuck with SuperEdi).
Again, here what my code looks like:

@end_program

; {nb,'L=POFF'}
{nl,'%'}
{nl,'[FORATURA01]'}
{nl,'%'}
{nl,'[TABELLEFORI01]'}
{nl,'%'}
{nl,'[LABELC01]'}
{nl,'%'}
{nl,'[LABELF01]'}
{nl,'%'}
{nl,'[CONFASSIST01]'}
{nl,'%'}
{nl,'[ATTREZZAGGIO01]'}
{nl,'%'}
endp

;-------------------

@end_of_file

{nl,'[]'}
endp

;-------------------

@def_tool

; temp save tool messages
if tool_user_type ne "TOOL DRILL" then
tool_count = tool_count+1
tool_msg<<tool_count>> = tool_message
tool_typem<<tool_count>> = tool_type
endif

endp

As explained, every functions starts with '@functionname' and ends with 'endp'
Could anyone help me with this? I would like it to 'fold' and maybe even to show up in the function list.

Cheers,
Rainer

Re: function folding question

Posted: 19 Jul 2012 18:22
by Rickard Johansson
I haven't tested this since I don't have your syntax file, but maybe the [Block] thing is interfering with the folding. Have you tried just to add

Code: Select all

[Options]
Symbols=@ ... (plus anything else that you need)

[Fold]
1_Id=~@
1_Begin=
1_End=endp
1_EndBefore=
1_Section=
1_NoParentOfId=1
1_NotAlwaysEnded=0
1_ListItem=ceMethod
without any [Block] items?

Re: function folding question

Posted: 19 Jul 2012 21:38
by Tinhead
WONDERFUL :D

Finally some light at the end of the tunnel, I'm so glad that I had another look at your editor. Thank you so very much for your help.
One my problems actually was the help file .. it did not work on Windows 7, but I got that one fixed (had to 'unblock' it).

The folding is working now, the 'Symbol' option did the trick.
I attached the syntax file and an example gpp file, just in case there are others using SolidCAM.

Cheers,
Rainer