1
0
mirror of https://github.com/gnosygnu/xowa.git synced 2026-03-02 03:49:30 +00:00

v2.10.3.1

This commit is contained in:
gnosygnu
2015-10-18 22:17:57 -04:00
parent 8e18af05b6
commit 4f43f51b18
1935 changed files with 12500 additions and 12889 deletions

View File

@@ -21,7 +21,7 @@ import gplx.xowa.parsers.paras.*;
public class Xop_comm_lxr implements Xop_lxr {
public int Lxr_tid() {return Xop_lxr_.Tid_comment;}
public void Init_by_wiki(Xowe_wiki wiki, Btrie_fast_mgr core_trie) {core_trie.Add(Bgn_ary, this);}
public void Init_by_lang(Xol_lang lang, Btrie_fast_mgr core_trie) {}
public void Init_by_lang(Xol_lang_itm lang, Btrie_fast_mgr core_trie) {}
public void Term(Btrie_fast_mgr core_trie) {}
public int Make_tkn(Xop_ctx ctx, Xop_tkn_mkr tkn_mkr, Xop_root_tkn root, byte[] src, int src_len, int bgn_pos, int cur_pos) {
int lhs_end = cur_pos;
@@ -91,7 +91,7 @@ public class Xop_comm_lxr implements Xop_lxr {
}
public static final byte[] Bgn_ary = new byte[] {60, 33, 45, 45}, /*<!--*/ End_ary = new byte[] {45, 45, 62}; /*-->*/
private static final int End_len = End_ary.length;
public static final Xop_comm_lxr _ = new Xop_comm_lxr(); Xop_comm_lxr() {}
public static final Xop_comm_lxr Instance = new Xop_comm_lxr(); Xop_comm_lxr() {}
private static final String Xowa_skip_text_str = "XOWA_SKIP";
private static final byte[] Xowa_skip_text_bry = Bry_.new_a7(Xowa_skip_text_str);
public static final byte[] Xowa_skip_comment_bry = Bry_.new_a7("<!--" + Xowa_skip_text_str + "-->");

View File

@@ -20,10 +20,10 @@ import gplx.core.btries.*; import gplx.xowa.langs.*;
public class Xop_cr_lxr implements Xop_lxr {
public int Lxr_tid() {return Xop_lxr_.Tid_cr;}
public void Init_by_wiki(Xowe_wiki wiki, Btrie_fast_mgr core_trie) {core_trie.Add(Byte_ascii.Cr, this);}
public void Init_by_lang(Xol_lang lang, Btrie_fast_mgr core_trie) {}
public void Init_by_lang(Xol_lang_itm lang, Btrie_fast_mgr core_trie) {}
public void Term(Btrie_fast_mgr core_trie) {}
public int Make_tkn(Xop_ctx ctx, Xop_tkn_mkr tkn_mkr, Xop_root_tkn root, byte[] src, int src_len, int bgn_pos, int cur_pos) {
return cur_pos; //ignore
}
public static final Xop_cr_lxr _ = new Xop_cr_lxr(); Xop_cr_lxr() {}
public static final Xop_cr_lxr Instance = new Xop_cr_lxr(); Xop_cr_lxr() {}
}

View File

@@ -22,7 +22,7 @@ public class Xop_eq_lxr implements Xop_lxr {
public Xop_eq_lxr(boolean tmpl_mode) {this.tmpl_mode = tmpl_mode;} boolean tmpl_mode;
public int Lxr_tid() {return Xop_lxr_.Tid_eq;}
public void Init_by_wiki(Xowe_wiki wiki, Btrie_fast_mgr core_trie) {core_trie.Add(Byte_ascii.Eq, this);}
public void Init_by_lang(Xol_lang lang, Btrie_fast_mgr core_trie) {}
public void Init_by_lang(Xol_lang_itm lang, Btrie_fast_mgr core_trie) {}
public void Term(Btrie_fast_mgr core_trie) {}
public int Make_tkn(Xop_ctx ctx, Xop_tkn_mkr tkn_mkr, Xop_root_tkn root, byte[] src, int src_len, int bgn_pos, int cur_pos) {
cur_pos = Bry_find_.Find_fwd_while(src, cur_pos, src_len, Byte_ascii.Eq); // gobble up eq; "==" should produce 1 eq_tkn with len of 2, not 2 eq_tkn with len of 1; DATE:2014-04-17

View File

@@ -21,7 +21,7 @@ import gplx.xowa.parsers.xndes.*;
public class Xop_hr_lxr implements Xop_lxr {
public int Lxr_tid() {return Xop_lxr_.Tid_hr;}
public void Init_by_wiki(Xowe_wiki wiki, Btrie_fast_mgr parse_trie) {parse_trie.Add(Hook_ary, this);} static final byte[] Hook_ary = new byte[] {Byte_ascii.Nl, Byte_ascii.Dash, Byte_ascii.Dash, Byte_ascii.Dash, Byte_ascii.Dash};
public void Init_by_lang(Xol_lang lang, Btrie_fast_mgr core_trie) {}
public void Init_by_lang(Xol_lang_itm lang, Btrie_fast_mgr core_trie) {}
public void Term(Btrie_fast_mgr core_trie) {}
public int Make_tkn(Xop_ctx ctx, Xop_tkn_mkr tkn_mkr, Xop_root_tkn root, byte[] src, int src_len, int bgn_pos, int cur_pos) {
int nl_adj = -1; // -1 to ignore nl at bgn for hr_len
@@ -42,5 +42,5 @@ public class Xop_hr_lxr implements Xop_lxr {
return cur_pos;
} private static final byte Hook_byt = Byte_ascii.Dash;
public static final int Hr_len = 4;
public static final Xop_hr_lxr _ = new Xop_hr_lxr(); Xop_hr_lxr() {}
public static final Xop_hr_lxr Instance = new Xop_hr_lxr(); Xop_hr_lxr() {}
}

View File

@@ -21,7 +21,7 @@ public class Xop_macro_lxr implements Xop_lxr {
public Xop_macro_lxr() {}
public int Lxr_tid() {return Xop_lxr_.Tid_macro;}
public void Init_by_wiki(Xowe_wiki wiki, Btrie_fast_mgr core_trie) {core_trie.Add(Byte_ascii.Tab, this); core_trie.Add(Xop_tab_tkn.Bry_tab_ent, this);}
public void Init_by_lang(Xol_lang lang, Btrie_fast_mgr core_trie) {}
public void Init_by_lang(Xol_lang_itm lang, Btrie_fast_mgr core_trie) {}
public void Term(Btrie_fast_mgr core_trie) {}
public int Make_tkn(Xop_ctx ctx, Xop_tkn_mkr tkn_mkr, Xop_root_tkn root, byte[] src, int src_len, int bgn_pos, int cur_pos) {
cur_pos = Bry_find_.Find_fwd_while(src, cur_pos, src_len, Byte_ascii.Tab);
@@ -31,5 +31,5 @@ public class Xop_macro_lxr implements Xop_lxr {
ctx.Subs_add(root, tkn_mkr.Tab(bgn_pos, cur_pos));
return cur_pos;
}
public static final Xop_tab_lxr _ = new Xop_tab_lxr();
public static final Xop_tab_lxr Instance = new Xop_tab_lxr();
}

View File

@@ -21,7 +21,7 @@ import gplx.xowa.parsers.tblws.*; import gplx.xowa.parsers.lnkis.*; import gplx.
public class Xop_pipe_lxr implements Xop_lxr {
public int Lxr_tid() {return Xop_lxr_.Tid_pipe;}
public void Init_by_wiki(Xowe_wiki wiki, Btrie_fast_mgr core_trie) {core_trie.Add(Byte_ascii.Pipe, this);}
public void Init_by_lang(Xol_lang lang, Btrie_fast_mgr core_trie) {}
public void Init_by_lang(Xol_lang_itm lang, Btrie_fast_mgr core_trie) {}
public void Term(Btrie_fast_mgr core_trie) {}
public int Make_tkn(Xop_ctx ctx, Xop_tkn_mkr tkn_mkr, Xop_root_tkn root, byte[] src, int src_len, int bgn_pos, int cur_pos) {
int cur_stack_tid = ctx.Cur_tkn_tid(), rv = -1;
@@ -62,11 +62,6 @@ public class Xop_pipe_lxr implements Xop_lxr {
Xop_tblw_wkr.Atrs_make(ctx, src, root, ctx.Tblw(), cur_tkn, Bool_.N);
return cur_pos;
}
case Xop_tkn_itm_.Tid_vnt:
Xop_vnt_tkn vnt_tkn = (Xop_vnt_tkn)ctx.Stack_get_typ(Xop_tkn_itm_.Tid_vnt);
vnt_tkn.Vnt_pipe_tkn_count_add_();
ctx.Subs_add(root, tkn_mkr.Pipe(bgn_pos, cur_pos));
return cur_pos;
case Xop_tkn_itm_.Tid_lnki:
Xop_lnki_tkn lnki = (Xop_lnki_tkn)ctx.Stack_get_last(); // BLOCK:invalid_ttl_check
if ( lnki.Pipe_count_is_zero()
@@ -81,5 +76,5 @@ public class Xop_pipe_lxr implements Xop_lxr {
return cur_pos;
}
}
public static final Xop_pipe_lxr _ = new Xop_pipe_lxr();
public static final Xop_pipe_lxr Instance = new Xop_pipe_lxr();
}

View File

@@ -20,12 +20,12 @@ import gplx.core.btries.*; import gplx.xowa.langs.*;
public class Xop_space_lxr implements Xop_lxr {
public int Lxr_tid() {return Xop_lxr_.Tid_space;}
public void Init_by_wiki(Xowe_wiki wiki, Btrie_fast_mgr core_trie) {core_trie.Add(Byte_ascii.Space, this);}
public void Init_by_lang(Xol_lang lang, Btrie_fast_mgr core_trie) {}
public void Init_by_lang(Xol_lang_itm lang, Btrie_fast_mgr core_trie) {}
public void Term(Btrie_fast_mgr core_trie) {}
public int Make_tkn(Xop_ctx ctx, Xop_tkn_mkr tkn_mkr, Xop_root_tkn root, byte[] src, int src_len, int bgn_pos, int cur_pos) {
cur_pos = Bry_find_.Find_fwd_while(src, cur_pos, src_len, Byte_ascii.Space);
ctx.Subs_add(root, tkn_mkr.Space(root, bgn_pos, cur_pos));
return cur_pos;
}
public static final Xop_space_lxr _ = new Xop_space_lxr();
public static final Xop_space_lxr Instance = new Xop_space_lxr();
}

View File

@@ -20,7 +20,7 @@ import gplx.core.btries.*; import gplx.xowa.langs.*;
public class Xop_tab_lxr implements Xop_lxr {
public int Lxr_tid() {return Xop_lxr_.Tid_tab;}
public void Init_by_wiki(Xowe_wiki wiki, Btrie_fast_mgr core_trie) {core_trie.Add(Byte_ascii.Tab, this); core_trie.Add(Xop_tab_tkn.Bry_tab_ent, this);}
public void Init_by_lang(Xol_lang lang, Btrie_fast_mgr core_trie) {}
public void Init_by_lang(Xol_lang_itm lang, Btrie_fast_mgr core_trie) {}
public void Term(Btrie_fast_mgr core_trie) {}
public int Make_tkn(Xop_ctx ctx, Xop_tkn_mkr tkn_mkr, Xop_root_tkn root, byte[] src, int src_len, int bgn_pos, int cur_pos) {
cur_pos = Bry_find_.Find_fwd_while(src, cur_pos, src_len, Byte_ascii.Tab);
@@ -30,5 +30,5 @@ public class Xop_tab_lxr implements Xop_lxr {
ctx.Subs_add(root, tkn_mkr.Tab(bgn_pos, cur_pos));
return cur_pos;
}
public static final Xop_tab_lxr _ = new Xop_tab_lxr();
public static final Xop_tab_lxr Instance = new Xop_tab_lxr();
}

View File

@@ -16,13 +16,14 @@ 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.parsers.miscs; import gplx.*; import gplx.xowa.*; import gplx.xowa.parsers.*;
import gplx.core.btries.*; import gplx.xowa.langs.*;
import gplx.xowa.html.tocs.*;
import gplx.core.btries.*;
import gplx.xowa.langs.*; import gplx.xowa.langs.kwds.*;
import gplx.xowa.htmls.tocs.*;
public class Xop_under_lxr implements Xop_lxr {
private Btrie_mgr words_trie_ci, words_trie_cs;
public int Lxr_tid() {return Xop_lxr_.Tid_under;}
public void Init_by_wiki(Xowe_wiki wiki, Btrie_fast_mgr core_trie) {}
public void Init_by_lang(Xol_lang lang, Btrie_fast_mgr core_trie) {
public void Init_by_lang(Xol_lang_itm lang, Btrie_fast_mgr core_trie) {
Xol_kwd_mgr kwd_mgr = lang.Kwd_mgr();
int under_kwds_len = under_kwds.length;
Xop_under_lxr lxr = new Xop_under_lxr();
@@ -56,7 +57,7 @@ public class Xop_under_lxr implements Xop_lxr {
if (kwd_case_match) // cs; add word directly to trie
core_trie.Add(kwd_bry, word_lxr);
else { // NOTE: next part is imprecise; XOWA parser is cs, but kwd is ci; for now, just add all upper and all lower
Gfo_usr_dlg_.I.Warn_many("", "", "under keyword does not start with __; id=~{0} key=~{1} word=~{2}", kwd_id, String_.new_u8(kwd_grp.Key()), String_.new_u8(kwd_bry));
Gfo_usr_dlg_.Instance.Warn_many("", "", "under keyword does not start with __; id=~{0} key=~{1} word=~{2}", kwd_id, String_.new_u8(kwd_grp.Key()), String_.new_u8(kwd_bry));
core_trie.Add(lang.Case_mgr().Case_build_lower(kwd_bry), word_lxr);
core_trie.Add(lang.Case_mgr().Case_build_upper(kwd_bry), word_lxr);
}
@@ -110,14 +111,14 @@ public class Xop_under_lxr implements Xop_lxr {
default: break; // ignore anything else
}
}
public static final Xop_under_lxr _ = new Xop_under_lxr(); Xop_under_lxr() {}
public static final Xop_under_lxr Instance = new Xop_under_lxr(); Xop_under_lxr() {}
}
class Xop_word_lxr implements Xop_lxr {
private int kwd_id;
public Xop_word_lxr(int kwd_id) {this.kwd_id = kwd_id;}
public int Lxr_tid() {return Xop_lxr_.Tid_word;}
public void Init_by_wiki(Xowe_wiki wiki, Btrie_fast_mgr core_trie) {}
public void Init_by_lang(Xol_lang lang, Btrie_fast_mgr core_trie) {}
public void Init_by_lang(Xol_lang_itm lang, Btrie_fast_mgr core_trie) {}
public void Term(Btrie_fast_mgr core_trie) {}
public int Make_tkn(Xop_ctx ctx, Xop_tkn_mkr tkn_mkr, Xop_root_tkn root, byte[] src, int src_len, int bgn_pos, int cur_pos) {
Xop_under_lxr.Make_tkn(ctx, tkn_mkr, root, src, src_len, bgn_pos, cur_pos, kwd_id); // for now, all word_lxrs only call the under_lxr; DATE:2014-02-14

View File

@@ -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.parsers.miscs; import gplx.*; import gplx.xowa.*; import gplx.xowa.parsers.*;
import org.junit.*; import gplx.xowa.langs.*;
import org.junit.*; import gplx.xowa.langs.*; import gplx.xowa.langs.kwds.*;
public class Xop_under_lxr_tst {
private Xop_fxt fxt = new Xop_fxt();
@Before public void init() {fxt.Reset();}
@@ -98,7 +98,7 @@ public class Xop_under_lxr_tst {
fxt.Test_parse_page_all_str("__DISAMBIG__", "");
}
@Test public void Nocontentconvert() { // simple test; test for flag only; DATE:2014-02-06
gplx.xowa.pages.Xopg_html_data html_data = fxt.Page().Html_data();
gplx.xowa.wikis.pages.Xopg_html_data html_data = fxt.Page().Html_data();
Tfds.Eq(html_data.Lang_convert_content(), true);
Tfds.Eq(html_data.Lang_convert_title(), true);
fxt.Test_parse_page_all_str("__NOCONTENTCONVERT__ __NOTITLECONVERT__", " ");
@@ -140,20 +140,20 @@ public class Xop_under_lxr_tst {
fxt.Init_para_n_();
}
@Test public void Hook_alt() { // PURPOSE: ja wikis use alternate __; DATE:2014-03-04
Xowe_wiki wiki = fxt.Wiki(); Xol_lang lang = wiki.Lang();
Xowe_wiki wiki = fxt.Wiki(); Xol_lang_itm lang = wiki.Lang();
fxt.Init_lang_kwds(lang, Xol_kwd_grp_.Id_toc, true, "__TOC__");
wiki.Parser_mgr().Main().Init_by_lang(lang);
fxt.Test_parse_page_all_str("a__TOC__b", "ab");
}
@Test public void Ascii_ci() { // PURPOSE: case-insensitive ascii; DATE:2014-07-10
Xowe_wiki wiki = fxt.Wiki(); Xol_lang lang = wiki.Lang();
Xowe_wiki wiki = fxt.Wiki(); Xol_lang_itm lang = wiki.Lang();
fxt.Init_lang_kwds(lang, Xol_kwd_grp_.Id_toc, false, "__TOC__");
wiki.Parser_mgr().Main().Init_by_lang(lang);
fxt.Test_parse_page_all_str("a__TOC__b", "ab");
fxt.Test_parse_page_all_str("a__toc__b", "ab");
}
@Test public void Utf8_ci() { // PURPOSE: case-insensitive UTF8; DATE:2014-07-10
Xowe_wiki wiki = fxt.Wiki(); Xol_lang lang = wiki.Lang();
Xowe_wiki wiki = fxt.Wiki(); Xol_lang_itm lang = wiki.Lang();
lang.Case_mgr_u8_();
fxt.Init_lang_kwds(lang, Xol_kwd_grp_.Id_toc, false, "__AÉI__");
wiki.Parser_mgr().Main().Init_by_lang(lang);
@@ -161,21 +161,21 @@ public class Xop_under_lxr_tst {
fxt.Test_parse_page_all_str("a__aéi__b", "ab");
}
@Test public void Utf8_ci_asymmetric() { // PURPOSE: case-insensitive UTF8; asymmetric; DATE:2014-07-10
Xowe_wiki wiki = fxt.Wiki(); Xol_lang lang = wiki.Lang();
Xowe_wiki wiki = fxt.Wiki(); Xol_lang_itm lang = wiki.Lang();
lang.Case_mgr_u8_();
fxt.Init_lang_kwds(lang, Xol_kwd_grp_.Id_toc, false, "__İÇİNDEKİLER__"); // __TOC__ for tr.w
wiki.Parser_mgr().Main().Init_by_lang(lang);
fxt.Test_parse_page_all_str("a__İçindekiler__b", "ab");
}
@Test public void Cs() { // PURPOSE: cs (ascii / utf8 doesn't matter); DATE:2014-07-11
Xowe_wiki wiki = fxt.Wiki(); Xol_lang lang = wiki.Lang();
Xowe_wiki wiki = fxt.Wiki(); Xol_lang_itm lang = wiki.Lang();
fxt.Init_lang_kwds(lang, Xol_kwd_grp_.Id_toc , Bool_.Y, "__TOC__");
wiki.Parser_mgr().Main().Init_by_lang(lang);
fxt.Test_parse_page_all_str("a__TOC__b" , "ab"); // ci.pass
fxt.Test_parse_page_all_str("a__toc__b" , "a__toc__b"); // ci.pass
}
@Test public void Ascii_cs_ci() { // PURPOSE: test simultaneous cs and ci; DATE:2014-07-11
Xowe_wiki wiki = fxt.Wiki(); Xol_lang lang = wiki.Lang();
Xowe_wiki wiki = fxt.Wiki(); Xol_lang_itm lang = wiki.Lang();
fxt.Init_lang_kwds(lang, Xol_kwd_grp_.Id_toc , Bool_.N, "__TOC__");
fxt.Init_lang_kwds(lang, Xol_kwd_grp_.Id_notoc , Bool_.Y, "__NOTOC__");
wiki.Parser_mgr().Main().Init_by_lang(lang);