Skip to content

Instantly share code, notes, and snippets.

@htor

htor/schelp.ohm

Last active Oct 2, 2019
Embed
What would you like to do?
grammar for supercollider help files written in ohm-grammar
SCHelp {
Document = (Element|Text)+
Element
= Class
| Title
| Summary
| Related
| Redirect
| Categories
| ClassTree
| Section
| SubSection
| Examples
| Description
| ClassMethods
| InstanceMethods
| Method
| Private
| Returns
| Argument
| Keyword
| Discussion
| Note
| Warning
| Footnote
| UnorderedList
| OrderedList
| DefinitionList
| Tree
| Table
| Link
| Anchor
| Emphasis
| Strong
| Soft
| Image
| codeInline
| code
| teletypeInline
| teletype
Paragraph
= Warning
| Note
| UnorderedList
| Tree
| OrderedList
| Table
| DefinitionList
| ClassTree
| Keyword
| Image
| Link
| Strong
| Soft
| Emphasis
| Footnote
| Text
| codeInline
| code
Class = caseInsensitive<"class::"> line
Title = caseInsensitive<"title::"> line
Summary = caseInsensitive<"summary::"> line
Related = caseInsensitive<"related::"> line
Redirect = caseInsensitive<"redirect::"> line
Categories = caseInsensitive<"categories::"> line
ClassTree = caseInsensitive<"classtree::"> line
Note = caseInsensitive<"note::"> (Element|Text)+ "::"
Warning = caseInsensitive<"warning::"> (Element|Text)+ "::"
Footnote = caseInsensitive<"footnote::"> (Element|Text)+ "::"
Section = caseInsensitive<"section::"> line
SubSection = caseInsensitive<"subsection::"> line
Examples = caseInsensitive<"examples::">
Description = caseInsensitive<"description::">
ClassMethods = caseInsensitive<"classmethods::">
InstanceMethods = caseInsensitive<"instancemethods::">
Method = caseInsensitive<"method::"> line Paragraph* Argument* Returns* Discussion*
Argument = caseInsensitive<"argument::"> line Paragraph*
Returns = caseInsensitive<"returns::"> Paragraph+
Discussion = caseInsensitive<"discussion::"> Paragraph+
Private = caseInsensitive<"private::"> line
Keyword = caseInsensitive<"keyword::"> line
UnorderedList = caseInsensitive<"list::"> ListItem+ "::"
OrderedList = caseInsensitive<"numberedlist::"> ListItem+ "::"
DefinitionList = caseInsensitive<"definitionlist::"> DefinitionItem+ "::"
ListItem = "##" (Element|Text)+
DefinitionItem = "##" (Element|Text)+ "||"? ((Element|Text)+)?
Tree = caseInsensitive<"tree::"> TreeItem+ "::"
TreeItem = "##" (Element|Text)+
Table = caseInsensitive<"table::"> TableRow+ "::"
TableRow = "##" TableCell*
TableCell = (Element|Text)+ "||"? | (Element|Text)* "||"
Link = caseInsensitive<"link::"> (~"::" any)+ "::"
Anchor = caseInsensitive<"anchor::"> (~"::" any)+ "::"
Emphasis = caseInsensitive<"emphasis::"> (~"::" any)+ "::"
Strong = caseInsensitive<"strong::"> (~"::" any)+ "::"
Soft = caseInsensitive<"soft::"> (~"::" any)+ "::"
Image = caseInsensitive<"image::"> (~"::" any)+ "::"
Text = delimEsc | (~Element (~delim (~delimEsc #any)))+
code = caseInsensitive<"code::"> (~(eol "::") any)+ &(eol "::") eol "::"
codeInline = caseInsensitive<"code::"> (~eol (delimEsc | (~"::" any)))+ "::"
teletype = caseInsensitive<"teletype::"> (~(eol "::") any)+ &(eol "::") eol "::"
teletypeInline = caseInsensitive<"teletype::"> (~eol (delimEsc | (~"::" any)))+ "::"
delim = "::" | "||" | "##"
delimEsc = "\\" delim
line = (~eol any)+ eol?
eol = white* "\r"? "\n" white*
white = (" " | "\t")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.