Code folding request for Informix 4gl
-
- Posts: 15
- Joined: Mon Apr 09, 2007 5:24 pm
Code folding request for Informix 4gl
Jussi;
I would like to request support in code-folding for the Informix 4gl language. Here are the details requested by the first post in this area.
Extensions: .4gl
Line Comment1: #
Line comment2: --
Block Comment: { }
Case Sensitive: NO
Begin: FOR
End: END FOR
Begin: CASE
End: END CASE
Begin: WHILE
End: END WHILE
Begin: FOREACH
End: END FOREACH
Begin: FUNCTION
End: END FUNCTION
Begin: REPORT
End: END REPORT
Begin: GLOBALS
End: END GLOBALS
Begin: INPUT
End: END INPUT
Begin: INPUT ARRAY
End: END INPUT
Begin: DISPLAY ARRAY
End: END DISPLAY
Begin: CONSTRUCT
End: END CONSTRUCT
Begin: MENU
End: END MENU
Begin: IF
End: END IF
Sample Code:
MAIN
DEFINE i integer
FOR i = 1 to 100
-- do something
END FOR
DECLARE t_curs CURSOR FOR
SELECT * FROM TABLE
FOREACH t_curs into p_rec.*
-- some statements
END FOREACH
CALL display_func()
IF int_flag THEN
EXIT PROGRAM(1)
ELSE
EXIT PROGRAM(0)
END IF
END MAIN
FUNCTION display_func()
DISPLAY ARRAY la_array.* TO sr_array
-- some statements
END DISPLAY
RETURN
END FUNCTION
If you need any other information on this please email me.
Thanks
I would like to request support in code-folding for the Informix 4gl language. Here are the details requested by the first post in this area.
Extensions: .4gl
Line Comment1: #
Line comment2: --
Block Comment: { }
Case Sensitive: NO
Begin: FOR
End: END FOR
Begin: CASE
End: END CASE
Begin: WHILE
End: END WHILE
Begin: FOREACH
End: END FOREACH
Begin: FUNCTION
End: END FUNCTION
Begin: REPORT
End: END REPORT
Begin: GLOBALS
End: END GLOBALS
Begin: INPUT
End: END INPUT
Begin: INPUT ARRAY
End: END INPUT
Begin: DISPLAY ARRAY
End: END DISPLAY
Begin: CONSTRUCT
End: END CONSTRUCT
Begin: MENU
End: END MENU
Begin: IF
End: END IF
Sample Code:
MAIN
DEFINE i integer
FOR i = 1 to 100
-- do something
END FOR
DECLARE t_curs CURSOR FOR
SELECT * FROM TABLE
FOREACH t_curs into p_rec.*
-- some statements
END FOREACH
CALL display_func()
IF int_flag THEN
EXIT PROGRAM(1)
ELSE
EXIT PROGRAM(0)
END IF
END MAIN
FUNCTION display_func()
DISPLAY ARRAY la_array.* TO sr_array
-- some statements
END DISPLAY
RETURN
END FUNCTION
If you need any other information on this please email me.
Thanks
Hi Mark,
A first cut of the new xFolder.dll can be found here: http://www.zeusedit.com/z300/xFolder.zip
To install the new file just backup the xFolder.dll in the Zeus install folder and replace it with the one in the zip file.
If you find any issues please report them here.
Cheers Jussi
A first cut of the new xFolder.dll can be found here: http://www.zeusedit.com/z300/xFolder.zip
To install the new file just backup the xFolder.dll in the Zeus install folder and replace it with the one in the zip file.
If you find any issues please report them here.
Cheers Jussi
-
- Posts: 15
- Joined: Mon Apr 09, 2007 5:24 pm
Some issues with informix 4gl code folding
Jussi;
Thanks for the quick turnaround on the folding.
A couple of issues so far:
1) It seems to be getting confused by comments on the same line as the keywords. Comments are allowed on the same line as a keyword, such as:
FUNCTION func_name
-- statements
END FUNCTION ##DECLARE_CURSORS
In this case it is folding up down to a line with just "END FUNCTION" on it, not the END FUNCTION it is supposed to use. (it may fold up the rest of the file if all the END FUNCTION's have comments.)
The keywords may not be the ONLY thing on a line, but it will be the FIRST thing on the line, after any whitespace.
2) There is a DISPLAY function in addition to the DISPLAY ARRAY that I had in the list. DISPLAY does not have a corresponding END statement, so we can't fold that. Can you look for both words together: DISPLAY ARRAY ?
3) The INPUT/END INPUT construct is folding up the whole rest of the document, and I don't see any comments after the END INPUT. There are variables on the line with the INPUT. Not sure if that is the cause.
Can you take a look at these?
Thanks
Mark
Thanks for the quick turnaround on the folding.

