reading up on the sources you pointed to in the vfp / local thread with own brain tuned to rather dumb/not optimizing vfp, the code in
https://github.com/X-Sharp/XSharpPublic ... /Macro.prg
is not nice to CPU...
Code: Select all
INTERNAL FUNCTION _IsIdentifier(cName AS STRING) AS LOGIC
LOCAL lFirst := TRUE AS LOGIC
FOREACH VAR c IN cName
IF lFirst
IF ! _IsIdentifierStartChar(c)
RETURN FALSE
ENDIF
ELSE
IF ! _IsIdentifierPartChar(c)
RETURN FALSE
ENDIF
ENDIF
lFirst := FALSE
NEXT
RETURN TRUE
Code: Select all
INTERNAL FUNCTION _IsIdentifier(cName AS STRING) AS LOGIC
LOCAL lFirst := TRUE AS LOGIC
FOREACH VAR c IN cName
IF lFirst
IF ! _IsIdentifierStartChar(c)
RETURN FALSE
ENDIF
lFirst := FALSE
ELSE
IF ! _IsIdentifierPartChar(c)
RETURN FALSE
ENDIF
ENDIF
NEXT
RETURN TRUE
Code: Select all
INTERNAL FUNCTION _IsIdentifier(cName AS STRING) AS LOGIC
*-- guessing this code is from base[0] land, perhaps replace with the constants for base/lowerbound index value
*-- check for empty cName probably not needed, but as previous loop was for ... each, guarantee first char to exist
IF cName:Length()=0 OR ! _IsIdentifierStartChar(cName[0])
RETURN FALSE
ENDIF
*-- loop from 2. char, modify with base index if used not only in zero based strings
FOR var lnRun := 1 TO cName:Length()-1
IF ! _IsIdentifierPartChar(cName[lnRun])
RETURN FALSE
ENDIF
NEXT
RETURN TRUE
regards
thomas