Class Sexp
In: lib/sexp.rb
Parent: Array

Sexps are the basic storage mechanism of SexpProcessor. Sexps have a type (to be renamed node_type) which is the first element of the Sexp. The type is used by SexpProcessor to determine whom to dispatch the Sexp to for processing.

Methods

Public Class methods

Creates a new Sexp for klass or method in klass.

If walk_ancestors is true and method is provided, walks the ancestors of klass until a method definition is found.

Creates a new Sexp from Array a, typically from ParseTree::translate.

Create a new Sexp containing args.

Public Instance methods

Returns true if this Sexp‘s pattern matches sexp.

Returns true if this Sexp matches pattern. (Opposite of #===.)

Returns true if the node_type is array or args.

REFACTOR: to TypedSexp - we only care when we have units.

Enumeratates the sexp yielding to b when the node_type == t.

Replaces all elements whose node_type is from with to. Used only for the most trivial of rewrites.

Replaces all Sexps matching pattern with Sexp repl.

Returns the node named node, deleting it if delete is true.

Returns the Sexp without the node_type.

If run with debug, Sexp will raise if you shift on an empty Sexp. Helps with debugging.

Returns the bare bones structure of the sexp. s(:a, :b, s(:c, :d), :e) => s(:a, s(:c))

Replaces the Sexp matching pattern with repl.

[Validate]