(banterpixra-command-line
 . (seq
    "banterpixra" " "
    (optional (comment "Debug mode:\nAdds pink boxes\nshowing the layout" "-d"))
    (choice
     (seq "ruleset" " " "<" " " ruleset-filename)
     (seq "rule" " " "<" " " rule-filename))
    " " ">" " " output-svg-filename))

(ruleset
 . (one-or-more
    (seq "(" rule-label " " "." " " rule ")")))

(rule
 . (choice
    rule-label
    literal
    (seq "(elidable" " " literal ")")
    (seq "(optional" " " rule ")")
    (seq "(zero-or-more" " " rule ")")
    (seq "(one-or-more" " " rule ")")
    (seq "(seq" (one-or-more (seq " " rule)) ")")
    (seq "(choice" (one-or-more (seq " " rule)) ")")
    (seq "(optional-choice" (one-or-more (seq " " rule)) ")")
    (seq "(comment" " " literal " " rule ")")))

(rule-label
 . (choice
    (seq "|" (one-or-more "[^|]") "|")
    (seq label-start-character (zero-or-more label-subsequent-character))
    "+|-|..."))

(literal
 . (seq "\""
	 (zero-or-more
	  (choice
	   "[^\"]"
	   (seq
	    "\\" "[\"\\n]")))
	 "\""))

(label-start-character . "[a-zA-Z!$%&*/:<=>^?_]")

(label-subsequent-character . (choice label-start-character "[0-9+-.@]"))
