MediaWiki  1.34.4
Scribunto_LuaUstringLibrary Class Reference
Inheritance diagram for Scribunto_LuaUstringLibrary:
Collaboration diagram for Scribunto_LuaUstringLibrary:

Public Member Functions

 __construct ( $engine)
 
 register ()
 Called to register the library. More...
 
 ustringByteoffset ( $s, $l=1, $i=1)
 Handler for byteoffset. More...
 
 ustringChar ()
 Handler for char. More...
 
 ustringCodepoint ( $s, $i=1, $j=null)
 Handler for codepoint. More...
 
 ustringFind ( $s, $pattern, $init=1, $plain=false)
 Handler for find. More...
 
 ustringGcodepointInit ( $s, $i=1, $j=null)
 Handler for gcodepointInit. More...
 
 ustringGmatchCallback ( $s, $re, $capt, $pos)
 Handler for gmatchCallback. More...
 
 ustringGmatchInit ( $s, $pattern)
 Handler for gmatchInit. More...
 
 ustringGsub ( $s, $pattern, $repl, $n=null)
 Handler for gsub. More...
 
 ustringIsUtf8 ( $s)
 Handler for isUtf8. More...
 
 ustringLen ( $s)
 Handler for len. More...
 
 ustringLower ( $s)
 Handler for lower. More...
 
 ustringMatch ( $s, $pattern, $init=1)
 Handler for match. More...
 
 ustringSub ( $s, $i=1, $j=-1)
 Handler for sub. More...
 
 ustringToNFC ( $s)
 Handler for toNFC. More...
 
 ustringToNFD ( $s)
 Handler for toNFD. More...
 
 ustringToNFKC ( $s)
 Handler for toNFKC. More...
 
 ustringToNFKD ( $s)
 Handler for toNFKD. More...
 
 ustringUpper ( $s)
 Handler for upper. More...
 
- Public Member Functions inherited from Scribunto_LuaLibraryBase
 __construct (Scribunto_LuaEngine $engine)
 
 incrementExpensiveFunctionCount ()
 Increment the expensive function count, and throw if limit exceeded. More...
 

Private Member Functions

 addCapturesFromMatch ( $arr, $s, $m, $capt, $m0_if_no_captures)
 
 bracketedCharSetToRegex ( $pat, $i, $len, $brcharsets)
 
 checkPattern ( $name, $pattern)
 
 checkString ( $name, $s, $checkEncoding=true)
 
 handlePCREError ( $error, $pattern)
 Handle a PCRE error. More...
 
 patternToRegex ( $pattern, $anchor, $name)
 

Private Attributes

integer $patternLengthLimit = 10000
 Limit on pattern lengths, in bytes not characters. More...
 
MapCacheLRU $patternRegexCache = null
 A cache of patterns and the regexes they generate. More...
 
boolean $phpBug53823 = false
 PHP until 5.6.9 are buggy when the regex in preg_replace an preg_match_all matches the empty string. More...
 
integer null $stringLengthLimit = null
 Limit on string lengths, in bytes not characters If null, $wgMaxArticleSize * 1024 will be used. More...
 

Additional Inherited Members

- Protected Member Functions inherited from Scribunto_LuaLibraryBase
 checkType ( $name, $argIdx, $arg, $expectType)
 Check the type of a variable. More...
 
 checkTypeOptional ( $name, $argIdx, &$arg, $expectType, $default)
 Check the type of a variable, with default if null. More...
 
 getEngine ()
 Get the engine. More...
 
 getInterpreter ()
 Get the interpreter. More...
 
 getLuaType ( $var)
 Get the Lua type corresponding to the type of the variable. More...
 
 getParser ()
 Get the parser. More...
 
 getParserOptions ()
 Get the parser options. More...
 
 getTitle ()
 Get the title. More...
 

Detailed Description

Definition at line 5 of file UstringLibrary.php.

Constructor & Destructor Documentation

◆ __construct()

Scribunto_LuaUstringLibrary::__construct (   $engine)

Definition at line 32 of file UstringLibrary.php.

References Scribunto_LuaLibraryBase\$engine, and $wgMaxArticleSize.

Member Function Documentation

◆ addCapturesFromMatch()

Scribunto_LuaUstringLibrary::addCapturesFromMatch (   $arr,
  $s,
  $m,
  $capt,
  $m0_if_no_captures 
)
private

Definition at line 591 of file UstringLibrary.php.

References $s.

Referenced by ustringFind(), ustringGmatchCallback(), ustringGsub(), and ustringMatch().

◆ bracketedCharSetToRegex()

Scribunto_LuaUstringLibrary::bracketedCharSetToRegex (   $pat,
  $i,
  $len,
  $brcharsets 
)
private

Definition at line 541 of file UstringLibrary.php.

Referenced by patternToRegex().

◆ checkPattern()

Scribunto_LuaUstringLibrary::checkPattern (   $name,
  $pattern 
)
private

◆ checkString()

◆ handlePCREError()

Scribunto_LuaUstringLibrary::handlePCREError (   $error,
  $pattern 
)
private

Handle a PCRE error.

Parameters
int$errorFrom preg_last_error()
string$patternPattern being matched
Exceptions
Scribunto_LuaError

Definition at line 882 of file UstringLibrary.php.

Referenced by ustringGsub().

◆ patternToRegex()

Scribunto_LuaUstringLibrary::patternToRegex (   $pattern,
  $anchor,
  $name 
)
private

◆ register()

Scribunto_LuaUstringLibrary::register ( )

Called to register the library.

