It's on the go.
I like it in both the syntax you suggested.
I'm just thinking what's the best way to implement.
Currently I try to find a fast method to scan some dynamic string-array for just a part of the string to create some auto-complete-stuff.
So I have a dynamic string-array containing all the keywords.
Now when the user types for example the letters "func" - it's obvious that he wants to type either "Function", "Function_CParams" or something like that so i want my script make to suggest this.
The solution were some Array-method that works a little bit as Array Scan myArray, Collate Ucase, = "func" but i imagine more like
where it performs a complete array scan on sourceArray() and all members of sourceArray that match "FUNC" will be collected in destinationArray().Dim sourceArray() As String Dim destinationArray() As String Dim sFile as String = "c:\thinBasic\thinAir\Syntax\thinBasic\thinBasic_Keywords.ini" Dim nKeywords, nMatches As Long nKeywords = Parse File sFile, sourceArray, $CRLF '... nMatches = Array sourceArray, Left$ = "FUNC" [, Collate Ucase] To destinationArray
Array-members thats length is less then "FUNC" should not cause error.
Syntax above is just for better understanding what i mean.
Instead of "Left$" it could be named however you like
alternative it could return an array of indexes - or just work as the current Array Scan-waynMatches = Array Select sourceArray, StartsWith "FUNC", Collate Ucase To destinationArray
StartsWith/EndsWith (both are keywords already) in that case were only a switch as "=", "<=" etc.Long lStart, lPos Do lPos = Array Scan sourceArray(lStart+1), Collate Ucase, StartsWith "FUNC" If lPos = 0 Then Exit Do '... do something with matching element '... go for the next one.... lStart += lPos Loop
Of course only valid to scan for strings.
If possible it could also Array Scan Ptr for elements that StartsWith/EndsWith
i just care for functionality
Last edited by ReneMiner; 29-10-2015 at 23:50.
I think there are missing some Forum-sections as beta-testing and support
It's on the go.
I like it in both the syntax you suggested.
I'm just thinking what's the best way to implement.
www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000
What about the following syntax:
nItems will contain the number of elements foundnItems = ARRAY EXTRACT mainArray(), StartsWith | EndsWith | Like (regular expression string) [, Collate ...] InTo destinationArray
mainArray will be automatically sorted
destinationArray will automatically free and re-dimensioned
Like comparison will use regular expressions already valid for REGEXPR$. Anyway still to think how to do this one.
www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000
reads good
Into
a keyword with a bright future... should make more use of it.
inMyPockets = [Module]_PutStuff [source [,condition1 [, condition2...]]] Into myPockets()
Last edited by ReneMiner; 29-10-2015 at 23:48.
I think there are missing some Forum-sections as beta-testing and support
Development done.
New functionality will be present in next 1.9.16 version that I will publish by tomorrow (or before if I finish few things)
Syntax will be the following:
Example:ARRAY EXTRACT MainArray, [COLLATE UCASE,] {StartsWith | EndsWith | Contains} ComparisonStringExpression InTo DestinationArray
Uses "Console" Dim sourceArray() As String Dim destinationArray() As String Dim nKeywords, nMatches, nCount As Long nKeywords = Parse APP_ListKeywords($CRLF), sourceArray, $CRLF nMatches = Array extract sourceArray(), Collate Ucase, StartsWith "FUNC" inTo destinationArray PrintL "Found:", nMatches For nCount = 1 To nMatches PrintL nCount, destinationArray(nCount) Next WaitKey
www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000
Last edited by ReneMiner; 31-10-2015 at 11:52.
I think there are missing some Forum-sections as beta-testing and support
Not in this release but if it is working fine with standard string arrays, it is quite easy to add arrays of pointers.
So first check this and soon I will add the PTR version.
Updated 1.9.16 is already into the link you know.
Just test it and if OK I will work for the tomorrow public release.
www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000
bad news: scripts don't run no more - an optional function-parameter gets lost within a function:
this one of my type-functions:
the variable lLine is used a few times succesfully...'------------------------------------------------------------------- Function TextSet(ByVal sText As String, _ Optional ByVal lLine As Long _ ) As String '-------------------------------------------------------------------
100 lines of code further, in same function follows this
Error Code 30'... If lLine < 1 Then ' ...
Variable not defined or misspelled Keyword
Token found: lLine
- script as is was running a few minutes ago using the previous tB 1.9.16 alpha
Last edited by ReneMiner; 31-10-2015 at 14:05.
I think there are missing some Forum-sections as beta-testing and support
Strange, here optional parameters seems working just fine.
I did'n change anything on that matter.
I worked on FOR/NEXT maybe is in this area.
I will check but I need a simple example showing the problem.
www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000
Bookmarks