class CLTK::Parser::Environment

Overview

All actions passed to Parser.producation and Parser.clause are evaluated inside an instance of the Environment class or its subclass (which must have the same name).

Defined in:

cltk/parser/environment.cr

Class Method Summary

Instance Method Summary

Instance methods inherited from class Object

in?(collection : Array | Set) in?

Class Method Detail

def self.new #

Instantiate a new Environment object.


[View source]

Instance Method Detail

def error(o) #

Adds an object to the list of errors.

@return [void]


[View source]
def errors : Array(CLTK::Type) #

A list of all objects added using the error method.

@return [Array<Object>]


[View source]
def he : Bool? #

Indicates if an error was encountered and handled.

@return [Boolean]


[View source]
def he=(he) #

Indicates if an error was encountered and handled.

@return [Boolean]


[View source]
def pos(n) #

Returns a StreamPosition object for the symbol at location n, indexed from zero.

@param [Integer] n Index for symbol position.

@return [StreamPosition] Position of symbol at index n.


[View source]
def reset #

Reset any variables that need to be re-initialized between parse calls.

@return [void]


[View source]
def set_positions(positions) #

Setter for the positions array.

@param [Array<StreamPosition>] positions

@return [Array<StreamPosition>] The same array of positions.


[View source]
def yield_with_self(&block) #

[View source]