Author Topic: PB KeyWords  (Read 340 times)

0 Members and 1 Guest are viewing this topic.

John

  • Hero Member
  • *****
  • Posts: 2813
PB KeyWords
« on: February 27, 2017, 01:36:29 AM »
James,

I noticed your post on the JRS forum and wondered why a simple INSTR() function wasn't used?

Code: [Select]
pbkeywords = """
"IF","THEN","ELSE","TRY","CATCH","END","SELECT","CASE","FUNCTION","SUB","ITERATE","FOR","NEXT","WHILE","UNTIL","DO","LOOP","WEND","STEP"
"EXIT","REGISTER","LOCAL","GLOBAL","STATIC","INCR","DECR","BY","DATA","OPT","OPTIONAL","CONST","SLEEP","RESOURCE","OBJECT","IMAGE","SWAP"
"AS","TO","GOTO","STDOUT","PRINT","PRINTR","PRINTBR","ECHO","DIM","REDIM","BYVAL","BYREF","BYCOPY","TYPE","TABLE","ENTRY","LANGUAGE","NAME"
"MACRO","EXPORT","REPLACE","WITH","IN","GOSUB","RETURN","ENDIF","MACROTEMP","ELSEIF","YES","NO","ON","OFF","REGISTER","SYSTEM","ARR","INFINITE"
"ASCEND","DESCEND","TAGARRAY","COLLATE","FROM","SCAN","INSERT","DELETE","VARIANT","TCP","PORT","AT","SEND","RECV","TIMEOUT","ALIAS","LIB"
"DECLARE","DEF","ERRORS","PLURIBASIC","WARNINGS","NOTICES","DEPRECATED","PARSES","ALL","NONE","ANY","EXACT","ITERATE","PHP","HTML","START"
"MYSQL","LOAD","SAVE","DELETE","WHERE","LIMITUDT","PBCC","PBWIN","USEUNICODE","CRACKERS","SESSTART","EXCLUSIVE","AUTO","OPEN","CLOSE","CLOSED"
"APPEND","INPUT","OUTPUT","SETEOF","SEEK","GET","PUT","PRINT","FOREACH","ACCESS","READ","WRITE","SHARED","LOCK","SEEK","LINE","CALL","BITWISE"
"LOGICAL","UDT","QUIT","ABORT","TERMINATE","DECLARE","CLASS","METHOD","PROPERTY","CREATE","DESTROY","INSTANCE","GET","SET","INTERFACE","LET"
"CREATE","DESTROY","WAITKEY$","RESET","RESERVE","DEFBYT","DEFDWD","DEFINT","DEFLNG","DEFSNG","DEFSTR","DEFWRD","DEFASC","BINARY"
"ISCOND","NOTNULL","AUTOINC","PRIMARY","ON","OFF","YES","NO","EXE","PHP","DLL","SLL","CONSOLE","EXCLUDE","INCLUDE","RAW"
"VARPTR","LBOUND","UBOUND", "SYS_ARR","SYS_IMG"
"IIF","CHOOSE","CHOOSES","CHOOSEI","CHOOSED","CHOOSEF","CHOOSEB", "USING","EOD"
"""

OPTION COMPARE sbCaseInsensitive

testcase = "WaitKey$"

IF INSTR(pbkeywords, "\"" & testcase & "\"") THEN
  PRINT TRUE,"\n"
ELSE
  PRINT FALSE,"\n"
END IF


jrs@jrs-laptop:~/sb/examples/test$ time scriba pbkw.sb
-1

real   0m0.005s
user   0m0.004s
sys   0m0.004s