A couple of issues so far:
1) It seems to be getting confused by comments on the same line as the keywords. Comments are allowed on the same line as a keyword, such as:
FUNCTION func_name
-- statements
END FUNCTION ##DECLARE_CURSORS
In this case it is folding up down to a line with just "END FUNCTION" on it, not the END FUNCTION it is supposed to use. (it may fold up the rest of the file if all the END FUNCTION's have comments.)
The keywords may not be the ONLY thing on a line, but it will be the FIRST thing on the line, after any whitespace.
2) There is a DISPLAY function in addition to the DISPLAY ARRAY that I had in the list. DISPLAY does not have a corresponding END statement, so we can't fold that. Can you look for both words together: DISPLAY ARRAY ?
3) The INPUT/END INPUT construct is folding up the whole rest of the document, and I don't see any comments after the END INPUT. There are variables on the line with the INPUT. Not sure if that is the cause.
Can you take a look at these?
Thanks
Mark
-
- Posts: 15
- Joined: Mon Apr 09, 2007 5:24 pm
Sample for Informix 4gl folding
Jussi;
Here is a sample. It may be just the DISPLAY by itself that is causing all the issues I am seeing. When I comment out the DISPLAY statements, things appear to work much better.
Thanks
MAIN
DEFINE i integer
FOR i = 1 to 100
-- do something
END FOR #comment
DECLARE t_curs CURSOR FOR
SELECT * FROM TABLE
FOREACH t_curs into p_rec.*
-- some statements
DISPLAY t_curs to S_rec
END FOREACH #comment
CALL display_func()
IF int_flag THEN
EXIT PROGRAM(1)
ELSE
EXIT PROGRAM(0)
END IF
END MAIN
FUNCTION display_func()
DISPLAY ARRAY la_array.* TO sr_array
LET something = something_else
DISPLAY something TO screen
-- some statements
END DISPLAY
RETURN
END FUNCTION
Here is a sample. It may be just the DISPLAY by itself that is causing all the issues I am seeing. When I comment out the DISPLAY statements, things appear to work much better.
Thanks
MAIN
DEFINE i integer
FOR i = 1 to 100
-- do something
END FOR #comment
DECLARE t_curs CURSOR FOR
SELECT * FROM TABLE
FOREACH t_curs into p_rec.*
-- some statements
DISPLAY t_curs to S_rec
END FOREACH #comment
CALL display_func()
IF int_flag THEN
EXIT PROGRAM(1)
ELSE
EXIT PROGRAM(0)
END IF
END MAIN
FUNCTION display_func()
DISPLAY ARRAY la_array.* TO sr_array
LET something = something_else
DISPLAY something TO screen
-- some statements
END DISPLAY
RETURN
END FUNCTION
Hi Mark,
The new version of the xFolder.dll that fixes the problem with the display can be found here:
http://www.zeusedit.com/z300/xFolder.zip
Cheers Jussi
The new version of the xFolder.dll that fixes the problem with the display can be found here:
http://www.zeusedit.com/z300/xFolder.zip
Cheers Jussi
-
- Posts: 15
- Joined: Mon Apr 09, 2007 5:24 pm
One more folding issue
This is very Cool...
We are almost there.
I forgot about this goofy syntax that is allowed. You can have an IF THEN/END IF all on one line, so if it is a simple one, people do use it this way.
The folding is going all the way down to the END FUNCTION. See the last few lines in the modified sample.
MAIN
DEFINE i integer
FOR i = 1 to 100
-- do something
END FOR #comment
DECLARE t_curs CURSOR FOR
SELECT * FROM TABLE
FOREACH t_curs into p_rec.*
-- some statements
DISPLAY t_curs to S_rec
END FOREACH #comment
CALL display_func()
IF int_flag THEN
EXIT PROGRAM(1)
ELSE
EXIT PROGRAM(0)
END IF
END MAIN
FUNCTION display_func()
DISPLAY ARRAY la_array.* TO sr_array
LET something = something_else
DISPLAY something TO screen
IF u2 > u3 THEN
-- output something
END IF
-- some statements
END DISPLAY
INPUT ARRAY array_new FROM screen_rec
-- this type of if/then/end if is a problem.
IF joe > bob THEN EXIT INPUT END IF
END INPUT
RETURN
END FUNCTION
We are almost there.
I forgot about this goofy syntax that is allowed. You can have an IF THEN/END IF all on one line, so if it is a simple one, people do use it this way.
The folding is going all the way down to the END FUNCTION. See the last few lines in the modified sample.
MAIN
DEFINE i integer
FOR i = 1 to 100
-- do something
END FOR #comment
DECLARE t_curs CURSOR FOR
SELECT * FROM TABLE
FOREACH t_curs into p_rec.*
-- some statements
DISPLAY t_curs to S_rec
END FOREACH #comment
CALL display_func()
IF int_flag THEN
EXIT PROGRAM(1)
ELSE
EXIT PROGRAM(0)
END IF
END MAIN
FUNCTION display_func()
DISPLAY ARRAY la_array.* TO sr_array
LET something = something_else
DISPLAY something TO screen
IF u2 > u3 THEN
-- output something
END IF
-- some statements
END DISPLAY
INPUT ARRAY array_new FROM screen_rec
-- this type of if/then/end if is a problem.
IF joe > bob THEN EXIT INPUT END IF
END INPUT
RETURN
END FUNCTION
Hi Mark,
Here is another version to try out: http://www.zeusedit.com/z300/xFolder.zip
Cheers Jussi
Here is another version to try out: http://www.zeusedit.com/z300/xFolder.zip
It usually takes a few goes to get the foldign working, as most languages seem to have their little quirks.I forgot about this goofy syntax that is allowed.
Cheers Jussi
-
- Posts: 15
- Joined: Mon Apr 09, 2007 5:24 pm
Code folding for Informix 4gl
Jussi;
One more little quirk.
The folding process seems to be confused by a section called "options". Something in there is making it miss all other keywords and fold all the way to the end of the file.
In the updated example, the MAIN/END MAIN does this as well as the IF/END IF section at lines 66-77.
I have added MAIN & END MAIN to the list of Begin/End tags. I didn't have this before for some reason but I think you figured it out.
Thanks
{
Extensions: .4gl
Line Comment1: #
Line comment2: --
}
-- Block Comment: { }
{
Case Sensitive: NO
Begin: FOR
End: END FOR
Begin: CASE
End: END CASE
Begin: WHILE
End: END WHILE
Begin: FOREACH
End: END FOREACH
Begin: FUNCTION
End: END FUNCTION
Begin: REPORT
End: END REPORT
Begin: GLOBALS
End: END GLOBALS
Begin: INPUT
End: END INPUT
Begin: INPUT ARRAY
End: END INPUT
Begin: DISPLAY ARRAY
End: END DISPLAY
Begin: CONSTRUCT
End: END CONSTRUCT
Begin: MENU
End: END MENU
Begin: IF
End: END IF
Begin: MAIN
End: END MAIN
Sample Code:
}
MAIN
DEFINE i integer
FOR i = 1 to 100
-- do something
END FOR #comment
DECLARE t_curs CURSOR FOR
SELECT * FROM TABLE
FOREACH t_curs into p_rec.*
-- some statements
DISPLAY t_curs to S_rec
END FOREACH #comment
CALL display_func()
IF joe > bob THEN EXIT INPUT END IF
IF int_flag THEN
EXIT PROGRAM(1)
ELSE
EXIT PROGRAM(0)
END IF
IF gv_mode_flag IS NULL THEN
CLEAR SCREEN
OPTIONS MESSAGE LINE 22,
COMMENT LINE 23,
ERROR LINE 24,
MENU LINE FIRST,
FORM LINE 3,
INPUT WRAP,
HELP KEY CONTROL-w,
HELP FILE "zzz_help"
END IF
END MAIN
FUNCTION display_func()
DISPLAY ARRAY la_array.* TO sr_array
LET something = something_else
DISPLAY something TO screen
IF u2 > u3 THEN
-- output something
END IF
-- some statements
END DISPLAY
INPUT ARRAY array_new FROM screen_rec
-- this type of if/then/end if is a problem.
IF joe > bob THEN EXIT INPUT END IF
END INPUT
RETURN
END FUNCTION
One more little quirk.
The folding process seems to be confused by a section called "options". Something in there is making it miss all other keywords and fold all the way to the end of the file.
In the updated example, the MAIN/END MAIN does this as well as the IF/END IF section at lines 66-77.
I have added MAIN & END MAIN to the list of Begin/End tags. I didn't have this before for some reason but I think you figured it out.
Thanks
{
Extensions: .4gl
Line Comment1: #
Line comment2: --
}
-- Block Comment: { }
{
Case Sensitive: NO
Begin: FOR
End: END FOR
Begin: CASE
End: END CASE
Begin: WHILE
End: END WHILE
Begin: FOREACH
End: END FOREACH
Begin: FUNCTION
End: END FUNCTION
Begin: REPORT
End: END REPORT
Begin: GLOBALS
End: END GLOBALS
Begin: INPUT
End: END INPUT
Begin: INPUT ARRAY
End: END INPUT
Begin: DISPLAY ARRAY
End: END DISPLAY
Begin: CONSTRUCT
End: END CONSTRUCT
Begin: MENU
End: END MENU
Begin: IF
End: END IF
Begin: MAIN
End: END MAIN
Sample Code:
}
MAIN
DEFINE i integer
FOR i = 1 to 100
-- do something
END FOR #comment
DECLARE t_curs CURSOR FOR
SELECT * FROM TABLE
FOREACH t_curs into p_rec.*
-- some statements
DISPLAY t_curs to S_rec
END FOREACH #comment
CALL display_func()
IF joe > bob THEN EXIT INPUT END IF
IF int_flag THEN
EXIT PROGRAM(1)
ELSE
EXIT PROGRAM(0)
END IF
IF gv_mode_flag IS NULL THEN
CLEAR SCREEN
OPTIONS MESSAGE LINE 22,
COMMENT LINE 23,
ERROR LINE 24,
MENU LINE FIRST,
FORM LINE 3,
INPUT WRAP,
HELP KEY CONTROL-w,
HELP FILE "zzz_help"
END IF
END MAIN
FUNCTION display_func()
DISPLAY ARRAY la_array.* TO sr_array
LET something = something_else
DISPLAY something TO screen
IF u2 > u3 THEN
-- output something
END IF
-- some statements
END DISPLAY
INPUT ARRAY array_new FROM screen_rec
-- this type of if/then/end if is a problem.
IF joe > bob THEN EXIT INPUT END IF
END INPUT
RETURN
END FUNCTION
Ther problem is these two lines.MENU LINE FIRST,
INPUT WRAP,
Because they are MENU and INPUT lines they are both seen as point points but there are no matching END MENU and END INPUT end of fold points.
For example if you comment these lines out the folding will be fine.
So what happend to these end points?
For every point that is defined as a begin fold there must be a matching end fold otherwise the Zeus folding logic will just fail as it has in this case.
Cheers Jussi
PS: Is 4gi a valid file extension in addition to 4gl

