spacepaste

  1.  
  2. grammar Format {
  3. token TOP {
  4. [
  5. <comment>*
  6. [
  7. <section>
  8. [ <line> | <comment> ]*
  9. ]*
  10. ]*
  11. }
  12. rule section {
  13. '[' <identifier> <subsection>? ']'
  14. }
  15. rule subsection {
  16. '"' <identifier> '"'
  17. }
  18. rule identifier {
  19. <[A..Za..z]> <[A..Za..z0..9_-]>+
  20. }
  21. rule comment {
  22. <[";]> .*? $$
  23. }
  24. rule line {
  25. <key> '=' <value>
  26. }
  27. rule key {
  28. <identifier>
  29. }
  30. rule value {
  31. .*? $$
  32. }
  33. }
  34. Format.parse('lol.conf'.IO.slurp)
  35.