Class ATokenList
Unit
parsing
Declaration
type ATokenList = class(ALinkedList)
Description
This class represents a list of tokens that can be used as a sequential list or a stack. It is designed to be used by instances of AParser and its descendants, wherein tokens read from a source stream are pushed onto the list and then popped off (and freed) as the source is parsed.
Hierarchy
Overview
Methods
Description
Methods
|
function init: boolean; override; |
Initializer
|
|
procedure push(const ThisToken: AToken); virtual; |
Push ThisToken onto the end of the list.
After calling this routine, ATokenList.LastToken will return a reference to ThisToken , while a call to ATokenList.Pop will remove ThisToken and return it to the caller.
|
|
function Pop: AToken; virtual; |
Pop the last token from the list.
If there are no tokens on the list, this routine will return Nil . Otherwise, it returns the most recent token pushed onto the list by a call to ATokenList.push.
|
|
function TokenAt(const index: longint): AToken; virtual; |
Retrieve the token at the specified index.
This method causes a sequential search of the list to be performed; for very large lists, therefore, it may be inefficient.
Index zero (0) represents the first token in the list, while the last token is always at index (ATokenList.census - 1 ). If index specifies a value that is greater than the number of items in the list, then this method returns the last item in the list.
|
|
function FirstToken: AToken; virtual; |
Retrieve a reference to the first token in the list.
|
|
function LastToken: AToken; virtual; |
Retrieve a reference to the last token in the list.
|
Generated by PasDoc 0.13.0 on 2015-01-10 17:13:18
|