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|
- e.execute(&block)
- end.join
- end
- }
- end
- rule interpolation
- '$(' command ')' {
- def execute(&block)
- yield command.execute(&block)
- end
- def node_type
- :interpolation
- end
- }
- end
- rule simple
- (!'$(' !')' .)+ {
- def execute(&block)
- text_value
- end
- def node_type
- :simple
- end
- }
- end
- end
Add Comment
Please, Sign In to add comment