Libraries.Language.Compile.Parsing.TokenIterator Documentation

This class iterates over a token stream and provides helper operations in doing so.

Inherits from: Libraries.Language.Object, Libraries.Containers.Iterator

Summary

Actions Summary Table

ActionsDescription
Compare(Libraries.Language.Object object)This action compares two object hash codes and returns an integer.
Copy()This action copies the iterator.
Equals(Libraries.Language.Object object)This action determines if two objects are equal based on their hash code values.
FindRecentDocumentation()This action finds the most recent documentation toke
GetChannelToRead()This gets which channel we are going to work o
GetCurrent()This action gets the current item and does not move onto the next item to be iterated over.
GetHashCode()This action gets the hash code for an object.
GetLexer()This returns the lexer we are working o
HasNext()This action determines if there is a next item in the iteration.
IsReadingAllChannels()This determines whether or not we are counting all tokens as part of the source stream or skippin
IsRecentDocumentationFirstTokenOnly()This is a deprecated helper action that was used for testing comparisons to Antl
IsValid()Returns whether the current token has a valid index.
Look(integer bump)This action looks ahead or behind in the token stream and returns a token if one is found.
LookAhead(integer bump)This action looks ahead in the token stream and returns a token if one is found.
Next()This action gets the next item in the iteration and continues the iteration.
Rewind()This action starts the iteration over from the beginnin
SetChannelToRead(integer channelToRead)This sets which channel we are going to work o
SetLexer(Libraries.Language.Compile.Parsing.Lexer lexer)This sets the lexer we are working o
SetReadingAllChannels(boolean readAllChannels)This sets whether or not we are counting all tokens as part of the source stream or skippin

Actions Documentation

Compare(Libraries.Language.Object object)

This action compares two object hash codes and returns an integer. The result is larger if this hash code is larger than the object passed as a parameter, smaller, or equal. In this case, -1 means smaller, 0 means equal, and 1 means larger. This action was changed in Quorum 7 to return an integer, instead of a CompareResult object, because the previous implementation was causing efficiency issues.

Example Code

Object o
        Object t
        integer result = o:Compare(t) //1 (larger), 0 (equal), or -1 (smalle

Parameters

Return

integer: The Compare result, Smaller, Equal, or Larger.

Copy()

This action copies the iterator. This copy is shallow, meaning it does not copy the tokens involved and instead is used to provide more complex lookahead situations where we want to preserve the original iterato

Return

Libraries.Language.Compile.Parsing.TokenIterator:

Equals(Libraries.Language.Object object)

This action determines if two objects are equal based on their hash code values.

Example Code

use Libraries.Language.Object
        use Libraries.Language.Types.Text
        Object o
        Text t
        boolean result = o:Equals(

Parameters

Return

boolean: True if the hash codes are equal and false if they are not equal.

FindRecentDocumentation()

This action finds the most recent documentation toke

Return

Libraries.Language.Compile.Parsing.Token:

GetChannelToRead()

This gets which channel we are going to work o

Return

integer:

GetCurrent()

This action gets the current item and does not move onto the next item to be iterated over.

Return

Libraries.Language.Object: Returns the objec

GetHashCode()

This action gets the hash code for an object.

Example Code

Object o
        integer hash = o:GetHashCode

Return

integer: The integer hash code of the object.

GetLexer()

This returns the lexer we are working o

Return

Libraries.Language.Compile.Parsing.Lexer:

HasNext()

This action determines if there is a next item in the iteration.

Return

boolean: true if there is a next item and false if there is no

IsReadingAllChannels()

This determines whether or not we are counting all tokens as part of the source stream or skippin

Return

boolean:

IsRecentDocumentationFirstTokenOnly()

This is a deprecated helper action that was used for testing comparisons to Antl

Return

boolean:

IsValid()

Returns whether the current token has a valid index.

Return

boolean: true if the current token is at a valid inde

Look(integer bump)

This action looks ahead or behind in the token stream and returns a token if one is found. The token returned is the one on the same channel currently being rea

Parameters

Return

Libraries.Language.Object:

LookAhead(integer bump)

This action looks ahead in the token stream and returns a token if one is found. The token returned is the one on the same channel currently being rea

Parameters

Return

Libraries.Language.Object:

Next()

This action gets the next item in the iteration and continues the iteration.

Return

Libraries.Language.Object: Returns the object if it is valid and undefined otherwis

Rewind()

This action starts the iteration over from the beginnin

SetChannelToRead(integer channelToRead)

This sets which channel we are going to work o

Parameters

SetLexer(Libraries.Language.Compile.Parsing.Lexer lexer)

This sets the lexer we are working o

Parameters

SetReadingAllChannels(boolean readAllChannels)

This sets whether or not we are counting all tokens as part of the source stream or skippin

Parameters