[ Index ]

PHP Cross Reference of phpBB-3.3.14-deutsch

title

Body

[close]

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

(no description)

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

Defines 58 functions

  disableTag()
  enableTag()
  getLogger()
  parse()
  reset()
  setTagLimit()
  setNestingLimit()
  copyTagConfig()
  encodeUnicodeSupplementaryCharacters()
  encodeUnicodeSupplementaryCharactersCallback()
  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()
  hex32()

Functions
Functions that are not part of a class:

disableTag(tagName)   X-Ref
Disable a tag

param: {string} tagName Name of the tag

enableTag(tagName)   X-Ref
Enable a tag

param: {string} tagName Name of the tag

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

return: {!Logger}

parse(_text)   X-Ref
Parse a text

param: {string} _text Text to parse
return: {string}       XML representation

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

param: {string} _text Text to be parsed

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: {number} tagLimit

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: {number} nestingLimit

copyTagConfig(tagName)   X-Ref
Copy a tag's config

This method ensures that the tag's config is its own object and not shared with another
identical tag

param: {string} tagName Tag's name
return: {!Object}         Tag's config

encodeUnicodeSupplementaryCharacters()   X-Ref
Replace Unicode characters outside the BMP with XML entities in the output


encodeUnicodeSupplementaryCharactersCallback(pair)   X-Ref
Encode given surrogate pair into an XML entity

param: {string} pair Surrogate pair
return: {string}      XML entity

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


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

param: {!Tag} tag Tag to append

outputText(catchupPos, maxLines, closeParagraph)   X-Ref
No description

outputBrTag(tag)   X-Ref
Output a linebreak tag

param: {!Tag} tag

outputIgnoreTag(tag)   X-Ref
Output an ignore tag

param: {!Tag} tag

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

param: {number} maxPos Rightmost position at which the paragraph can be opened

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


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

param: {!Tag} tag

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

param: {number} maxPos Rightmost character to be skipped

disablePlugin(pluginName)   X-Ref
Disable a plugin

param: {string} pluginName Name of the plugin

enablePlugin(pluginName)   X-Ref
Enable a plugin

param: {string} pluginName Name of the plugin

executePluginParser(pluginName)   X-Ref
Execute given plugin

param: {string} pluginName Plugin's name

executePluginParsers()   X-Ref
Execute all the plugins


getMatches(regexp, limit)   X-Ref
Get regexp matches in a manner similar to preg_match_all() with PREG_SET_ORDER | PREG_OFFSET_CAPTURE

param: {!RegExp} regexp
param: {number}  limit
return: {!Array.<!Array>}

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

param: {string} pluginName
return: {function(string, !Array)}

registerParser(pluginName, parser, regexp, limit)   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: {!Function} parser
param: {?RegExp=}  regexp
param: {number=}   limit

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

param: {!Tag}    tag Tag
return: {boolean}     Whether a new tag has been added

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

param: {!Tag}    tag Tag
return: {boolean}     Whether a new tag has been added

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

param: {!Tag} tag Tag

fosterParent(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: {boolean}     Whether a new tag has been added

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

param: {!Tag}    tag Tag
return: {boolean}     Whether this tag has an unfulfilled requireAncestor requirement

addFosterTag(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

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

param: {!Tag}    startTag Start tag
param: {number}  tagPos   End tag's position (will be adjusted for whitespace if applicable)
param: {number=} prio     End tag's priority
return: {!Tag}

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

param: {number} tagPos Rightmost possible position for the tag
return: {number}

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

param: {number} tagPos Leftmost possible position for the tag
return: {!Array}        [Tag pos, priority]

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

param: {!Tag} tag Start tag (including self-closing)
return: {boolean}

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


processCurrentTag()   X-Ref
Process current tag


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

param: {!Tag} tag Start tag (including self-closing)

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

param: {!Tag} tag End tag

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


pushContext(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)

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

param: {string}  tagName
return: {boolean}

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

param: {string}  name Name of the tag
param: {number}  pos  Position of the tag in the text
param: {number}  len  Length of text consumed by the tag
param: {number=} prio Tags' priority
return: {!Tag}

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

param: {string}  name Name of the tag
param: {number}  pos  Position of the tag in the text
param: {number}  len  Length of text consumed by the tag
param: {number=} prio Tags' priority
return: {!Tag}

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

param: {string}  name Name of the tag
param: {number}  pos  Position of the tag in the text
param: {number}  len  Length of text consumed by the tag
param: {number=} prio Tags' priority
return: {!Tag}

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

param: {number}  pos  Position of the tag in the text
param: {number=} prio Tags' priority
return: {!Tag}

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

param: {number}  pos  Position of the tag in the text
param: {number}  len  Length of text consumed by the tag
param: {number=} prio Tags' priority
return: {!Tag}

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

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

param: {number}  pos  Position of the tag in the text
param: {number=} prio Tags' priority
return: {!Tag}

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

param: {!Tag}    tag  Original tag
param: {number}  pos  Copy's position
param: {number}  len  Copy's length
param: {number=} prio Tags' priority
return: {!Tag}         Copy tag

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

param: {number}  type Tag's type
param: {string}  name Name of the tag
param: {number}  pos  Position of the tag in the text
param: {number}  len  Length of text consumed by the tag
param: {number=} prio Tags' priority
return: {!Tag}

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

param: {number}  pos Start of text
param: {number}  len Length of text
return: {boolean}

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

param: {!Tag} tag

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

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

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

param: {number} pos  Position of the tag in the text
param: {number} len  Length of text consumed by the tag
param: {number=} prio Tag's priority
return: {!Tag}

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


getSortKey(tag, tagIndex)   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: {number=} tagIndex
return: {string}

hex32(number)   X-Ref
Format given number to a 32 bit hex value

param: {number} number
return: {string}



Generated: Mon Nov 25 19:05:08 2024 Cross-referenced by PHPXref 0.7.1