abstract class Ven::Suite::Visitor

Overview

The base class for a node (in Ven, quote) visitor.

Direct Known Subclasses

Defined in:

ven/suite/visitor.cr

Constant Summary

MAX_VISIT_DEPTH = 2048

Maximum amount of nested #visit calls. This prevents the Crystal 'very deep recursion' error with thousands of entries jumpscaring a user. Since we're a visitor, we have to handle recursion depth errors well. The number will change, as any significant interpreter update generally decreases it.

WHAT: per one meaningful visit the Ven infrastructure may make over 10 (much more in reality) internal calls; this expodes the call stack very quickly, causing Ven itself to blow up. We prevent this by having a MAX_VISIT_DEPTH.

Instance Method Summary

Instance Method Detail

def last=(last : Quote) #

[View source]
def visit(quote : Quote) #

Remembers quote as the last visited node and hands it off to #visit!. Makes sure visit depth does not exceed MAX_VISIT_DEPTH.


[View source]
def visit(quotes : Quotes) #

Same as #visit(quote), but iterates over quotes.


[View source]
def visit!(quote : _) #

Fallback visitor (subclass has no such visitor).


[View source]