Guest User

Untitled

a guest
Apr 26th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. grammar Shell
  2. rule command
  3. (interpolation / simple)+ {
  4. def execute(&block)
  5. yield elements.map do |e|
  6. e.execute(&block)
  7. end.join
  8. end
  9. }
  10. end
  11.  
  12. rule interpolation
  13. '$(' command ')' {
  14. def execute(&block)
  15. yield command.execute(&block)
  16. end
  17.  
  18. def node_type
  19. :interpolation
  20. end
  21. }
  22. end
  23.  
  24. rule simple
  25. (!'$(' !')' .)+ {
  26. def execute(&block)
  27. text_value
  28. end
  29.  
  30. def node_type
  31. :simple
  32. end
  33. }
  34. end
  35. end
Add Comment
Please, Sign In to add comment