mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
v2.7.3.1
This commit is contained in:
@@ -27,6 +27,6 @@ public class Scrib_lib_html implements Scrib_lib {
|
||||
}
|
||||
public Scrib_proc_mgr Procs() {return procs;} private Scrib_proc_mgr procs = new Scrib_proc_mgr();
|
||||
public boolean Procs_exec(int key, Scrib_proc_args args, Scrib_proc_rslt rslt) {
|
||||
throw Exc_.new_unhandled(key);
|
||||
throw Err_.new_unhandled(key);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ public class Scrib_lib_language implements Scrib_lib {
|
||||
case Proc_convertGrammar: return ConvertGrammar(args, rslt);
|
||||
case Proc_gender: return gender(args, rslt);
|
||||
case Proc_isRTL: return IsRTL(args, rslt);
|
||||
default: throw Exc_.new_unhandled(key);
|
||||
default: throw Err_.new_unhandled(key);
|
||||
}
|
||||
}
|
||||
private static final int
|
||||
@@ -99,7 +99,7 @@ public class Scrib_lib_language implements Scrib_lib {
|
||||
for (int i = 0; i < len; i++) {
|
||||
byte b = lang_code[i];
|
||||
switch (b) { // NOTE: snippet from MW follows; also \000 assumed to be Nil --> :/\\\000&<>'\"
|
||||
case Byte_ascii.Colon: case Byte_ascii.Slash: case Byte_ascii.Backslash: case Byte_ascii.Nil: case Byte_ascii.Amp: case Byte_ascii.Lt: case Byte_ascii.Gt: case Byte_ascii.Apos: case Byte_ascii.Quote:
|
||||
case Byte_ascii.Colon: case Byte_ascii.Slash: case Byte_ascii.Backslash: case Byte_ascii.Null: case Byte_ascii.Amp: case Byte_ascii.Lt: case Byte_ascii.Gt: case Byte_ascii.Apos: case Byte_ascii.Quote:
|
||||
valid = false;
|
||||
i = len;
|
||||
break;
|
||||
@@ -231,7 +231,7 @@ public class Scrib_lib_language implements Scrib_lib {
|
||||
lang.Grammar().Grammar_eval(bfr, lang, word, type);
|
||||
return rslt.Init_obj(bfr.To_str_and_rls());
|
||||
}
|
||||
public boolean gender(Scrib_proc_args args, Scrib_proc_rslt rslt) {throw Exc_.new_unimplemented();}
|
||||
public boolean gender(Scrib_proc_args args, Scrib_proc_rslt rslt) {throw Err_.new_unimplemented();}
|
||||
public boolean IsRTL(Scrib_proc_args args, Scrib_proc_rslt rslt) {
|
||||
Xol_lang lang = lang_(args);
|
||||
return rslt.Init_obj(!lang.Dir_ltr());
|
||||
@@ -239,7 +239,7 @@ public class Scrib_lib_language implements Scrib_lib {
|
||||
private Xol_lang lang_(Scrib_proc_args args) {
|
||||
byte[] lang_code = args.Cast_bry_or_null(0);
|
||||
Xol_lang lang = lang_code == null ? null : core.App().Lang_mgr().Get_by_key_or_load(lang_code);
|
||||
if (lang == null) throw Exc_.new_("lang_code is not valid", "lang_code", String_.new_u8(lang_code));
|
||||
if (lang == null) throw Err_.new_wo_type("lang_code is not valid", "lang_code", String_.new_u8(lang_code));
|
||||
return lang;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ public class Scrib_lib_message implements Scrib_lib {
|
||||
case Proc_plain: return Plain(args, rslt);
|
||||
case Proc_check: return Check(args, rslt);
|
||||
case Proc_init_message_for_lang: return Init_message_for_lang(args, rslt);
|
||||
default: throw Exc_.new_unhandled(key);
|
||||
default: throw Err_.new_unhandled(key);
|
||||
}
|
||||
}
|
||||
private static final int Proc_plain = 0, Proc_check = 1, Proc_init_message_for_lang = 2;
|
||||
@@ -67,7 +67,7 @@ class Scrib_lib_message_data {
|
||||
for (int i = 0; i < len; i++) {
|
||||
KeyVal kv = ary[i];
|
||||
byte[] kv_key = Bry_.new_a7(kv.Key());
|
||||
Object key_obj = key_hash.Get_by(kv_key); if (key_obj == null) throw Exc_.new_("msg_key is invalid", "key", kv_key);
|
||||
Object key_obj = key_hash.Get_by(kv_key); if (key_obj == null) throw Err_.new_wo_type("msg_key is invalid", "key", kv_key);
|
||||
byte key_tid = ((Byte_obj_val)key_obj).Val();
|
||||
switch (key_tid) {
|
||||
case Key_tid_keys:
|
||||
@@ -85,7 +85,7 @@ class Scrib_lib_message_data {
|
||||
for (int j = 0; j < args_ary_len; j++)
|
||||
args[j] = args_ary[j].Val_to_str_or_empty();
|
||||
break;
|
||||
default: throw Exc_.new_unhandled(key_tid);
|
||||
default: throw Err_.new_unhandled(key_tid);
|
||||
}
|
||||
}
|
||||
return this;
|
||||
@@ -123,7 +123,7 @@ class Scrib_lib_message_data {
|
||||
case Check_tid_exists : return Bry_.Len_gt_0(msg_val);
|
||||
case Check_tid_isBlank : return Bry_.Len_eq_0(msg_val); // REF.MW: $message === false || $message === ''
|
||||
case Check_tid_isDisabled : return Bry_.Len_eq_0(msg_val) || msg_val.length == 1 && msg_val[0] == Byte_ascii.Dash; // REF.MW: $message === false || $message === '' || $message === '-'
|
||||
default : throw Exc_.new_unhandled(chk_tid);
|
||||
default : throw Err_.new_unhandled(chk_tid);
|
||||
}
|
||||
}
|
||||
public byte[] Make_msg(byte[] cur_lang, Xowe_wiki wiki, Xop_ctx ctx, boolean exec_params, byte fmt_tid) {
|
||||
@@ -161,7 +161,7 @@ class Scrib_lib_message_data {
|
||||
public static byte parse_chk_(byte[] key) {return parse_or_fail(check_hash, key, "invalid check arg: {0}");}
|
||||
public static byte parse_or_fail(Hash_adp_bry hash, byte[] key, String fmt) {
|
||||
Object o = hash.Get_by_bry(key);
|
||||
if (o == null) throw Exc_.new_(fmt, "key", String_.new_u8(key)).Stack_erase_1_();
|
||||
if (o == null) throw Err_.new_wo_type(fmt, "key", String_.new_u8(key)).Trace_ignore_add_1_();
|
||||
return ((Byte_obj_val)o).Val();
|
||||
}
|
||||
public static final byte Fmt_tid_parse = 1, Fmt_tid_text = 2, Fmt_tid_plain = 3, Fmt_tid_escaped = 4, Fmt_tid_parseAsBlock = 5;
|
||||
|
||||
@@ -59,7 +59,7 @@ public class Scrib_lib_mw implements Scrib_lib {
|
||||
case Proc_newChildFrame: return NewChildFrame(args, rslt);
|
||||
case Proc_getFrameTitle: return GetFrameTitle(args, rslt);
|
||||
case Proc_setTTL: return SetTTL(args, rslt);
|
||||
default: throw Exc_.new_unhandled(key);
|
||||
default: throw Err_.new_unhandled(key);
|
||||
}
|
||||
}
|
||||
public static final int
|
||||
@@ -250,7 +250,7 @@ public class Scrib_lib_mw implements Scrib_lib {
|
||||
Xot_invk_mock frame = Xot_invk_mock.new_(parent_frame.Defn_tid(), 0, fnc_name, parser_func_args); // pass something as frame_ttl; choosng fnc_name; DATE:2014-09-21
|
||||
Xol_func_name_itm finder = cur_wiki.Lang().Func_regy().Find_defn(fnc_name, 0, fnc_name_len);
|
||||
Xot_defn defn = finder.Func();
|
||||
if (defn == Xot_defn_.Null) throw Exc_.new_("callParserFunction: function was not found", "function", String_.new_u8(fnc_name));
|
||||
if (defn == Xot_defn_.Null) throw Err_.new_wo_type("callParserFunction: function was not found", "function", String_.new_u8(fnc_name));
|
||||
Bry_bfr bfr = cur_wiki.Utl__bfr_mkr().Get_k004();
|
||||
Xop_ctx fnc_ctx = Xop_ctx.new_sub_(cur_wiki);
|
||||
fnc_ctx.Parse_tid_(Xop_parser_.Parse_tid_page_tmpl); // default xnde names to template; needed for test, but should be in place; DATE:2014-06-27
|
||||
@@ -340,7 +340,7 @@ public class Scrib_lib_mw implements Scrib_lib {
|
||||
public boolean NewChildFrame(Scrib_proc_args args, Scrib_proc_rslt rslt) {
|
||||
Ordered_hash frame_list = core.Frame_created_list();
|
||||
int frame_list_len = frame_list.Count();
|
||||
if (frame_list_len > 100) throw Exc_.new_("newChild: too many frames");
|
||||
if (frame_list_len > 100) throw Err_.new_wo_type("newChild: too many frames");
|
||||
String frame_id = args.Pull_str(0);
|
||||
Xot_invk frame = Scrib_frame_.Get_frame(core, frame_id);
|
||||
Object ttl_obj = args.Cast_obj_or_null(1); // NOTE: callers must pass named title else title will be false; EX: frame:newChild{'current', 'title0'} -> false; frame:newChild{'current', title='title0'} -> 'title0'; DATE:2014-05-20
|
||||
@@ -351,7 +351,7 @@ public class Scrib_lib_mw implements Scrib_lib {
|
||||
}
|
||||
else {
|
||||
ttl = Xoa_ttl.parse_(cur_wiki, Bry_.new_u8((String)ttl_obj));
|
||||
if (ttl == null) throw Exc_.new_("newChild: invalid title", "title", (String)ttl_obj);
|
||||
if (ttl == null) throw Err_.new_wo_type("newChild: invalid title", "title", (String)ttl_obj);
|
||||
}
|
||||
KeyVal[] args_ary = args.Pull_kv_ary(2);
|
||||
Xot_invk_mock new_frame = Xot_invk_mock.new_(core.Frame_current().Defn_tid(), 0, ttl.Full_txt(), args_ary); // NOTE: use spaces, not unders; REF.MW:$frame->getTitle()->getPrefixedText(); DATE:2014-08-14
|
||||
|
||||
@@ -36,7 +36,7 @@ public class Scrib_lib_site implements Scrib_lib {
|
||||
case Proc_usersInGroup: return UsersInGroup(args, rslt);
|
||||
case Proc_interwikiMap: return InterwikiMap(args, rslt);
|
||||
case Proc_init_site_for_wiki: return Init_site_for_wiki(args, rslt);
|
||||
default: throw Exc_.new_unhandled(key);
|
||||
default: throw Err_.new_unhandled(key);
|
||||
}
|
||||
}
|
||||
private static final int Proc_getNsIndex = 0, Proc_pagesInCategory = 1, Proc_pagesInNs = 2, Proc_usersInGroup = 3, Proc_interwikiMap = 4, Proc_init_site_for_wiki = 5;
|
||||
@@ -71,7 +71,7 @@ public class Scrib_lib_site implements Scrib_lib {
|
||||
else if (String_.Eq(filter, "!local"))
|
||||
local = 0;
|
||||
else if (filter != null)
|
||||
throw Exc_.new_("bad argument #1 to 'interwikiMap' (unknown filter '$filter')", "filter", filter);
|
||||
throw Err_.new_wo_type("bad argument #1 to 'interwikiMap' (unknown filter '$filter')", "filter", filter);
|
||||
// TODO: cache interwikimap results
|
||||
Xow_xwiki_mgr xwiki_mgr = core.Wiki().Xwiki_mgr();
|
||||
int xwiki_len = xwiki_mgr.Len();
|
||||
|
||||
@@ -35,7 +35,7 @@ public class Scrib_lib_text implements Scrib_lib {
|
||||
case Proc_killMarkers: return KillMarkers(args, rslt);
|
||||
case Proc_getEntityTable: return GetEntityTable(args, rslt);
|
||||
case Proc_init_text_for_wiki: return Init_text_for_wiki(args, rslt);
|
||||
default: throw Exc_.new_unhandled(key);
|
||||
default: throw Err_.new_unhandled(key);
|
||||
}
|
||||
}
|
||||
private static final int Proc_unstrip = 0, Proc_unstripNoWiki = 1, Proc_killMarkers = 2, Proc_getEntityTable = 3, Proc_init_text_for_wiki = 4;
|
||||
|
||||
@@ -45,7 +45,7 @@ public class Scrib_lib_title implements Scrib_lib {
|
||||
case Proc_getCurrentTitle: return GetCurrentTitle(args, rslt);
|
||||
case Proc_protectionLevels: return ProtectionLevels(args, rslt);
|
||||
case Proc_cascadingProtection: return CascadingProtection(args, rslt);
|
||||
default: throw Exc_.new_unhandled(key);
|
||||
default: throw Err_.new_unhandled(key);
|
||||
}
|
||||
}
|
||||
private static final int Proc_newTitle = 0, Proc_makeTitle = 1, Proc_getExpensiveData = 2, Proc_getUrl = 3, Proc_getContent = 4, Proc_getFileInfo = 5, Proc_getCurrentTitle = 6, Proc_protectionLevels = 7, Proc_cascadingProtection = 8;
|
||||
@@ -62,7 +62,7 @@ public class Scrib_lib_title implements Scrib_lib {
|
||||
Xowe_wiki wiki = core.Wiki();
|
||||
byte[] ns_bry = null;
|
||||
if (ns_obj != null) {
|
||||
ns_bry = Parse_ns(wiki, ns_obj); if (ns_bry == null) throw Exc_.new_("unknown ns", "ns", Object_.Xto_str_strict_or_empty(ns_bry));
|
||||
ns_bry = Parse_ns(wiki, ns_obj); if (ns_bry == null) throw Err_.new_wo_type("unknown ns", "ns", Object_.Xto_str_strict_or_empty(ns_bry));
|
||||
}
|
||||
if (ns_bry != null) {
|
||||
Bry_bfr bfr = wiki.Utl__bfr_mkr().Get_b512();
|
||||
@@ -78,7 +78,7 @@ public class Scrib_lib_title implements Scrib_lib {
|
||||
byte[] ttl_bry = args.Pull_bry(0);
|
||||
byte[] url_func_bry = args.Pull_bry(1);
|
||||
Object url_func_obj = url_func_hash.Get_by(url_func_bry);
|
||||
if (url_func_obj == null) throw Exc_.new_("url_function is not valid", "url_func", String_.new_u8(url_func_bry));
|
||||
if (url_func_obj == null) throw Err_.new_wo_type("url_function is not valid", "url_func", String_.new_u8(url_func_bry));
|
||||
byte url_func_tid = ((Byte_obj_val)url_func_obj).Val();
|
||||
byte[] qry_bry = args.Extract_qry_args(wiki, 2);
|
||||
// byte[] proto = Scrib_kv_utl_.Val_to_bry_or(values, 3, null); // NOTE: Scribunto has more conditional logic around argument 2 and setting protocols; DATE:2014-07-07
|
||||
|
||||
@@ -36,7 +36,7 @@ public class Scrib_lib_uri implements Scrib_lib {
|
||||
case Proc_fullUrl: return Url_func(args, rslt, Pfunc_urlfunc.Tid_full);
|
||||
case Proc_canonicalUrl: return Url_func(args, rslt, Pfunc_urlfunc.Tid_canonical);
|
||||
case Proc_init_uri_for_page: return Init_uri_for_page(args, rslt);
|
||||
default: throw Exc_.new_unhandled(key);
|
||||
default: throw Err_.new_unhandled(key);
|
||||
}
|
||||
}
|
||||
private static final int Proc_anchorEncode = 0, Proc_localUrl = 1, Proc_fullUrl = 2, Proc_canonicalUrl = 3, Proc_init_uri_for_page = 4;
|
||||
|
||||
@@ -41,7 +41,7 @@ public class Scrib_lib_ustring implements Scrib_lib {
|
||||
case Proc_gmatch_init: return Gmatch_init(args, rslt);
|
||||
case Proc_gmatch_callback: return Gmatch_callback(args, rslt);
|
||||
case Proc_gsub: return Gsub(args, rslt);
|
||||
default: throw Exc_.new_unhandled(key);
|
||||
default: throw Err_.new_unhandled(key);
|
||||
}
|
||||
}
|
||||
private static final int Proc_find = 0, Proc_match = 1, Proc_gmatch_init = 2, Proc_gmatch_callback = 3, Proc_gsub = 4;
|
||||
@@ -209,7 +209,7 @@ class Scrib_lib_ustring_gsub_mgr {
|
||||
tmp_repl_tid = Repl_tid_luacbk;
|
||||
repl_func = (Scrib_lua_proc)repl_obj;
|
||||
}
|
||||
else throw Exc_.new_unhandled(ClassAdp_.NameOf_type(repl_type));
|
||||
else throw Err_.new_unhandled(ClassAdp_.NameOf_type(repl_type));
|
||||
}
|
||||
private String Exec_repl(byte repl_tid, byte[] repl_bry, String text, String regx, int limit) {
|
||||
RegxAdp regx_mgr = Scrib_lib_ustring.RegxAdp_new_(core.Ctx(), regx);
|
||||
@@ -316,7 +316,7 @@ class Scrib_lib_ustring_gsub_mgr {
|
||||
tmp_bfr.Add_str(Scrib_kv_utl_.Val_to_str(rslts, 0));
|
||||
break;
|
||||
}
|
||||
default: throw Exc_.new_unhandled(repl_tid);
|
||||
default: throw Err_.new_unhandled(repl_tid);
|
||||
}
|
||||
}
|
||||
static final byte Repl_tid_null = 0, Repl_tid_string = 1, Repl_tid_table = 2, Repl_tid_luacbk = 3;
|
||||
|
||||
@@ -16,7 +16,7 @@ You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.xtns.scribunto.libs; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.scribunto.*;
|
||||
import gplx.json.*; import gplx.xowa.xtns.wdatas.*; import gplx.xowa.xtns.wdatas.parsers.*;
|
||||
import gplx.core.json.*; import gplx.xowa.xtns.wdatas.*; import gplx.xowa.xtns.wdatas.parsers.*;
|
||||
public class Scrib_lib_wikibase implements Scrib_lib {
|
||||
public Scrib_lib_wikibase(Scrib_core core) {this.core = core;} private Scrib_core core;
|
||||
public Scrib_lua_mod Mod() {return mod;} private Scrib_lua_mod mod;
|
||||
@@ -33,7 +33,7 @@ public class Scrib_lib_wikibase implements Scrib_lib {
|
||||
case Proc_getEntity: return GetEntity(args, rslt);
|
||||
case Proc_getEntityId: return GetEntityId(args, rslt);
|
||||
case Proc_getGlobalSiteId: return GetGlobalSiteId(args, rslt);
|
||||
default: throw Exc_.new_unhandled(key);
|
||||
default: throw Err_.new_unhandled(key);
|
||||
}
|
||||
}
|
||||
private static final int Proc_getEntity = 0, Proc_getEntityId = 1, Proc_getGlobalSiteId = 2;
|
||||
|
||||
@@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.xtns.scribunto.libs; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.scribunto.*;
|
||||
import gplx.xowa.xtns.wdatas.*;
|
||||
import gplx.json.*; import gplx.xowa.xtns.wdatas.core.*;
|
||||
import gplx.core.json.*; import gplx.xowa.xtns.wdatas.core.*;
|
||||
public class Scrib_lib_wikibase_entity implements Scrib_lib {
|
||||
public Scrib_lib_wikibase_entity(Scrib_core core) {this.core = core;} private Scrib_core core;
|
||||
public Scrib_lua_mod Mod() {return mod;} private Scrib_lua_mod mod;
|
||||
@@ -32,7 +32,7 @@ public class Scrib_lib_wikibase_entity implements Scrib_lib {
|
||||
switch (key) {
|
||||
case Proc_getGlobalSiteId: return GetGlobalSiteId(args, rslt);
|
||||
case Proc_formatPropertyValues: return FormatPropertyValues(args, rslt);
|
||||
default: throw Exc_.new_unhandled(key);
|
||||
default: throw Err_.new_unhandled(key);
|
||||
}
|
||||
}
|
||||
private static final int Proc_getGlobalSiteId = 0, Proc_formatPropertyValues = 1;
|
||||
|
||||
@@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.xtns.scribunto.libs; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.scribunto.*;
|
||||
import org.junit.*;
|
||||
import gplx.json.*; import gplx.xowa.xtns.wdatas.*; import gplx.xowa.xtns.wdatas.core.*; import gplx.xowa.xtns.wdatas.parsers.*;
|
||||
import gplx.core.json.*; import gplx.xowa.xtns.wdatas.*; import gplx.xowa.xtns.wdatas.core.*; import gplx.xowa.xtns.wdatas.parsers.*;
|
||||
public class Scrib_lib_wikibase_srl_tst {
|
||||
@Before public void init() {fxt.Clear();} private Scrib_lib_wikibase_srl_fxt fxt = new Scrib_lib_wikibase_srl_fxt();
|
||||
@Test public void Label() {
|
||||
|
||||
@@ -43,7 +43,7 @@ public class Scrib_regx_converter {
|
||||
bfr.Add(q_flag ? Bry_dollar_escaped : Bry_dollar_literal);
|
||||
break;
|
||||
case Byte_ascii.Paren_bgn: {
|
||||
if (i + 1 >= len) throw Exc_.new_("Unmatched open-paren at pattern character " + Int_.Xto_str(i));
|
||||
if (i + 1 >= len) throw Err_.new_wo_type("Unmatched open-paren at pattern character " + Int_.Xto_str(i));
|
||||
boolean capt_itm = src[i + 1] == Byte_ascii.Paren_end; // current is "()"
|
||||
++grps_len;
|
||||
capt_list.Add(KeyVal_.int_(grps_len, capt_itm));
|
||||
@@ -54,13 +54,13 @@ public class Scrib_regx_converter {
|
||||
}
|
||||
case Byte_ascii.Paren_end:
|
||||
if (grps_open.Count() == 0)
|
||||
throw Exc_.new_("Unmatched close-paren at pattern character " + Int_.Xto_str(i));
|
||||
throw Err_.new_wo_type("Unmatched close-paren at pattern character " + Int_.Xto_str(i));
|
||||
List_adp_.DelAt_last(grps_open);
|
||||
bfr.Add_byte(Byte_ascii.Paren_end);
|
||||
break;
|
||||
case Byte_ascii.Percent:
|
||||
++i;
|
||||
if (i >= len) throw Exc_.new_("malformed pattern (ends with '%')");
|
||||
if (i >= len) throw Err_.new_wo_type("malformed pattern (ends with '%')");
|
||||
Object percent_obj = percent_hash.Get_by_mid(src, i, i + 1);
|
||||
if (percent_obj != null) {
|
||||
bfr.Add((byte[])percent_obj);
|
||||
@@ -71,7 +71,7 @@ public class Scrib_regx_converter {
|
||||
switch (nxt) {
|
||||
case Byte_ascii.Ltr_b: // EX: "%b()"
|
||||
i += 2;
|
||||
if (i >= len) throw Exc_.new_("malformed pattern (missing arguments to \'%b\')");
|
||||
if (i >= len) throw Err_.new_wo_type("malformed pattern (missing arguments to \'%b\')");
|
||||
byte char_0 = src[i - 1];
|
||||
byte char_1 = src[i];
|
||||
if (char_0 == char_1) { // same char: easier regex; REF.MW: $bfr .= "{$d1}[^$d1]*$d1";
|
||||
@@ -98,7 +98,7 @@ public class Scrib_regx_converter {
|
||||
case Byte_ascii.Num_5: case Byte_ascii.Num_6: case Byte_ascii.Num_7: case Byte_ascii.Num_8: case Byte_ascii.Num_9:
|
||||
grps_len = nxt - Byte_ascii.Num_0;
|
||||
if (grps_len == 0 || grps_len > capt_list.Count() || grps_open_Has(grps_open, grps_len))
|
||||
throw Exc_.new_("invalid capture index %" + grps_len + " at pattern character " + Int_.Xto_str(i));
|
||||
throw Err_.new_wo_type("invalid capture index %" + grps_len + " at pattern character " + Int_.Xto_str(i));
|
||||
bfr.Add(Bry_bf2_seg_0).Add_int_variable(grps_len);//.Add(Bry_bf2_seg_1); // $bfr .= "\\g{m$grps_len}";
|
||||
break;
|
||||
default:
|
||||
@@ -153,11 +153,11 @@ public class Scrib_regx_converter {
|
||||
}
|
||||
if (stop) break;
|
||||
}
|
||||
if (i >= len) throw Exc_.new_("Missing close-bracket for character set beginning at pattern character $nxt_pos");
|
||||
if (i >= len) throw Err_.new_wo_type("Missing close-bracket for character set beginning at pattern character $nxt_pos");
|
||||
bfr.Add_byte(Byte_ascii.Brack_end);
|
||||
q_flag = true;
|
||||
break;
|
||||
case Byte_ascii.Brack_end: throw Exc_.new_("Unmatched close-bracket at pattern character " + Int_.Xto_str(i));
|
||||
case Byte_ascii.Brack_end: throw Err_.new_wo_type("Unmatched close-bracket at pattern character " + Int_.Xto_str(i));
|
||||
case Byte_ascii.Dot:
|
||||
q_flag = true;
|
||||
bfr.Add_byte(Byte_ascii.Dot);
|
||||
@@ -183,7 +183,7 @@ public class Scrib_regx_converter {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (grps_open.Count() > 0) throw Exc_.new_("Unclosed capture beginning at pattern character " + Int_.cast_(grps_open.Get_at(0)));
|
||||
if (grps_open.Count() > 0) throw Err_.new_wo_type("Unclosed capture beginning at pattern character " + Int_.cast_(grps_open.Get_at(0)));
|
||||
// bfr.Add(Bry_regx_end); // NOTE: do not add PHP /us at end; u=PCRE_UTF8 which is not needed for Java; s=PCRE_DOTALL which will be specified elsewhere
|
||||
regx = bfr.Xto_str_and_clear();
|
||||
return regx;
|
||||
|
||||
Reference in New Issue
Block a user