Browse Source

update for Crystal 0.17.4

master
rhysd 8 years ago
parent
commit
f661185d6f
6 changed files with 10 additions and 13 deletions
  1. +1
    -1
      README.md
  2. +2
    -2
      src/crisp/core.cr
  3. +1
    -1
      src/crisp/env.cr
  4. +1
    -1
      src/crisp/error.cr
  5. +4
    -7
      src/crisp/expr.cr
  6. +1
    -1
      src/crisp/reader.cr

+ 1
- 1
README.md View File

@ -35,7 +35,7 @@ Please see [mal test cases](https://github.com/rhysd/Crisp/tree/master/spec/cris
## Development Environment ## Development Environment
- OS X - OS X
- Crystal 0.7.1 ~ 0.7.3 or 0.7.7 ~ 0.11.0
- Crystal 0.7.1 ~ 0.7.3 or 0.7.7 ~ 0.11.0 or 0.17.4
## License ## License

+ 2
- 2
src/crisp/core.cr View File

@ -149,7 +149,7 @@ module Crisp
end end
end end
def nil?(args)
def nil_value?(args)
args.first.unwrap.nil? args.first.unwrap.nil?
end end
@ -380,7 +380,7 @@ module Crisp
"throw" => -> (args : Array(Crisp::Expr)) { raise Crisp::RuntimeException.new args[0] }, "throw" => -> (args : Array(Crisp::Expr)) { raise Crisp::RuntimeException.new args[0] },
"apply" => func(:apply), "apply" => func(:apply),
"map" => func(:map), "map" => func(:map),
"nil?" => func(:nil?),
"nil?" => func(:nil_value?),
"true?" => func(:true?), "true?" => func(:true?),
"false?" => func(:false?), "false?" => func(:false?),
"symbol?" => func(:symbol?), "symbol?" => func(:symbol?),

+ 1
- 1
src/crisp/env.cr View File

@ -6,7 +6,7 @@ module Crisp
class Env class Env
property data property data
def initialize(@outer = nil)
def initialize(@outer p">: Env? = nil)
@data = {} of String => Crisp::Expr @data = {} of String => Crisp::Expr
end end

+ 1
- 1
src/crisp/error.cr View File

@ -9,7 +9,7 @@ module Crisp
class RuntimeException < Exception class RuntimeException < Exception
getter :thrown getter :thrown
def initialize(@thrown)
def initialize(@thrown : Crisp::Expr)
super() super()
end end
end end

+ 4
- 7
src/crisp/expr.cr View File

@ -5,7 +5,7 @@ module Crisp
class Symbol class Symbol
property :str property :str
def initialize(@str)
def initialize(@str : String)
end end
def ==(other : Symbol) def ==(other : Symbol)
@ -24,7 +24,7 @@ module Crisp
class Atom class Atom
property :val property :val
def initialize(@val)
def initialize(@val : Expr)
end end
def ==(rhs : Atom) def ==(rhs : Atom)
@ -34,7 +34,7 @@ module Crisp
class Closure class Closure
property :ast, :params, :env, :fn property :ast, :params, :env, :fn
def initialize(@ast, @params, @env, @fn)
def initialize(@ast : Expr, @params : List | Vector, @env : Env, @fn : Func)
end end
end end
@ -42,14 +42,11 @@ module Crisp
alias Func = (Array(Expr) -> Expr) alias Func = (Array(Expr) -> Expr)
alias Type = Nil | Bool | Int32 | String | Symbol | List | Vector | HashMap | Func | Closure | Atom alias Type = Nil | Bool | Int32 | String | Symbol | List | Vector | HashMap | Func | Closure | Atom
is_macro :: Bool
meta :: Expr
property :is_macro, :meta property :is_macro, :meta
def initialize(@val : Type) def initialize(@val : Type)
@is_macro = false @is_macro = false
@meta = nil
@meta = nil as Expr?
end end
def initialize(other : Expr) def initialize(other : Expr)

+ 1
- 1
src/crisp/reader.cr View File

@ -5,7 +5,7 @@ module Crisp
extend self extend self
class Reader class Reader
def initialize(@tokens)
def initialize(@tokens : Array(String))
@pos = 0 @pos = 0
end end

Loading…
Cancel
Save