' redim_error2.bas
'==============================================================
'
'==============================================================
'==============================================================
' global definitions, declarations, and initialization
'==============================================================
'constants
CONST INCREMENT_SIZE
= 250
'types
'shared and work
'==============================================================
' mainline
'==============================================================
mainline:
'==============================================================
' load our definitions
'==============================================================
i = 1
tagTypes(i) = currentTagType
i = i + 1
numTagTypes = i - 1
i = 1
READ currentKeyword
, currentTagType
'todo: redim _preserve is losing the 2nd dimension? dup and report
'REDIM _PRESERVE definingKeywords(i - 1, 2) AS STRING
definingKeywords(i, 1) = currentKeyword
definingKeywords(i, 2) = currentTagType
PRINT definingKeywords
(i
, 1), definingKeywords
(i
, 2) IF currentKeyword
= "<label>" THEN pLabel
= i
IF currentKeyword
= "'$INCLUDE:" THEN pInclude
= i
i = i + 1
numDefiningKeywords = i - 1
delimiters = " :;()-+*/\"
'===============================================================
' got data?
'===============================================================
FOR i
= 1 TO numDefiningKeywords
PRINT definingKeywords
(i
, 1);
":"; definingKeywords
(i
, 2)
'===============================================================
' close files, we're done
'===============================================================
'==============================================================
' handle general runtime errors, can override. override
' handlers should be added after this one.
'==============================================================
handleError:
'==============================================================
' data blocks. if you are using data, in qb64 it needs to be
' defined before any subs/functions, so group it all here. i
' wish we could put each block closer to its use.
'==============================================================
dataBlocksHere:
'==============================================================
' qb64 keywords types.
'==============================================================
dataTagTypes:
'==============================================================
' qb64 keywords types.
'
' these are mostly sorted but two word variants are put in
' front of a single word form, eg "dim shared" comes before
' "dim". this simplifies the search. the list is short enough
' that the search will be sequential.
'
' format is keyword text in upper case, and what type of
' entity this defines.
'==============================================================
dataDefiningKeywords:
DATA "COMMON SHARED ","variable" DATA "COMMON ","variable" DATA "DECLARE DYNAMIC LIBRARY ","type" DATA "DECLARE LIBRARY ","type" DATA "DIM SHARED ","variable" DATA "FUNCTION ","function" DATA "<label>","label":
' there is no actual keyword text, rather colon DATA "REDIM _PRESERVE ","variable" DATA "REDIM SHARED ","variable" DATA "SHARED ","variable" DATA "STATIC ","variable" DATA "'$INCLUDE:","include"