Does Autocompletion require a formal lexer?
-
@lycan-thrope
I’ve got a question about possibly handling duplicates in the Autocompletion file, if they’re allowed and/or how to handle them if they are.dBASE, for those that don’t know, is one of the original big 3 of PC desktop applications in the early days. Since then, a lot of updating has been done, and one of the early changes was making a small SQL variant in the langage called LocalSQL, that allows dBASE’s tables and other database variants tables to be used inside dBASE with that LocalSQL. Unfortunately, there are a couple of actual Functions that are identically named, but handled differently. The dBASE editor handles them appropriately in the IDE and programs. I’d like to be able to provide the identical word, to be used by both, but the hints on completion would be different.
I’m asking if that is possible and if not, cie la vie.
Thanks in advance for any insight,
Lee
-
@lycan-thrope
Well, I guess I answered my own question. I put both in with different descriptions and parameter number and the result it, it went with the first one in the list, meaning, it’ll never reach the second.I guess a work around could be just putting the Function attribute in, but putting a text with advice on the two options, if the text hint can be big enough, so they can look at it, while they type it, but not putting any parameters in so it will stay up instead of jumping to the variable as it’s being filled in. Got to go try it.
Lee
-
@lycan-thrope said in Does Autocompletion require a formal lexer?:
handling duplicates in the Autocompletion file, if they’re allowed and/or how to handle them if they are.
If I understand correctly. the same name has different parameter lists: am I correct?
If so, you can look at the Perl autocompletion that ships with NPP – for example, the
eval
has multiple option lists, which are implemented by multiple<Overload>
entries in the same<KeyWord>
:<KeyWord name="eval" func="yes"> <Overload retVal="" descr="catch exceptions or compile and run code"> <Param name="BLOCK" /> </Overload> <Overload retVal="" descr="catch exceptions or compile and run code"> <Param name="EXPR" /> </Overload> <Overload retVal="" descr="catch exceptions or compile and run code"> <Param name="" /> </Overload> </KeyWord>
You’ll see a little
1 of 3
with arrows for choosing between them
And if it does something different with each argument list, you can even have a different Description for each.
This is described in the Overload section of the autocompletion docs
-
@lycan-thrope
That did the trick. Still comes up with a hint, but stays up while typing and I was able to basically document the two differences in the description. Problem solved. :) If there are any other tricks I don’t know about that can make it work otherwise, any help would be appreciated.Lee
-
@peterjones ,
Thanks…I just saw it when my own response was loading. LOL Thanks that looks a lot more effective.Lee
-
@peterjones ,
Thank you again, that worked perfectly. I guess I didn’t catch that in the Overload section as I thought that it meant for each of the Overload sections…not realizing it meant for each keyword. Thanks again for catching my lack of understanding what I’m reading. :-) I did call you a genius, now you’re a mind reader. Heheh.Lee
-
Here’s what I went with, adding the reason for each version, so there would be no mistakenly taking the one without knowing which it applied to.
<KeyWord name="MAX" func="yes"> <Overload retVal="{Greater value}" descr="dBASE - Compares two numbers (or two date, character, or logical expressions) and returns the greater value."> <Param name="value exp1" /> <Param name="value exp2" /> </Overload> <Overload retVal="{Greater value}" descr="SQL - Compares provided expression and returns the greater value"> <Param name="value exp1" /> </Overload> </KeyWord>
There is duplicates for at least each SQL function used as well as equivalents in dBASE. For instance, the Upper() and Lower() are identical, so I didn’t see any need to worry about those, since they take the same kind and number of parameters, but as you can see, Min() and Max() take different numbers of parameters and perhaps types.
Thanks again.
Lee
-
@lycan-thrope
I have a little problem. I filled in a keyword function here:<KeyWord name="ACOPY" func="yes"> <Overload retVal="{nVal}" descrip="Copies elements from one array to another. Returns the number of elements copied."> <Param name="<source array>"/> <Param name="<target array>"/> <Param name="[<startingelement expN>]"/> <Param name="[<elements expN>]"/> <Param name="[<targetelemnt expN>]]]"/> </Overload> </KeyWord>
But this is all that shows:
I’m missing some text and not quite sure why. Any ideas? I don’t see any out of place syntax highlighting in the text, even though it is long. Is there a limit to length before it’s ignored?
Thanks in advance.
Lee
-
@lycan-thrope
On a hunch, just in case, I need to disclose that the keyword just before it doesn’t have a “Parameter” section in the “Overload” section, like so:<KeyWord name="ACCESS" func="yes"> <Overload retVal="{accessLevelN}" descrip="Returns the access level of the current user for DBF table security."> </Overload> </KeyWord>
Just in case that may have something to do with it. As I read the Autocompletion section, the parameter was an option, as is the description, but in this case, this function returns a security level of the user, and takes no parameters, as far as I know, but it does return an access level number for the users access priveledges. Hence, no parameter supplied…unless it needs to have a Null parameter there. Just an FYI for full disclosure. I also can’t get the description for this function which is why I bring it up. The other desciptions past these two work, but these two don’t so I have reason to believe ther’s something there that’s wrong, but I’m just not seeing it, especially since I don’t see any syntax highlighting goofs.
Lee
-
Hello, @lycan-thrope, @peterjones and All,
@lycan-thrope, why do you use :
<Overload retVal="{nVal}" descrip="Copies elements from one array to another. Returns the number of elements copied.">
And not :
<Overload retVal="{nVal}" descr="Copies elements from one array to another. Returns the number of elements copied.">
Maybe, this syntax explains the problem ? ( not tested ! )
BR
guy038
-
Argh… Thanks.
I had made my self some skeletons to copy/paste to test some of the functions and parameters that I thought might give me problems before trying to do the file enmasse with the wonderfully written hints about how to mass format a keyword list…and apparently my hand typed abbreviations deviated from the proper abbreviations. :-(
Thanks… in my defense, it was another all-nighter and blurry eyes were present. :-)
Lee