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

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.
 
 patternToRegex ( $pattern, $anchor, $name)
 

Private Attributes

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

Additional Inherited Members

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

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

◆ 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: