|
@@ -21,6 +21,8 @@
|
|
|
*/
|
|
|
|
|
|
package lua.lib.lrexlib;
|
|
|
+import haxe.extern.EitherType;
|
|
|
+
|
|
|
@:luaRequire("rex_pcre")
|
|
|
extern class Rex {
|
|
|
|
|
@@ -35,13 +37,13 @@ extern class Rex {
|
|
|
|
|
|
@return matched string, or array of strings.
|
|
|
**/
|
|
|
- public static function match(patt : String, ?init : Int, ?ef : Int) : Dynamic;
|
|
|
+ public static function match(patt : EitherType<Rex,String>, subj : String, ?init : Int, ?ef : Int) : Dynamic;
|
|
|
|
|
|
/**
|
|
|
The function searches for the first match of the regexp patt in the string
|
|
|
`subj`, starting from offset `init`, subject to flags `cf` and `ef`.
|
|
|
**/
|
|
|
- public static function find(subj : String, ?init : Int, ?ef : Int) : Dynamic;
|
|
|
+ public static function find(patt : EitherType<Rex,String>, subj : String, ?init : Int, ?ef : Int) : Dynamic;
|
|
|
|
|
|
|
|
|
/**
|
|
@@ -50,14 +52,13 @@ extern class Rex {
|
|
|
parameter is a regular expression pattern representing separators between
|
|
|
the sections.
|
|
|
**/
|
|
|
- @:overload( function (subj : String, sep : Rex, ?cf : Int, ?ef : Int) : Void->String{})
|
|
|
- public static function split(subj : String, sep : String, ?cf : Int, ?ef : Int) : Void->String;
|
|
|
+ public static function split( subj : String, sep : EitherType<Rex,String>, ?cf : Int, ?ef : Int) : Void->String;
|
|
|
|
|
|
|
|
|
/**
|
|
|
This function counts matches of the pattern `patt` in the string `subj`.
|
|
|
**/
|
|
|
- public static function count(subj : String, patt : String, cf : Int, ef : Int) : Dynamic;
|
|
|
+ public static function count(subj : String, patt : EitherType<Rex,String>, cf : Int, ef : Int) : Dynamic;
|
|
|
public static function flags(?tb:Dynamic) : Dynamic;
|
|
|
|
|
|
/**
|
|
@@ -77,13 +78,12 @@ extern class Rex {
|
|
|
returns an iterator for repeated matching of the pattern patt in the
|
|
|
string `subj`, subject to flags `cf` and `ef`.
|
|
|
**/
|
|
|
- public static function gmatch(subj : String, patt : String, ?cf : Int, ?ef : Int) : Void->String;
|
|
|
+ public static function gmatch(subj : String, patt : EitherType<Rex,String>, ?cf : Int, ?ef : Int) : Void->String;
|
|
|
|
|
|
/**
|
|
|
This function searches for all matches of the pattern `patt` in the string
|
|
|
`subj` and replaces them according to the parameters `repl` and `n`.
|
|
|
**/
|
|
|
- @:overload( function (subj : String, patt : Rex, repl: Dynamic, ?n: Int, ?cf : Int, ?ef : Int) : String {})
|
|
|
- public static function gsub(subj : String, patt : String, repl: Dynamic, ?n: Int, ?cf : Int, ?ef : Int) : String;
|
|
|
+ public static function gsub(subj : String, patt : EitherType<Rex,String>, repl: Dynamic, ?n: Int, ?cf : Int, ?ef : Int) : String;
|
|
|
}
|
|
|
|