Permalink
Browse files

small fix

  • Loading branch information...
1 parent 59474df commit 52589f5df47ead7292bfa4206f4a21c63c089758 @txus committed May 12, 2012
Showing with 9 additions and 1 deletion.
  1. +1 −0 examples/hello_world.clj
  2. +1 −1 lib/lambra/library/code_loader.rb
  3. +7 −0 lib/lambra/parser.rb
View
1 examples/hello_world.clj
@@ -0,0 +1 @@
+(println "hello, world!")
View
2 lib/lambra/library/code_loader.rb
@@ -40,7 +40,7 @@ def self.execute(ast)
def self.execute_file(name)
ast = Lambra::Parser.parse IO.read(name)
- def ast.filename; name; end
+ ast.define_singleton_method(:filename) { name }
execute(ast)
end
end
View
7 lib/lambra/parser.rb
@@ -18,4 +18,11 @@ def self.parse(string)
parser.result
end
+
+ def self.parse_file(name)
+ parser = new IO.read(name)
+ unless parser.parse
+ parser.raise_error
+ end
+ end
end

0 comments on commit 52589f5

Please sign in to comment.