mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
'v3.7.3.1'
This commit is contained in:
@@ -21,6 +21,7 @@ import gplx.xowa.wikis.data.tbls.*;
|
||||
public class Xobd_parser implements Xob_page_wkr {
|
||||
private final Xob_bldr bldr;
|
||||
private final Btrie_slim_mgr trie = Btrie_slim_mgr.ci_a7(); // NOTE:ci.ascii:MW_const.en; ctg.v1 assumes [[Category:
|
||||
private final Btrie_rv trv = new Btrie_rv();
|
||||
private final List_adp wkr_list = List_adp_.New();
|
||||
public String Page_wkr__key() {return KEY;} static final String KEY = "page_parser";
|
||||
public Xobd_parser(Xob_bldr bldr) {this.bldr = bldr;}
|
||||
@@ -42,12 +43,12 @@ public class Xobd_parser implements Xob_page_wkr {
|
||||
int pos = 0;
|
||||
while (true) {
|
||||
if (pos == src_len) break;
|
||||
Object o = trie.Match_bgn(src, pos, src_len);
|
||||
Object o = trie.Match_at(trv, src, pos, src_len);
|
||||
if (o == null)
|
||||
++pos;
|
||||
else {
|
||||
Xobd_parser_wkr wkr = (Xobd_parser_wkr)o;
|
||||
pos = wkr.Wkr_run(page, src, src_len, pos, trie.Match_pos());
|
||||
pos = wkr.Wkr_run(page, src, src_len, pos, trv.Pos());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.xowa.bldrs.cmds.ctgs; import gplx.*; import gplx.xowa.*; import gplx.xowa.bldrs.*; import gplx.xowa.bldrs.cmds.*;
|
||||
import gplx.core.btries.*;
|
||||
class Uca_trie {
|
||||
private final Btrie_slim_mgr trie = Btrie_slim_mgr.cs();
|
||||
private final Btrie_slim_mgr trie = Btrie_slim_mgr.cs();
|
||||
private final Btrie_rv trv = new Btrie_rv();
|
||||
public void Init() {
|
||||
Init_itm(1, Bry_.New_by_ints(1,1));
|
||||
Init_itm(2, Bry_.New_by_ints(1,1));
|
||||
@@ -1049,12 +1050,12 @@ Init_itm(1024, Bry_.New_by_ints(92,52,1,134,143,1,143,5));
|
||||
public void Decode(Bry_bfr tmp, byte[] src, int bgn, int end) {
|
||||
int i = bgn;
|
||||
while (i < end) {
|
||||
Object o = trie.Match_bgn(src, i, end);
|
||||
Object o = trie.Match_at(trv, src, i, end);
|
||||
if (src[i] < 4) return;
|
||||
if (o == null) return; //throw Err_.new_fmt_("unknown error: {0}", i);
|
||||
byte[] utf8_char = (byte[])o;
|
||||
tmp.Add(utf8_char);
|
||||
i = trie.Match_pos();
|
||||
i = trv.Pos();
|
||||
}
|
||||
}
|
||||
public void Init_itm(int charAsInt, byte[] uca) {
|
||||
|
||||
@@ -21,6 +21,7 @@ class Xob_css_parser {
|
||||
private final Bry_bfr bfr = Bry_bfr_.New_w_size(255);
|
||||
private final Xob_mirror_mgr mgr;
|
||||
private final Xob_css_parser__url url_parser; private final Xob_css_parser__import import_parser;
|
||||
private final Btrie_rv trv = new Btrie_rv();
|
||||
public Xob_css_parser(Xob_mirror_mgr mgr) {
|
||||
this.mgr = mgr;
|
||||
this.url_parser = new Xob_css_parser__url(mgr.Site_url());
|
||||
@@ -30,14 +31,14 @@ class Xob_css_parser {
|
||||
int src_len = src.length; int pos = 0;
|
||||
while (pos < src_len) {
|
||||
byte b = src[pos];
|
||||
Object o = tkns_trie.Match_bgn_w_byte(b, src, pos, src_len);
|
||||
Object o = tkns_trie.Match_at_w_b0(trv, b, src, pos, src_len);
|
||||
if (o == null) {
|
||||
bfr.Add_byte(b);
|
||||
++pos;
|
||||
}
|
||||
else {
|
||||
byte tkn_tid = ((Byte_obj_val)o).Val();
|
||||
int match_pos = tkns_trie.Match_pos();
|
||||
int match_pos = trv.Pos();
|
||||
Xob_css_tkn__base tkn = null;
|
||||
switch (tkn_tid) {
|
||||
case Tkn_url: tkn = url_parser.Parse(src, src_len, pos, match_pos); break;
|
||||
|
||||
@@ -19,6 +19,7 @@ package gplx.xowa.bldrs.setups.maints; import gplx.*; import gplx.xowa.*; import
|
||||
import gplx.core.btries.*; import gplx.core.ios.*;
|
||||
public class Wmf_latest_parser {
|
||||
private Ordered_hash hash = Ordered_hash_.New_bry();
|
||||
private final Btrie_rv trv = new Btrie_rv();
|
||||
public int Count() {return hash.Count();}
|
||||
public Wmf_latest_itm Get_at(int i) {return (Wmf_latest_itm)hash.Get_at(i);}
|
||||
public Wmf_latest_itm Get_by(byte[] k) {return (Wmf_latest_itm)hash.Get_by(k);}
|
||||
@@ -47,7 +48,7 @@ public class Wmf_latest_parser {
|
||||
date_bgn = Bry_find_.Find_fwd_while_space_or_tab(src, date_bgn, src_len); if (date_bgn == Bry_find_.Not_found) {Gfo_usr_dlg_.Instance.Warn_many("", "", "date_bgn not found"); break;}
|
||||
int date_end = Bry_find_.Find_fwd(src, date_end_bry, date_bgn, src_len);
|
||||
byte[] date_bry = Bry_.Mid(src, date_bgn, date_end);
|
||||
DateAdp date = DateAdp_.parse_fmt(String_.new_a7(Replace_or(tmp_bfr, date_trie, date_bry, 3, date_or)), "dd-MM-yyyy HH:mm");
|
||||
DateAdp date = DateAdp_.parse_fmt(String_.new_a7(Replace_or(tmp_bfr, date_trie, trv, date_bry, 3, date_or)), "dd-MM-yyyy HH:mm");
|
||||
int size_bgn = Bry_find_.Find_fwd_while_space_or_tab(src, date_end, src_len); if (size_bgn == Bry_find_.Not_found) {Gfo_usr_dlg_.Instance.Warn_many("", "", "size_bgn not found"); break;}
|
||||
size_end = Bry_find_.Find_fwd(src, Byte_ascii.Cr, size_bgn, src_len);
|
||||
byte[] size_bry = Bry_.Mid(src, size_bgn, size_end);
|
||||
@@ -56,12 +57,12 @@ public class Wmf_latest_parser {
|
||||
hash.Add(name, itm);
|
||||
}
|
||||
}
|
||||
private static byte[] Replace_or(Bry_bfr tmp_bfr, Btrie_slim_mgr trie, byte[] src, int pos, byte[] or) {
|
||||
private static byte[] Replace_or(Bry_bfr tmp_bfr, Btrie_slim_mgr trie, Btrie_rv trv, byte[] src, int pos, byte[] or) {
|
||||
int src_len = src.length;
|
||||
Object o = trie.Match_bgn(src, pos, src_len); if (o == null) return or;
|
||||
Object o = trie.Match_at(trv, src, pos, src_len); if (o == null) return or;
|
||||
tmp_bfr.Add_mid(src, 0, pos);
|
||||
tmp_bfr.Add((byte[])o);
|
||||
tmp_bfr.Add_mid(src, trie.Match_pos(), src_len);
|
||||
tmp_bfr.Add_mid(src, trv.Pos(), src_len);
|
||||
return tmp_bfr.To_bry_and_clear();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ public class Xob_xml_parser_ {
|
||||
trie_add(rv, Bry_tab, Id_tab, Bry_tab_ent); trie_add(rv, Bry_cr_nl, Id_cr_nl, Byte_ascii.Nl); trie_add(rv, Bry_cr, Id_cr, Byte_ascii.Nl);
|
||||
return rv;
|
||||
}
|
||||
public static final byte[]
|
||||
public static final byte[]
|
||||
Bry_page_bgn = Bry_.new_a7("<page>"), Bry_page_bgn_frag = Bry_.new_a7("<page"), Bry_page_end = Bry_.new_a7("</page>")
|
||||
, Bry_title_bgn = Bry_.new_a7("<title>"), Bry_title_bgn_frag = Bry_.new_a7("<title"), Bry_title_end = Bry_.new_a7("</title>")
|
||||
, Bry_id_bgn = Bry_.new_a7("<id>"), Bry_id_bgn_frag = Bry_.new_a7("<id"), Bry_id_end = Bry_.new_a7("</id>")
|
||||
|
||||
Reference in New Issue
Block a user