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:
@@ -19,6 +19,7 @@ package gplx.xowa.addons.wikis.searchs.parsers; import gplx.*; import gplx.xowa.
|
||||
import gplx.core.btries.*; import gplx.xowa.langs.cases.*;
|
||||
public class Srch_text_parser {
|
||||
private Btrie_slim_mgr parser_trie = Btrie_slim_mgr.cs(); public Btrie_slim_mgr word_end_trie = Btrie_slim_mgr.cs(); private Btrie_slim_mgr word_bgn_trie = Btrie_slim_mgr.cs();
|
||||
private final Btrie_rv trv = new Btrie_rv();
|
||||
private Xol_case_mgr case_mgr;
|
||||
public final Bry_bfr Tmp_bfr = Bry_bfr_.New_w_size(32);
|
||||
private byte[] src; private int end;
|
||||
@@ -87,14 +88,14 @@ public class Srch_text_parser {
|
||||
break;
|
||||
}
|
||||
byte b = src[pos];
|
||||
Object o = parser_trie.Match_bgn_w_byte(b, src, pos, end);
|
||||
Object o = parser_trie.Match_at_w_b0(trv, b, src, pos, end);
|
||||
if (o == null) { // unknown sequence; word-char
|
||||
if (cur_bgn == -1) cur_bgn = pos; // set 1st char for word
|
||||
++pos;
|
||||
}
|
||||
else {
|
||||
Srch_sym_parser parser = (Srch_sym_parser)o;
|
||||
pos = parser.Parse(this, src, end, pos, parser_trie.Match_pos());
|
||||
pos = parser.Parse(this, src, end, pos, trv.Pos());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -133,9 +134,9 @@ public class Srch_text_parser {
|
||||
int pos = 0; int len = bry.length;
|
||||
while (pos < len) {
|
||||
byte b = bry[pos];
|
||||
if (word_bgn_trie.Match_bgn_w_byte(b, bry, pos, len) != null) { // b is symbol;
|
||||
if (word_bgn_trie.Match_at_w_b0(trv, b, bry, pos, len) != null) { // b is symbol;
|
||||
dirty = true;
|
||||
pos = word_bgn_trie.Match_pos();
|
||||
pos = trv.Pos();
|
||||
}
|
||||
else {
|
||||
break;
|
||||
|
||||
@@ -20,8 +20,8 @@ import gplx.core.btries.*; import gplx.xowa.langs.cases.*;
|
||||
import gplx.xowa.addons.wikis.searchs.parsers.*;
|
||||
class Srch_crt_scanner {
|
||||
private final List_adp tkns = List_adp_.New(); private byte[] src; private int src_len, pos, txt_bgn;
|
||||
private final Srch_crt_scanner_syms trie_bldr; private final Btrie_slim_mgr trie;
|
||||
private final Bry_bfr word_bfr = Bry_bfr_.New(); private boolean word_is_dirty;
|
||||
private final Srch_crt_scanner_syms trie_bldr; private final Btrie_slim_mgr trie; private final Btrie_rv trv = new Btrie_rv();
|
||||
private final Bry_bfr word_bfr = Bry_bfr_.New(); private boolean word_is_dirty;
|
||||
public Srch_crt_scanner(Srch_crt_scanner_syms trie_bldr) {
|
||||
this.trie_bldr = trie_bldr;
|
||||
this.trie = trie_bldr.Trie();
|
||||
@@ -31,14 +31,14 @@ class Srch_crt_scanner {
|
||||
tkns.Clear(); pos = 0; txt_bgn = -1;
|
||||
while (pos < src_len) {
|
||||
byte cur_b = src[pos];
|
||||
byte cur_tid = trie.Match_byte_or(cur_b, src, pos, src_len, Byte_.Max_value_127);
|
||||
byte cur_tid = trie.Match_byte_or(trv, cur_b, src, pos, src_len, Byte_.Max_value_127);
|
||||
if (cur_tid == Byte_.Max_value_127) { // text character
|
||||
if (txt_bgn == -1) txt_bgn = pos; // 1st character not set; set it
|
||||
if (word_is_dirty) word_bfr.Add_byte(cur_b);
|
||||
++pos;
|
||||
}
|
||||
else { // \ \s " - & | ( )
|
||||
int pos_end = trie.Match_pos();
|
||||
int pos_end = trv.Pos();
|
||||
if ( cur_tid == Srch_crt_tkn.Tid__not // if "-"
|
||||
&& txt_bgn != -1) { // && "word has started"
|
||||
++pos;
|
||||
|
||||
@@ -35,7 +35,7 @@ public class Srch_special_cmd implements Gfo_invk, Srch_rslt_cbk, Xog_tab_close_
|
||||
}
|
||||
public void Search() {
|
||||
if (async) { // NOTE: async useful with multiple wikis; allows parallel searches;
|
||||
Srch_html_row_bldr html_row_bldr = new Srch_html_row_bldr(new gplx.xowa.htmls.core.htmls.utls.Xoh_lnki_bldr(wiki.App(), wiki.App().Html__href_wtr()));
|
||||
Srch_html_row_bldr html_row_bldr = new Srch_html_row_bldr(new gplx.xowa.htmls.core.htmls.utls.Xoh_lnki_bldr(wiki.App(), wiki.Html__href_wtr()));
|
||||
html_row_wkr = new Srch_html_row_wkr(html_row_bldr, js_wkr, qry.Slab_end - qry.Slab_bgn, wiki.Domain_bry());
|
||||
Thread_adp_.Start_by_key(gplx.xowa.apps.Xoa_thread_.Key_special_search_db, this, Invk_search_db);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user