[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] Reference for unit 'Classes' (#rtl)

TParser

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

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

Declaration

Source position: classesh.inc line 1619

type TParser = class(TObject)

public

  constructor Create();

  

Creates a new parser instance.

  destructor Destroy; override;

  

Destroys the parser instance.

  procedure CheckToken();

  

Checks whether the token if of the given type.

  procedure CheckTokenSymbol();

  

Checks whether the token equals the given symbol

  procedure Error();

  

Raises an EParserError exception with the given message

  procedure ErrorFmt();

  

Raises an EParserError exception and formats the message.

  procedure ErrorStr();

  

Raises an EParserError exception with the given message

  procedure HexToBinary();

  

Writes hexadecimal data to a stream.

  function NextToken;

  

Reads the next token and returns its type.

  function SourcePos;

  

Returns the current position in the stream.

  function TokenComponentIdent;

  

Returns the path of a subcomponent starting from the current token.

  function TokenFloat;

  

Returns the current token as a float.

  function TokenInt;

  

Returns the current token as an integer.

  function TokenString;

  

Returns the current token as a string.

  function TokenWideString;

  

Returns the current token as a widestring

  function TokenSymbolIs();

  

Returns True if the token equals the given symbol.

  property FloatType: Char; [r]

  

The type of a float token.

  property SourceLine: Integer; [r]

  

Current source line number.

  property Token: Char; [r]

  

The type of the current token.

end;

Inheritance

TParser

  

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

|

TObject

  

Base class of all classes.

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

TParser.Token

  

The type of the current token.

TParser.NextToken

  

Reads the next token and returns its type.


Documentation generated on: May 14 2021