Re: Macro to check that local variables are declared in a method? [Solved]

2018-04-30 Thread Bob Miller via 4D_Tech
RE> What I?m not sure how to do (well, I?m unwilling to spend the time, because WTH) is capture spaces within a variable name. If anyone puts spaces in a variable name, well, they deserve what they get. I also realized that constructions such as ARRAY TEXT($aMyTextArray;$ArraySize) contain

Re: Macro to check that local variables are declared in a method? [Solved]

2018-04-29 Thread Patrick Emanuel via 4D_Tech
Hi, I have this regex to find all kind of variable in QS_Toolbox. May it will help you to increase the impact of your method ;-) $PatternVariables:="(?mi-s)(\\b[[:alpha:]][\\w+]*\\b)[?=\\:|\\;|\\)|\\>|\\<|\\{|\\}|\\]|\\[|\\r|\\n]|(\\$[\\w+]*\\b)|(<>[[:alpha:]][\\w+]*\\b)" Patrick -

Re: Macro to check that local variables are declared in a method?

2018-04-28 Thread Nigel Greenlee via 4D_Tech
Bob I have a component that declares all my variables(not just locals). Locals were simple-everything else was hard. It relies on you having a definable format(i.e type is at end or demarked by _ ) and having consistent(even if varying) way of identifying type (e.g _at is is array text and

Re: Macro to check that local variables are declared in a method? [Solved]

2018-04-28 Thread John Baughman via 4D_Tech
> On Apr 27, 2018, at 12:17 PM, Bob Miller via 4D_Tech <4d_tech@lists.4d.com> > wrote: > > RE> I don?t have a macro for you, but I?m curious to know why asking the > compiler to check the syntax isn?t enough? Another reason is that for some usages of a local variable starting with one of the

Re: Macro to check that local variables are declared in a method? [Solved]

2018-04-28 Thread Lee Hinde via 4D_Tech
I was looking at that string and testing it a bit more (after it’s been canonized, of course.) Underscores aren't captured in the original, which a lot of us use - e.g.e, $somestring_t This captures those: \$[_a-zA-Z0-9]* All I did was add the underscore between the []. What I’m not sure

Re: Macro to check that local variables are declared in a method? [Solved]

2018-04-27 Thread jim.dorrance--- via 4D_Tech
Wow! Useful, thanks. Sent from my iPhone > ** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub:

Re: Macro to check that local variables are declared in a method? [Solved]

2018-04-27 Thread Bob Miller via 4D_Tech
Thanks to everyone for all the responses! I put the macro at the end of this posting. Cannon Smith inquired: RE> I don?t have a macro for you, but I?m curious to know why asking the compiler to check the syntax isn?t enough? 1. It may not be a syntactical problem; I may have simply forgotten

Re: Macro to check that local variables are declared in a method?

2018-04-27 Thread Tim Nevels via 4D_Tech
On Apr 27, 2018, at 1:03 PM, Jody Bevan wrote: > I would suggest if you are going to write something this far, why not make it > so that it will declare all local variables for you, and remove declarations > that are no longer needed. A great time saver. Of course to go that far, > there needs

Re: Macro to check that local variables are declared in a method?

2018-04-27 Thread John DeSoi via 4D_Tech
$localRegex:="\\$[0-9_\\p{Letter}]+" //Includes parameters. Assumes locals do not have spaces. A simple way to ensure you are not matching within strings is to split the method into lines and then on each line collapse the strings so they are empty. You only need to do this on lines that have

Re: Macro to check that local variables are declared in a method?

2018-04-27 Thread Patrick Emanuel via 4D_Tech
Hi, I haven't a macro but a tool that try to answer to this point (not only). It works on local ($), variable (without $ or <>) and global (<>) variable. Manage $ and <> variables is pretty easy, standard variable, more difficult. So, this code works with method of all objects and cross

Re: Macro to check that local variables are declared in a method?

2018-04-27 Thread Jody Bevan via 4D_Tech
Bob: Another thought to watch out for. As you know in some cases 4D names some of it’s own things starting with a ‘$’. For example a Process name can be named starting with a ‘$’. If you have strictly named local variables those should be easy to filter out. Jody > On Apr 27, 2018, at 9:54

Re: Macro to check that local variables are declared in a method?

2018-04-27 Thread Jody Bevan via 4D_Tech
Bob: I would suggest if you are going to write something this far, why not make it so that it will declare all local variables for you, and remove declarations that are no longer needed. A great time saver. Of course to go that far, there needs to be a strictly enforced naming convention.

Re: Macro to check that local variables are declared in a method?

2018-04-27 Thread Lee Hinde via 4D_Tech
On Apr 27, 2018, at 8:54 AM, Bob Miller via 4D_Tech <4d_tech@lists.4d.com> wrote: > > Hello, > > Has anyone created a macro to check a method to make sure all its local > variables are declared? > > I've thought about undertaking such a thing, but as it probably involves > getting into

Macro to check that local variables are declared in a method?

2018-04-27 Thread Bob Miller via 4D_Tech
Hello, Has anyone created a macro to check a method to make sure all its local variables are declared? I've thought about undertaking such a thing, but as it probably involves getting into regular expressions, I've been looking forward to doing this with some dread. If anyone has done this