Skip to content

Commit

Permalink
Ruby commands can now use blocks (fixed a bug in the grammar)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamjmurray committed Dec 5, 2008
1 parent ecdc0ea commit bac2659
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
6 changes: 3 additions & 3 deletions lib/cosy/model/syntax_tree.rb
Expand Up @@ -532,12 +532,12 @@ def value(context=nil)
# to override them and raise in error for the online version


class CommandNode < TerminalNode
class CommandNode < RubyNode
def atom?
false
end
def evaluate(context=nil)
ruby.value(context)
def value(context=nil)
super
return nil
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/cosy/parser/grammar.treetop
Expand Up @@ -175,7 +175,7 @@ module Cosy


rule command
'{' ruby:ruby '}' <CommandNode>
'{{' script:( string / !('}}'/'"'/"'") . )* '}}' <CommandNode>
end


Expand Down
10 changes: 8 additions & 2 deletions web/ruby_cgi.rb
Expand Up @@ -7,12 +7,18 @@
require 'cosy/renderer/midi_file_renderer.rb'
module Cosy
class RubyNode
def value(context)
def value(context=nil)
raise 'embedded Ruby not allowed online'
end
def evaluate(context=nil)
raise 'embedded Ruby not allowed online'
end
end
class CommandNode
def value(context)
def value(context=nil)
raise 'embedded Ruby not allowed online'
end
def evaluate(context=nil)
raise 'embedded Ruby not allowed online'
end
end
Expand Down

0 comments on commit bac2659

Please sign in to comment.