require 'slaw/grammars/terminals' require 'slaw/grammars/inlines_nodes'
module Slaw
module Grammars grammar Inlines ########## # inline content rule inline_statement space? '\\'? inline_items eol <NakedStatement> end # one or more words, allowing inline elements rule inline_items inline_item+ <InlineItems> end rule inline_item remark / image / ref / bold / italics / superscript / subscript / underline / '\\'? [^\n] <InlineItem> end rule remark '[[' content:(!']]' inline_item)+ ']]' <Remark> end rule image # images like markdown # eg.  # # the title text is optional, but the enclosing square brackets aren't '* '](' href:([^)\n]+) ')' <Image> end rule bold # **foo** '**' content:(!'**' inline_item)+ '**' <Bold> end rule italics # //foo// '//' content:(!'//' inline_item)+ '//' <Italics> end rule ref # links like markdown # eg. [link text](link url) '[' content:(!'](' inline_item)+ '](' href:([^)\n]+) ')' <Ref> end rule superscript # ^^foo^^ '^^' content:(!'^^' inline_item)+ '^^' <Superscript> end rule subscript # _^foo^_ '_^' content:(!'^_' inline_item)+ '^_' <Subscript> end rule underline # __foo__ '__' content:(!'__' inline_item)+ '__' <Underline> end end end
end