Creating thinBasic keywords lists
This script can be useful in case you want create or edit thinBasic scripts with other editors but keep syntax highlight possibility.
Usually every editor featuring syntax highligh has some kind of files where to store keywords or other specific language features.
Just modify this script to follow your editor syntax highlight file rules and you go. Every time we update thinBasic with new keywords or equates this script will output all the new features. Which other scripting or compiled language gives you this option?
[code=thinbasic] '---Load all modules in order to get all keywords
#INCLUDE "%APP_INCLUDEPATH%\thinbasic_GL.inc"
#INCLUDE "%APP_INCLUDEPATH%\thinbasic_GLU.inc"
#include "%APP_INCLUDEPATH%\ODBC352.INC"
uses "BIFF"
uses "CGI"
uses "Console"
uses "Crypto"
uses "File"
uses "DT"
uses "FTP"
uses "INet"
uses "INI"
uses "LL"
uses "MATH"
uses "OS"
uses "PC"
uses "RAS"
uses "Registry"
uses "SAPI"
uses "SMTP"
uses "TcpUdp"
uses "XML"
uses "ZLib"
uses "UI"
uses "TBGL"
uses "COM"
uses "tokenizer"
uses "stat"
uses "TBASS"
uses "Eval"
USES "TBDI"
DIM sKeys AS STRING
DIM aKeys() AS STRING
DIM nKeys AS LONG
DIM Count AS LONG
DIM sOut AS STRING
'---Get a string with equates separated by $TAB
sKeys = APP_ListEquates
'---Parse string into an array
PARSE sKeys, aKeys, $TAB
'---Creates output buffer with equates
nKeys = UBOUND(aKeys(1))
FOR Count = 1 TO nKeys
sOut = sOut & aKeys(Count) & $CRLF
NEXT
'---Get a string with keywords separated by $TAB
sKeys = APP_ListKeywords & $tab & APP_ListFunctions
'---Parse string into an array
PARSE sKeys, aKeys, $TAB
'---Creates output buffer with keywords and functions
nKeys = UBOUND(aKeys(1))
FOR Count = 1 TO nKeys
if aKeys(Count) = "" then iterate for
IF aKeys(Count) <> "REM" THEN
sOut = sOut & aKeys(Count) & $CRLF
END IF
NEXT
'---Save buffer into .txt file
File_Save(app_sourcepath & "thinBasic_KeyWords.txt", sOut)
MSGBOX 0, app_sourcepath & "thinBasic_KeyWords.txt file created!"
[/code]
Re: Creating thinBasic keywords lists
Another Gem of a script, thanks!!
Re: Creating thinBasic keywords lists
I'm sorry for replying to a topic this old, but since there are only 2 threads in this sub-forum, I don't feel so bad. Why waste a new thread since my question has to do with what this thread is about?
Eros, your script is great. It isn't something you find in other languages that I know of, so good job. Is there a way to modify it or do something similiar so that you get only the keywords for one particular module?
If not, is there a place that I can see all the keywords in a particular module? The help file usuallly does the trick, but not all the keywords are listed for ODBC, for example. Or, at least that is how I understand it.
Mark
Re: Creating thinBasic keywords lists
Mark,
unfortunately there is no way at the moment to get the list of keywords present just in one module. You will always get the list if thinBasic Core Engine plus the keywords of the modules used by the script. So, thinBasic core engine keywords will be always present.
Regarding specific request of keywords of ODBC, ODBC is not a module (so there are no keywords) but a source code include file of a dll that wraps operating system ODBC library. You can get all the function used in that source code looking at \thinBasic\Inc\ODBC352.INC
In that file, every function is listed and commented. The big job has been done by José Roca and can be found at: http://www.jose.it-berater.org/ (look ODBC reference guide).
Ciao
Eros
Re: Creating thinBasic keywords lists
Quote:
Originally Posted by Eros Olmi
unfortunately there is no way at the moment to get the list of keywords present just in one module. You will always get the list if thinBasic Core Engine plus the keywords of the modules used by the script. So, thinBasic core engine keywords will be always present.
Okay, that makes sense. It would be helpful to know what module a keyword goes to, and since everything isn't in the helpfile, it would be even more helpful. Is there a way to show what module a keyword goes with?
Here's a crude example of what I am talking about:
[code=thinbasic]
IF aKeys(Count) <> "REM" THEN
sOut = sOut & aMod(Count) & "-" & aKeys(Count) & $CRLF
END IF
[/code]
Of course, aMod would show what module the keyword, equate, or function came from.
Mark ???
Re: Creating thinBasic keywords lists
Quote:
Originally Posted by marcuslee
... and since everything isn't in the helpfile ...
Please list the missing items in help forum and we will try our best to fill it (if possible).
It is hard to bealive but we spent more time in thinBasic help fine than in thinBasic development. This because, even if thinBasic is free, we want create a professional help usually not seen in free software.
Writing help files is an hard work but we are committed to have this work done as better as we can.
Do you ("you" here is used in general form) have some piece of help you would like to write? Just let us know and we will be very happy to have it done by you.
Ciao
Eros