protected function createHttpLink() { $title_char = PEG::subtract($this->lineChar, ']'); $title = PEG::choice(PEG::second(':title=', PEG::join(PEG::many1($title_char))), PEG::second(':title', '')); $url_char = PEG::subtract($this->lineChar, ']', ':title'); $url = PEG::join(PEG::seq(PEG::choice('http://', 'https://'), PEG::many1($url_char))); $parser = PEG::seq($url, PEG::optional($title)); return $this->nodeCreater('httplink', $parser, array('href', 'title')); }
function __construct(PEG_IParser $lineelt) { $cellbody = PEG::many(PEG::subtract($lineelt, '|')); $this->parser = PEG::many1(PEG::callbackAction(array($this, 'map'), PEG::anything())); $this->line = PEG::second('|', PEG::many1(PEG::optional('*'), $cellbody, PEG::drop('|')), PEG::eos()); }
public function __construct(PEG_IParser $element) { $open = PEG::second('<', PEG::choice('del', 'strong', 'ins', 'em'), '>'); $close = PEG::second('</', PEG::choice('del', 'strong', 'ins', 'em'), '>'); $this->parser = PEG::seq($open, PEG::many(PEG::subtract($element, $close)), $close); }