Page 1 of 1

Autocompletion fails when names contain national characters

Posted: 18 Aug 2016 6:51
by Ferenc Nagy
The compiler allows the usage of national characters in variable, constant and function names.
I have discovered a contradiction of the autocompletion with this feature.

The Hungarian alphabet uses accented vowels:
If I define names like
Verb (sparrow)
V

Posted: 18 Aug 2016 10:13
by Thomas Linder Puls
We will look at it.

Posted: 19 Aug 2016 4:25
by Ferenc Nagy
Thomas,

The distributed version of the autocompletion collects the variable names in the clauses using a negative decision.
If the character is not in the {A..Z,a..z,0..9 underscore} set then the variable name has ended.
The patching of this set is tiresome. The list would be toooooooooooo looooooong. The danger that you forget a national character is apparent.

This positive decision will collect the whole national names:
If the character is in the set of separators {space, tab, newline, comma, semicolon, colon, period, parentheses, brackets} set then the variable name has ended.

Posted: 20 Aug 2016 22:31
by Thomas Linder Puls
Thank you. But actually I think we can handle this :-): it should work in the same way as the compiler.

Re:

Posted: 21 Aug 2016 6:58
by Ferenc Nagy
Thomas,
Thomas Linder Puls wrote:Thank you. But actually I think we can handle this :-): it should work in the same way as the compiler.
Indeed. I do not know how the complier collects the variable names but it collects them correctly. I attach the autocompletion of control names of a form defined during the automatic code generation.

Code: Select all

 

Posted: 22 Aug 2016 8:25
by Thomas Linder Puls
We use the Windows API function IsCharAlpha.

It is available through string_native:

Code: Select all

predicates     isCharAlpha : (char Character) -> booleanInt BOOL language apicall.     % @short See IsCharAlpha in MSDN.     % @end

Posted: 23 Aug 2016 10:36
by Ferenc Nagy
Thomas,
Thanky you for the mentioning of string_native library.
There are so many classes in the PFC which I have overlooked.

Posted: 23 Aug 2016 18:08
by Thomas Linder Puls
Normally, you should not use the _native classes directly, but it is not always that we get things mapped all the way to the "user" level.

The predicate string::hasAlpha does the same just for an entire string, i.e. it uses isCharAlpha on all the characters in the string and succeeds if they are all "alpha".