CodePage -> CodeBlock | DocBlock | CodePage // lookahead 2 needed here DocBlock -> DirectiveBlock | MarkdownBlock | DocBlock DirectiveBlock -> "author" RemainingLine EOL MarkdownBlock? | "doc" RemainingLine EOL MarkdownBlock? | "example" RemainingLine EOL MarkdownBlock? | "org" OrgString EOL MarkdownBlock -> MarkdownLine+ MarkdownLine -> NOT_DIRECTIVE_START RemainingLine RemainingLine -> NOT_EOL* Tokens ------ DOC_START -> "%%" EOL -> "\n" NOT_EOL -> ~"\n" DIRECTIVE_START -> "@" NOT_DIRECTIVE_START -> ~"@"