[ Index ]

PHP Cross Reference of phpBB-3.3.2-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

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

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

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

disableTag($tagName)   X-Ref
Disable a tag

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

enableTag($tagName)   X-Ref
Enable a tag

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

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

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

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

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

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

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

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

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

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

param: Tag  $tag Tag to append
return: void

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

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
return: void

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

param: Tag  $tag
return: void

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

param: Tag  $tag
return: void

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

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

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

param: Tag  $tag
return: void

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

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

disablePlugin($pluginName)   X-Ref
Disable a plugin

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

enablePlugin($pluginName)   X-Ref
Enable a plugin

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

executePluginParser($pluginName)   X-Ref
Execute given plugin

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

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

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

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

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

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

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

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

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

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

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

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

param: Tag  $tag Tag
return: void

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

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

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

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

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

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

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

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
return: Tag

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

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

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

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

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

param: Tag  $tag Start tag
return: bool

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

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

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

param: Tag  $tag end tag
return: void

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

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

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

param: string $tagName
return: bool

addStartTag($name, $pos, $len, $prio = 0)   X-Ref
Add a start 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
return: Tag

addEndTag($name, $pos, $len, $prio = 0)   X-Ref
Add an end 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
return: Tag

addSelfClosingTag($name, $pos, $len, $prio = 0)   X-Ref
Add a self-closing 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
return: Tag

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

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

addIgnoreTag($pos, $len, $prio = 0)   X-Ref
Add an "ignore" 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
return: Tag

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

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

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

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)
return: Tag           Copy tag

addTag($type, $name, $pos, $len, $prio)   X-Ref
Add a 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
return: Tag

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

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

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

param: Tag  $tag
return: void

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

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)
return: Tag               Start tag

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

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
return: Tag

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.

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



Generated: Wed Nov 11 20:28:18 2020 Cross-referenced by PHPXref 0.7.1