Class ALinearCParser

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type ALinearCParser = class(AParsedLanguageParser)

Description

This class represents a parser for the LinearC language. It descends from AParsedLanguageParser because the parser does not output to an intermediate code stream, and though it still makes use of a symbol table representative of the options that can be set on the command line by the user, it needs only one of those.

The parser automatically constructs an instance of TheLinearCLanguage to manage the tokens it parses. This language specification will be freed when the parser is freed.

To use the parser, simply pass an instance of AStringStream that contains a string with all command-line options on it to the constructor, then call ALinearCParser.parse.

Hierarchy

Overview

Fields

Protected MyOptions: ACommandLineOptionDictionary;

Methods

Public constructor forSource(const ThisSource: AStream; const TheseOptions: ACommandLineOptionDictionary; const ThisLog: ALog); overload; virtual;
Public function init: boolean; override;
Public destructor destroy; override;
Public function parse: int64; override;
Public function Options: ACommandLineOptionDictionary; virtual;

Description

Fields

Protected MyOptions: ACommandLineOptionDictionary;

Refers to the options that are parsed

Methods

Public constructor forSource(const ThisSource: AStream; const TheseOptions: ACommandLineOptionDictionary; const ThisLog: ALog); overload; virtual;

Construct a new instance of ALinearCParser that will parse the command line represented by ThisSource using the options specified by TheseOptions, and outputting error and status information to ThisLog.

This method constructs a new instance of ATextInputStream around ThisSource.

Public function init: boolean; override;

Initializer

Public destructor destroy; override;

Destroy the parser.

This method frees the instance of ATextInputStream that was constructed by ALinearCParser.forSource and then calls the inherited routine.

Public function parse: int64; override;

Parse the command line.

This method builds on the behavior inherited from AParsedLanguageParser.parse; it calls that routine, then constructs an instance of ALinearCStatementBlock to parse the entire command line.

If ALinearCParser.Options returns Nil, indicating that no instance of ACommandLineOptionDictionary was passed to the constructor when the parser was created, then this routine will do nothing and will return -1.

Public function Options: ACommandLineOptionDictionary; virtual;

Retrieve a reference to the dictionary of command-line options that may be set by the user.

The caller should NOT attempt to free this reference before freeing the parser.


Generated by PasDoc 0.13.0 on 2015-01-10 17:13:18