X-Git-Url: https://scripts.mit.edu/gitweb/autoinstallsdev/mediawiki.git/blobdiff_plain/19e297c21b10b1b8a3acad5e73fc71dcb35db44a..6932310fd58ebef145fa01eb76edf7150284d8ea:/vendor/wikimedia/remex-html/RemexHtml/Tokenizer/TokenGeneratorHandler.php diff --git a/vendor/wikimedia/remex-html/RemexHtml/Tokenizer/TokenGeneratorHandler.php b/vendor/wikimedia/remex-html/RemexHtml/Tokenizer/TokenGeneratorHandler.php new file mode 100644 index 00000000..29f94f0d --- /dev/null +++ b/vendor/wikimedia/remex-html/RemexHtml/Tokenizer/TokenGeneratorHandler.php @@ -0,0 +1,75 @@ +tokens[] = [ + 'type' => 'startDocument', + 'fragmentNamespace' => $fragmentNamespace, + 'fragmentName' => $fragmentName + ]; + } + + public function endDocument( $pos ) { + $this->tokens[] = [ 'type' => 'endDocument' ]; + } + + public function error( $text, $pos ) { + $this->tokens[] = [ + 'type' => 'error', + 'text' => $text, + 'sourceStart' => $pos + ]; + } + + public function characters( $text, $start, $length, $sourceStart, $sourceLength ) { + $this->tokens[] = [ + 'type' => 'text', + 'text' => $text, + 'start' => $start, + 'length' => $length, + 'sourceStart' => $sourceStart, + 'sourceLength' => $sourceLength ]; + } + + public function startTag( $name, Attributes $attrs, $selfClose, $sourceStart, $sourceLength ) { + $this->tokens[] = [ + 'type' => 'startTag', + 'name' => $name, + 'attrs' => $attrs, + 'selfClose' => $selfClose, + 'sourceStart' => $sourceStart, + 'sourceLength' => $sourceLength ]; + } + + public function endTag( $name, $sourceStart, $sourceLength ) { + $this->tokens[] = [ + 'type' => 'endTag', + 'name' => $name, + 'sourceStart' => $sourceStart, + 'sourceLength' => $sourceLength ]; + } + + public function doctype( $name, $public, $system, $quirks, $sourceStart, $sourceLength ) { + $this->tokens[] = [ + 'type' => 'doctype', + 'name' => $name, + 'public' => $public, + 'system' => $system, + 'quirks' => $quirks ]; + } + + public function comment( $text, $sourceStart, $sourceLength ) { + $this->tokens[] = [ + 'type' => 'comment', + 'text' => $text, + 'sourceStart' => $sourceStart, + 'sourceLength' => $sourceLength ]; + } +}