Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- grammar Shell
- rule command
- (interpolation / simple)+ {
- def execute(&block)
- yield elements.map do |e|
- if e.respond_to? :simple
- puts e.text_value
- e.text_value
- else
- e.execute(&block)
- end
- end.join
- end
- }
- end
- rule interpolation
- '$(' command ')' {
- def execute(&block)
- yield command.execute(&block)
- end
- }
- end
- rule simple
- (!'$(' !')' .)+ {
- def execute(&block)
- yield text_value
- end
- }
- end
- end
Add Comment
Please, Sign In to add comment