Sign in Join
FPDoc Onlineexperiment

TParser class

In unit Classes

Class to parse the contents of a stream containing text data.

Declaration

pascal
TParser = class(TObject)

Inheritance

  1. TParser
  2. TObject

Description

This class breaks a stream of text data in tokens. Its primary use is to help reading the contents of a form file (usually a file with dfm, xfm or lfm extension), and for this reason it isn't suitable to be used as a general parser.

The parser is always positioned on a certain token, whose type is stored in the Token property. Various methods are provided to obtain the token value in the desired format.

To advance to the next token, invoke NextToken method.

See also

Properties

FloatTypepublicThe type of a float token.
SourceLinepublicCurrent source line number.
TokenpublicThe type of the current token.

Methods

CreatepublicCreates a new parser instance.
DestroypublicDestroys the parser instance.
CheckTokenpublicChecks whether the token if of the given type.
CheckTokenSymbolpublicChecks whether the token equals the given symbol.
ErrorpublicRaises an exception with the given message.
ErrorFmtpublicRaises an exception and formats the message.
ErrorStrpublicRaises an exception with the given message.
HexToBinarypublicWrites hexadecimal data to a stream.
NextTokenpublicReads the next token and returns its type.
SourcePospublicReturns the current position in the stream.
TokenComponentIdentpublicReturns the path of a subcomponent starting from the current token.
TokenFloatpublicReturns the current token as a float.
TokenIntpublicReturns the current token as an integer.
TokenStringpublicReturns the current token as a string.
TokenWideStringpublicReturns the current token as a widestring.
TokenSymbolIspublicReturns True if the token equals the given symbol.

Inherited

From TObject (40)

AfterConstruction BeforeDestruction CheckDisposed ClassInfo ClassName ClassNameIs ClassParent ClassType CleanupInstance DefaultHandler DefaultHandlerStr Dispatch DispatchStr Disposed DisposeOf Equals FieldAddress Free FreeInstance GetDisposed GetHashCode GetInterface GetInterfaceByStr GetInterfaceEntry GetInterfaceEntryByStr GetInterfaceTable GetInterfaceWeak GetLastCastErrorInfo InheritsFrom InitInstance InstanceSize MethodAddress MethodName newinstance QualifiedClassName SafeCallException StringMessageTable SystemHasExtendedRTTI ToString UnitName

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.