CodePage -> (CodeBlock | DocBlock)* // lookahead 2 needed here DocBlock -> (DirectiveBlock | MarkdownBlock)+ 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* OrgString -> ( )* ? Tokens ------ DOC_START -> "%% " EOL -> "\n" NOT_EOL -> ~"\n" DIRECTIVE_START -> "@" NOT_DIRECTIVE_START -> ~"@" SLASH -> "/" ORG_ID -> ~"[/\n]"