Class: Iode::Reader

Inherits:
Whittle::Parser
  • Object
show all
Defined in:
lib/iode/reader.rb

Overview

Lisp reader, converting strings to lisp data structures.

Instance Method Summary collapse

Instance Method Details

#read(source) ⇒ Array

Read a string in as lisp data.

Parameters:

  • source (String)

    iode source code to read in as lisp

Returns:

  • (Array)

    the source code as data for execution



93
94
95
96
97
98
99
100
# File 'lib/iode/reader.rb', line 93

def read(source)
  progn = parse(source)
  if progn.length > 1
    [:progn, *progn]
  else
    progn.first
  end
end