[ Index ]

PHP Cross Reference of phpBB-3.3.3-deutsch

title

Body

[close]

/vendor/s9e/text-formatter/src/ -> Parser.php (summary)

(no description)

File Size: 2067 lines (52 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

Parser:: (59 methods):
  __construct()
  __sleep()
  __wakeup()
  reset()
  setTagOption()
  disableTag()
  enableTag()
  getLogger()
  getText()
  parse()
  setTagLimit()
  setNestingLimit()
  finalizeOutput()
  outputTag()
  outputText()
  outputBrTag()
  outputIgnoreTag()
  outputParagraphStart()
  outputParagraphEnd()
  outputVerbatim()
  outputWhitespace()
  disablePlugin()
  enablePlugin()
  executePluginParser()
  executePluginParsers()
  getMatches()
  getPluginParser()
  registerParser()
  closeAncestor()
  closeParent()
  createChild()
  fosterParent()
  requireAncestor()
  addFosterTag()
  addMagicEndTag()
  getMagicEndPos()
  getMagicStartCoords()
  isFollowedByClosingTag()
  processTags()
  processCurrentTag()
  processStartTag()
  processEndTag()
  popContext()
  pushContext()
  tagIsAllowed()
  addStartTag()
  addEndTag()
  addSelfClosingTag()
  addBrTag()
  addIgnoreTag()
  addParagraphBreak()
  addCopyTag()
  addTag()
  isInvalidTextSpan()
  insertTag()
  addTagPair()
  addVerbatim()
  sortTags()
  getSortKey()


Class: Parser  - X-Ref


__construct(array $config)   X-Ref
Constructor


__sleep()   X-Ref
Serializer

Returns the properties that need to persist through serialization.

NOTE: using __sleep() is preferable to implementing Serializable because it leaves the choice
of the serializer to the user (e.g. igbinary)

return: array

__wakeup()   X-Ref
Unserializer

return: void

reset($text)   X-Ref
Reset the parser for a new parsing

return: void
param: string $text Text to be parsed

setTagOption($tagName, $optionName, $optionValue)   X-Ref
Set a tag's option

This method ensures that the tag's config is a value and not a reference, to prevent
potential side-effects. References contained *inside* the tag's config are left untouched

return: void
param: string $tagName     Tag's name
param: string $optionName  Option's name
param: mixed  $optionValue Option's value

disableTag($tagName)   X-Ref
Disable a tag

return: void
param: string $tagName Name of the tag

enableTag($tagName)   X-Ref
Enable a tag

return: void
param: string $tagName Name of the tag

getLogger()   X-Ref
Get this parser's Logger instance

return: Logger

getText()   X-Ref
Return the last text parsed

This method returns the normalized text, which may be slightly different from the original
text in that EOLs are normalized to LF and other control codes are stripped. This method is
meant to be used in support of processing log entries, which contain offsets based on the
normalized text

return: string

parse($text)   X-Ref
Parse a text

return: string       XML representation
param: string $text Text to parse

setTagLimit($tagName, $tagLimit)   X-Ref
Change a tag's tagLimit

NOTE: the default tagLimit should generally be set during configuration instead

return: void
param: string  $tagName  The tag's name, in UPPERCASE
param: integer $tagLimit

setNestingLimit($tagName, $nestingLimit)   X-Ref
Change a tag's nestingLimit

NOTE: the default nestingLimit should generally be set during configuration instead

return: void
param: string  $tagName      The tag's name, in UPPERCASE
param: integer $nestingLimit

finalizeOutput()   X-Ref
Finalize the output by appending the rest of the unprocessed text and create the root node

return: void

outputTag(Tag $tag)   X-Ref
Append a tag to the output

return: void
param: Tag  $tag Tag to append

outputText($catchupPos, $maxLines, $closeParagraph)   X-Ref
Output the text between the cursor's position (included) and given position (not included)

return: void
param: integer $catchupPos     Position we're catching up to
param: integer $maxLines       Maximum number of lines to ignore at the end of the text
param: bool    $closeParagraph Whether to close the paragraph at the end, if applicable

outputBrTag(Tag $tag)   X-Ref
Output a linebreak tag

return: void
param: Tag  $tag

outputIgnoreTag(Tag $tag)   X-Ref
Output an ignore tag

return: void
param: Tag  $tag

outputParagraphStart($maxPos)   X-Ref
Start a paragraph between current position and given position, if applicable

return: void
param: integer $maxPos Rightmost position at which the paragraph can be opened

outputParagraphEnd()   X-Ref
Close current paragraph at current position if applicable

return: void

outputVerbatim(Tag $tag)   X-Ref
Output the content of a verbatim tag

return: void
param: Tag  $tag

outputWhitespace($maxPos)   X-Ref
Skip as much whitespace after current position as possible

return: void
param: integer $maxPos Rightmost character to be skipped

disablePlugin($pluginName)   X-Ref
Disable a plugin

return: void
param: string $pluginName Name of the plugin

enablePlugin($pluginName)   X-Ref
Enable a plugin

return: void
param: string $pluginName Name of the plugin

executePluginParser($pluginName)   X-Ref
Execute given plugin

return: void
param: string $pluginName Plugin's name

executePluginParsers()   X-Ref
Execute all the plugins

return: void

getMatches($regexp, $limit)   X-Ref
Execute given regexp and returns as many matches as given limit

return: array
param: string  $regexp
param: integer $limit

getPluginParser($pluginName)   X-Ref
Get the cached callback for given plugin's parser

return: callable
param: string $pluginName Plugin's name

registerParser($pluginName, $parser, $regexp = null, $limit = PHP_INT_MAX)   X-Ref
Register a parser

Can be used to add a new parser with no plugin config, or pre-generate a parser for an
existing plugin

return: void
param: string   $pluginName
param: callback $parser
param: string   $regexp
param: integer  $limit

closeAncestor(Tag $tag)   X-Ref
Apply closeAncestor rules associated with given tag

return: bool      Whether a new tag has been added
param: Tag  $tag Tag

closeParent(Tag $tag)   X-Ref
Apply closeParent rules associated with given tag

return: bool      Whether a new tag has been added
param: Tag  $tag Tag

createChild(Tag $tag)   X-Ref
Apply the createChild rules associated with given tag

return: void
param: Tag  $tag Tag

fosterParent(Tag $tag)   X-Ref
Apply fosterParent rules associated with given tag

NOTE: this rule has the potential for creating an unbounded loop, either if a tag tries to
foster itself or two or more tags try to foster each other in a loop. We mitigate the
risk by preventing a tag from creating a child of itself (the parent still gets closed)
and by checking and increasing the currentFixingCost so that a loop of multiple tags
do not run indefinitely. The default tagLimit and nestingLimit also serve to prevent the
loop from running indefinitely

return: bool      Whether a new tag has been added
param: Tag  $tag Tag

requireAncestor(Tag $tag)   X-Ref
Apply requireAncestor rules associated with given tag

return: bool      Whether this tag has an unfulfilled requireAncestor requirement
param: Tag  $tag Tag

addFosterTag(Tag $tag, Tag $fosterTag)   X-Ref
Create and add a copy of a tag as a child of a given tag

return: void
param: Tag  $tag       Current tag
param: Tag  $fosterTag Tag to foster

addMagicEndTag(Tag $startTag, $tagPos, $prio = 0)   X-Ref
Create and add an end tag for given start tag at given position

return: Tag
param: Tag     $startTag Start tag
param: integer $tagPos   End tag's position (will be adjusted for whitespace if applicable)
param: integer $prio     End tag's priority

getMagicEndPos($tagPos)   X-Ref
Compute the position of a magic end tag, adjusted for whitespace

return: integer
param: integer $tagPos Rightmost possible position for the tag

getMagicStartCoords($tagPos)   X-Ref
Compute the position and priority of a magic start tag, adjusted for whitespace

return: integer[]         [Tag pos, priority]
param: integer   $tagPos Leftmost possible position for the tag

isFollowedByClosingTag(Tag $tag)   X-Ref
Test whether given start tag is immediately followed by a closing tag

return: bool
param: Tag  $tag Start tag

processTags()   X-Ref
Process all tags in the stack

return: void

processCurrentTag()   X-Ref
Process current tag

return: void

processStartTag(Tag $tag)   X-Ref
Process given start tag (including self-closing tags) at current position

return: void
param: Tag  $tag Start tag (including self-closing)

processEndTag(Tag $tag)   X-Ref
Process given end tag at current position

return: void
param: Tag  $tag end tag

popContext()   X-Ref
Update counters and replace current context with its parent context

return: void

pushContext(Tag $tag)   X-Ref
Update counters and replace current context with a new context based on given tag

If given tag is a self-closing tag, the context won't change

return: void
param: Tag  $tag Start tag (including self-closing)

tagIsAllowed($tagName)   X-Ref
Return whether given tag is allowed in current context

return: bool
param: string $tagName

addStartTag($name, $pos, $len, $prio = 0)   X-Ref
Add a start tag

return: Tag
param: string  $name Name of the tag
param: integer $pos  Position of the tag in the text
param: integer $len  Length of text consumed by the tag
param: integer $prio Tag's priority

addEndTag($name, $pos, $len, $prio = 0)   X-Ref
Add an end tag

return: Tag
param: string  $name Name of the tag
param: integer $pos  Position of the tag in the text
param: integer $len  Length of text consumed by the tag
param: integer $prio Tag's priority

addSelfClosingTag($name, $pos, $len, $prio = 0)   X-Ref
Add a self-closing tag

return: Tag
param: string  $name Name of the tag
param: integer $pos  Position of the tag in the text
param: integer $len  Length of text consumed by the tag
param: integer $prio Tag's priority

addBrTag($pos, $prio = 0)   X-Ref
Add a 0-width "br" tag to force a line break at given position

return: Tag
param: integer $pos  Position of the tag in the text
param: integer $prio Tag's priority

addIgnoreTag($pos, $len, $prio = 0)   X-Ref
Add an "ignore" tag

return: Tag
param: integer $pos  Position of the tag in the text
param: integer $len  Length of text consumed by the tag
param: integer $prio Tag's priority

addParagraphBreak($pos, $prio = 0)   X-Ref
Add a paragraph break at given position

Uses a zero-width tag that is actually never output in the result

return: Tag
param: integer $pos  Position of the tag in the text
param: integer $prio Tag's priority

addCopyTag(Tag $tag, $pos, $len, $prio = null)   X-Ref
Add a copy of given tag at given position and length

return: Tag           Copy tag
param: Tag     $tag  Original tag
param: integer $pos  Copy's position
param: integer $len  Copy's length
param: integer $prio Copy's priority (same as original by default)

addTag($type, $name, $pos, $len, $prio)   X-Ref
Add a tag

return: Tag
param: integer $type Tag's type
param: string  $name Name of the tag
param: integer $pos  Position of the tag in the text
param: integer $len  Length of text consumed by the tag
param: integer $prio Tag's priority

isInvalidTextSpan($pos, $len)   X-Ref
Test whether given text span is outside text boundaries or an invalid UTF sequence

return: bool
param: integer $pos Start of text
param: integer $len Length of text

insertTag(Tag $tag)   X-Ref
Insert given tag in the tag stack

return: void
param: Tag  $tag

addTagPair($name, $startPos, $startLen, $endPos, $endLen, $prio = 0)   X-Ref
Add a pair of tags

return: Tag               Start tag
param: string  $name     Name of the tags
param: integer $startPos Position of the start tag
param: integer $startLen Length of the start tag
param: integer $endPos   Position of the start tag
param: integer $endLen   Length of the start tag
param: integer $prio     Start tag's priority (the end tag will be set to minus that value)

addVerbatim($pos, $len, $prio = 0)   X-Ref
Add a tag that represents a verbatim copy of the original text

return: Tag
param: integer $pos  Position of the tag in the text
param: integer $len  Length of text consumed by the tag
param: integer $prio Tag's priority

sortTags()   X-Ref
Sort tags by position and precedence

return: void

getSortKey(Tag $tag, int $tagIndex = 0)   X-Ref
Generate a key for given tag that can be used to compare its position using lexical comparisons

Tags are sorted by position first, then by priority, then by whether they consume any text,
then by length, and finally in order of their creation.

The stack's array is in reverse order. Therefore, tags that appear at the start of the text
are at the end of the array.

return: string
param: Tag     $tag
param: integer $tagIndex



Generated: Sun Feb 14 20:08:31 2021 Cross-referenced by PHPXref 0.7.1