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

Attributes

comments  [RW] 
file  [RW] 
line  [W] 

Public Class methods

Creates a new Sexp from Array a.

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.

Find every node with type name.

Replaces all Sexps matching pattern with Sexp repl.

If passed a line number, sets the line and returns self. Otherwise returns the line number. This allows you to do message cascades and still get the sexp back.

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

Returns the Sexp body, ie the values without the node type.

Returns the node type of the Sexp.

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]