@top Document { heading line* } heading { Heading? "\n" } line { Indent* ((AutoLink | Code | word) space*)* "\n" } @tokens { space { $[ \t] } word { ![ \t\n]+ } Heading { ![\n]+ } Indent { space } AutoLink { ("http" | "https") "://" word } Code { "`" ![`\n]+ "`" | ($[$%] " ") ![\n]+ } @precedence { AutoLink, Code, word } }