This should do any necessary setup and then call $this->getEngine()->registerInterface(). The value returned by that call should be returned from this function, and must be for 'deferLoad' libraries to work right.

Returns
array Lua package

Reimplemented from Scribunto_LuaLibraryBase.

Definition at line 44 of file UstringLibrary.php.

References Scribunto_LuaLibraryBase\getEngine().

◆ ustringByteoffset()

Scribunto_LuaUstringLibrary::ustringByteoffset (   $s,
  $l = 1,
  $i = 1 
)

Handler for byteoffset.

Definition at line 120 of file UstringLibrary.php.

References $s, checkString(), and Scribunto_LuaLibraryBase\checkTypeOptional().

◆ ustringChar()

Scribunto_LuaUstringLibrary::ustringChar ( )

Handler for char.

Definition at line 250 of file UstringLibrary.php.

References $args, $s, and Scribunto_LuaLibraryBase\checkType().

◆ ustringCodepoint()

Scribunto_LuaUstringLibrary::ustringCodepoint (   $s,
  $i = 1,
  $j = null 
)

Handler for codepoint.

Definition at line 156 of file UstringLibrary.php.

References $s, checkString(), and Scribunto_LuaLibraryBase\checkTypeOptional().

Referenced by ustringGcodepointInit().

◆ ustringFind()

Scribunto_LuaUstringLibrary::ustringFind (   $s,
  $pattern,
  $init = 1,
  $plain = false 
)

◆ ustringGcodepointInit()

Scribunto_LuaUstringLibrary::ustringGcodepointInit (   $s,
  $i = 1,
  $j = null 
)

Handler for gcodepointInit.

Definition at line 185 of file UstringLibrary.php.

References $s, and ustringCodepoint().

◆ ustringGmatchCallback()

Scribunto_LuaUstringLibrary::ustringGmatchCallback (   $s,
  $re,
  $capt,
  $pos 
)

Handler for gmatchCallback.

Definition at line 712 of file UstringLibrary.php.

References $s, and addCapturesFromMatch().

◆ ustringGmatchInit()

Scribunto_LuaUstringLibrary::ustringGmatchInit (   $s,
  $pattern 
)

Handler for gmatchInit.

Definition at line 696 of file UstringLibrary.php.

References $s, checkString(), and patternToRegex().

◆ ustringGsub()

Scribunto_LuaUstringLibrary::ustringGsub (   $s,
  $pattern,
  $repl,
  $n = null 
)

◆ ustringIsUtf8()

Scribunto_LuaUstringLibrary::ustringIsUtf8 (   $s)

Handler for isUtf8.

Definition at line 107 of file UstringLibrary.php.

References $s, and checkString().

◆ ustringLen()

Scribunto_LuaUstringLibrary::ustringLen (   $s)

Handler for len.

Definition at line 279 of file UstringLibrary.php.

References $s, and checkString().

◆ ustringLower()

Scribunto_LuaUstringLibrary::ustringLower (   $s)

Handler for lower.

Definition at line 333 of file UstringLibrary.php.

References $s, and checkString().

◆ ustringMatch()

Scribunto_LuaUstringLibrary::ustringMatch (   $s,
  $pattern,
  $init = 1 
)

◆ ustringSub()

Scribunto_LuaUstringLibrary::ustringSub (   $s,
  $i = 1,
  $j = -1 
)

Handler for sub.

Definition at line 295 of file UstringLibrary.php.

References $s, checkString(), and Scribunto_LuaLibraryBase\checkTypeOptional().

◆ ustringToNFC()

Scribunto_LuaUstringLibrary::ustringToNFC (   $s)

Handler for toNFC.

Definition at line 195 of file UstringLibrary.php.

References $s, and checkString().

◆ ustringToNFD()

Scribunto_LuaUstringLibrary::ustringToNFD (   $s)

Handler for toNFD.

Definition at line 209 of file UstringLibrary.php.

References $s, and checkString().

◆ ustringToNFKC()

Scribunto_LuaUstringLibrary::ustringToNFKC (   $s)

Handler for toNFKC.

Definition at line 223 of file UstringLibrary.php.

References $s, and checkString().

◆ ustringToNFKD()

Scribunto_LuaUstringLibrary::ustringToNFKD (   $s)

Handler for toNFKD.

Definition at line 237 of file UstringLibrary.php.

References $s, and checkString().

◆ ustringUpper()

Scribunto_LuaUstringLibrary::ustringUpper (   $s)

Handler for upper.

Definition at line 322 of file UstringLibrary.php.

References $s, and checkString().

Member Data Documentation

◆ $patternLengthLimit

integer Scribunto_LuaUstringLibrary::$patternLengthLimit = 10000
private

Limit on pattern lengths, in bytes not characters.

Definition at line 10 of file UstringLibrary.php.

◆ $patternRegexCache

MapCacheLRU Scribunto_LuaUstringLibrary::$patternRegexCache = null
private

A cache of patterns and the regexes they generate.

Definition at line 30 of file UstringLibrary.php.

◆ $phpBug53823

boolean Scribunto_LuaUstringLibrary::$phpBug53823 = false
private

PHP until 5.6.9 are buggy when the regex in preg_replace an preg_match_all matches the empty string.

Definition at line 24 of file UstringLibrary.php.

◆ $stringLengthLimit

integer null Scribunto_LuaUstringLibrary::$stringLengthLimit = null
private

Limit on string lengths, in bytes not characters If null, $wgMaxArticleSize * 1024 will be used.

Definition at line 17 of file UstringLibrary.php.


The documentation for this class was generated from the following file: