|
||
A TLex
object is used to perform lexical analysis. The class is used to:
store a string
maintain an extraction mark to indicate the current lexical element being analysed
maintain a pointer to indicate the next character to be examined.
Member functions provide facilities to allow analysis and extraction of lexical elements from a TLex
object, and a variety of string-to-number conversions.
The TLex
class provides general-purpose lexical analysis functions, using the locale-dependent functions of TChar
to identify
whether characters are digits, letters etc. The data for these locale-dependent functions is held in kernel-side locale tables.
Thus, TLex
functions which use them, require an executive call. If an application requires very fast lexical analysis of a language which
is not locale-specific, then there may be some advantage in designing and implementing a special-purpose lexical analyser
class.