posted 10-12-2006 02:46 PM
The Smart parser is not broken.Let me explain more clearly.
The Smart Parser reads all the source code of both the newly generated code and the previous source code.
It creates a table of SUBs/Functions. Each one is treated as a unique block of code.
All the code before a SUB or FUNCTION (obviously it is not another sub or function, but only code that can appear between subs or functions) is considered part of that block.
Code after the last SUB/Function will be lost, because it is not associated with a sub or function, so don't put any there.
The only exception to this is EZ_Main, where no code is to be put before it, since the designer must generate its own code before it. (the code tags can be used here to prevent removal of any type of code).
When the designer compares the two tables of code blocks, it finds all the subs that exist in the newly generated code which also exist in the previous code and leaves them alone (plus it adds any news ones generated).
Any subs or functions from the previous code which do not exist in the newly generated code are considered obsolete. The designer assumes they are for forms or controls removed during form editing.
So how does one keep any user defined subs/functions they write ?
You put them in front of any sub or function, except EZ_Main and then surround them with the '<<SAVE>> / '<<END>> macros !
The smart parser will then consider them non-subs/functions and they will be kept with the sub that comes immediately after the '<<END>> tag. They won't be moved.
You don't need the macro tags for non-sub code before code generated subs/functions. You just need them for user defined subs/functions.
All other code which the designer finds (ie user defined subs/functions or obsolete subs/functions) will be moved to the
#If %EZ_NOSKIPCODE section
so they won't get compiled. You don't lose the code, it just is removed from being compiled by the compiler directives.
The only time code can be lost be the smart parser is if it is put after the last sub/function and before the "#If %EZ_NOSKIPCODE compiler directive. The code is not associated with any subs/functions.
This means any code after the last sub will be lost. By using the macro tags around subs/functions after the last generated sub, the smart parser does not consider them subs/functions. Thats what the tags accomplish. Because of the tags, the parser just sees non-sub/function code after the last sub/function and as stated, it is removed.
I recommend putting all user defined subs/functions before the events procedure for the form they will be associated with (remember the code tags). You can also put them in an include file too.
While this may seem a little confusing, please remember that merging new code with previous code is not an easy task. I had to set up some rules to go by, and treating all subs/functions (with any code in front) as blocks was the only way to make the smart parser work.
Just remember the rules:
(1) Don't put user defined subs/functions before EZ_Main or after the last generated sub/function.
(2) Put all user defined subs/functions before one of the existing generated subs/functions and surround them with code tags.
(3) non-sub/function code does not require code tags.
(4) all non-sub/function code and user defined subs/functions (within code tags), are considered part of the first code generated sub/function after it. The parser keeps then together.
(5) all sub/functions found in previous source code which don't have a matching sub/function (unless within tags) in the newly generated code, are consider obsolete routines and will be placed in the skip code compiler directive at the end. You must manually delete this code.
[This message has been edited by Chris Boss (edited 10-12-2006).]