-
- Posts: 15
- Joined: Mon Apr 09, 2007 5:24 pm
Questions reply
Jussi;
Do you have any kind of an 'exclusion list' where you can say: First word= INPUT but not if second word = WRAP ?
A 4gi is a compiled version of a 4gl, so one would not bring it up in an editor. We can ignore it.
Thanks
Mark
Do you have any kind of an 'exclusion list' where you can say: First word= INPUT but not if second word = WRAP ?
A 4gi is a compiled version of a 4gl, so one would not bring it up in an editor. We can ignore it.
Thanks
Mark
That is easy enough to do.Do you have any kind of an 'exclusion list' where you can say: First word= INPUT but not if second word = WRAP ?
Is there any similar rule for the MENU case

Cheers Jussi
Last edited by jussij on Mon Jun 22, 2009 3:04 pm, edited 1 time in total.
-
- Posts: 15
- Joined: Mon Apr 09, 2007 5:24 pm
Folding reply
Jussi;
Inside of an OPTIONS section you can have:
INPUT WRAP
INPUT NO WRAP
MENU LINE
We would want to ignore all of these in favor of INPUT and MENU. Those are the only ones I can find that would interfere with begin/end points.
I think you are already handling the DISPLAY word by itself? It should be ignored in favor of DISPLAY ARRAY.
Thanks
Mark
Inside of an OPTIONS section you can have:
INPUT WRAP
INPUT NO WRAP
MENU LINE
We would want to ignore all of these in favor of INPUT and MENU. Those are the only ones I can find that would interfere with begin/end points.
I think you are already handling the DISPLAY word by itself? It should be ignored in favor of DISPLAY ARRAY.
Thanks
Mark
The Zeus folder has to decide if a line is a fold point using nothing but the information found in that line. I other words it will not know if it is or isn't inside a OPTIONS section.Inside of an OPTIONS section you can have:
INPUT WRAP
INPUT NO WRAP
MENU LINE
So for example the best the folder can do in these cases is ignore INPUT lines that are followed by WRAP and NO WRAP and ignore the MENU lines if it is follwed by LINE.
But will this be enough to stop invalid fold points

If it isn't then the best thing to do is just remove INPUT nad MENU as fold points.
Will doI think you are already handling the DISPLAY word by itself? It should be ignored in favor of DISPLAY ARRAY.

Cheers Jussi
-
- Posts: 15
- Joined: Mon Apr 09, 2007 5:24 pm
Folding
Jussi;
Yes I agree, the Options statement cannot not come into play. It should be enough to look for the second word in these cases.
Thanks
Mark
Yes I agree, the Options statement cannot not come into play. It should be enough to look for the second word in these cases.
Thanks
Mark