1
0
mirror of https://github.com/gnosygnu/xowa.git synced 2026-03-02 03:49:30 +00:00
This commit is contained in:
gnosygnu
2015-07-12 21:10:02 -04:00
commit 794b5a232f
3099 changed files with 238212 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
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; import gplx.*;
public class Xop_bry_tkn extends Xop_tkn_itm_base {
public Xop_bry_tkn(int bgn, int end, byte[] val) {this.val = val; this.Tkn_ini_pos(false, bgn, end);}
@Override public byte Tkn_tid() {return Xop_tkn_itm_.Tid_bry;}
public byte[] Val() {return val;} private byte[] val;
@Override public boolean Tmpl_evaluate(Xop_ctx ctx, byte[] src, Xot_invk caller, Bry_bfr bfr) {
bfr.Add(val);
return true;
}
}

View File

@@ -0,0 +1,34 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
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; import gplx.*;
public interface Xop_tkn_grp {
int Subs_len();
Xop_tkn_itm Subs_get(int i);
void Subs_add(Xop_tkn_itm sub);
void Subs_add_grp(Xop_tkn_itm sub, Xop_tkn_grp old_grp, int old_sub_idx);
void Subs_del_after(int pos_bgn);
void Subs_clear();
void Subs_move(Xop_tkn_itm tkn);
int Subs_src_bgn(int sub_idx);
int Subs_src_end(int sub_idx);
void Subs_src_pos_(int sub_idx, int bgn, int end);
Xop_tkn_itm Immutable_clone(Xop_ctx ctx, Xop_tkn_itm tkn, int sub_idx);
}
class Xop_tkn_grp_ {
public static final Xop_tkn_grp Null = null;
}

View File

@@ -0,0 +1,48 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
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; import gplx.*;
public interface Xop_tkn_itm extends Xop_tkn_grp {
byte Tkn_tid();
Xop_tkn_itm Tkn_ini_pos(boolean immutable, int bgn, int end);
Xop_tkn_itm Tkn_clone(Xop_ctx ctx, int bgn, int end);
boolean Tkn_immutable();
Xop_tkn_grp Tkn_grp();
int Src_bgn();
int Src_end();
int Src_bgn_grp(Xop_tkn_grp grp, int sub_idx);
int Src_end_grp(Xop_tkn_grp grp, int sub_idx);
int Tkn_sub_idx();
boolean Ignore();
Xop_tkn_itm Tkn_grp_(Xop_tkn_grp grp, int sub_idx);
void Src_end_(int v);
void Src_end_grp_(Xop_ctx ctx, Xop_tkn_grp grp, int sub_idx, int src_end);
Xop_tkn_itm Ignore_y_();
void Ignore_y_grp_(Xop_ctx ctx, Xop_tkn_grp grp, int sub_idx);
void Clear();
void Tmpl_fmt(Xop_ctx ctx, byte[] src, Xot_fmtr fmtr);
void Tmpl_compile(Xop_ctx ctx, byte[] src, Xot_compile_data prep_data); // SEE:NOTE_1:Tmpl_compile
boolean Tmpl_evaluate(Xop_ctx ctx, byte[] src, Xot_invk caller, Bry_bfr bfr);
}
/*
NOTE_1: Tmpl_compile
- called for tmpl_defn
- identifies tkn as static or dynamic; important for evaluate later; if static, evaluate will simply extract src
- if static, parses prm; EX: {{{1|a}}} will produce member variables of idx=1 and dflt=a
- if static, parses tmpl_name; EX: {{concat|a|b}} will generate name of concat
- if <onlyinclude> mark tmpl accordingly
*/

View File

@@ -0,0 +1,128 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
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; import gplx.*;
public class Xop_tkn_itm_ {
public static final Xop_tkn_itm[] Ary_empty = new Xop_tkn_itm[0];
public static final byte
Tid_null = 0
, Tid_root = 1
, Tid_txt = 2
, Tid_ignore = 3
, Tid_newLine = 4
, Tid_space = 5
, Tid_tab = 6
, Tid_pipe = 7
, Tid_eq = 8
, Tid_colon = 9
, Tid_amp = 10
, Tid_lt = 11
, Tid_gt = 12
, Tid_quot = 13
, Tid_apos = 14
, Tid_html_ref = 15
, Tid_html_ncr = 16
, Tid_lnki_bgn = 17
, Tid_lnki_end = 18
, Tid_lnki = 19
, Tid_lnke = 20
, Tid_hr = 21
, Tid_hdr = 22
, Tid_tblw_tb = 23
, Tid_tblw_te = 24
, Tid_tblw_tr = 25
, Tid_tblw_th = 26
, Tid_tblw_td = 27
, Tid_tblw_tc = 28
, Tid_list = 29
, Tid_xnde = 30
, Tid_xatr = 31
, Tid_tmpl_prm_bgn = 32
, Tid_tmpl_prm_end = 33
, Tid_tmpl_prm = 34
, Tid_tmpl_invk_dat = 35
, Tid_arg_nde = 36
, Tid_arg_itm = 37
, Tid_tmpl_invk = 38
, Tid_tmpl_curly_bgn = 39
, Tid_brack_bgn = 40
, Tid_brack_end = 41
, Tid_para = 42
, Tid_pre = 43
, Tid_bry = 44
, Tid_under = 45
, Tid_tvar = 46
, Tid_vnt = 47
, Tid_vnt_rule = 48
, Tid_vnt_eqgt = 49
, Tid_cr = 50
;
public static final String[] Tid__names
= new String[]
{ "null"
, "root"
, "text"
, "ignore"
, "newLine"
, "space"
, "tab"
, "pipe"
, "eq"
, "colon"
, "amp"
, "lt"
, "gt"
, "quot"
, "apos"
, "htmlRef"
, "htmlNcr"
, "lnki_bgn"
, "lnki_end"
, "lnki"
, "lnke"
, "hr"
, "hdr"
, "tblw_tb"
, "tblw_te"
, "tblw_tr"
, "tblw_th"
, "tblw_td"
, "tblw_tc"
, "list"
, "xnde"
, "xatr"
, "tmpl_prm_bgn"
, "tmpl_prm_end"
, "tmpl_prm"
, "tmpl_invk_dat"
, "arg"
, "arg_itm"
, "tmpl_invk"
, "tmpl_curly_bgn"
, "brack_bgn"
, "brack_end"
, "para"
, "para_pre"
, "bry"
, "under"
, "tvar"
, "vnt"
, "vnt_rule"
, "vnt_eqgt"
, "cr"
};
}

View File

@@ -0,0 +1,166 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
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; import gplx.*;
public abstract class Xop_tkn_itm_base implements Xop_tkn_itm {
public abstract byte Tkn_tid();
public Xop_tkn_grp Tkn_grp() {return grp == null ? this : grp;} private Xop_tkn_grp grp; // NOTE: not sure about this; need to handle null refs when tkns are manipulated but not yet added to a group
public Xop_tkn_itm Tkn_ini_pos(boolean immutable, int bgn, int end) {this.immutable = immutable; this.src_bgn = bgn; this.src_end = end; return this;}
public Xop_tkn_itm Tkn_grp_(Xop_tkn_grp grp, int sub_idx) {this.grp = grp; this.tkn_sub_idx = sub_idx; return this;}
@gplx.Virtual public Xop_tkn_itm Tkn_clone(Xop_ctx ctx, int bgn, int end) {throw Exc_.new_("tkn_clone not implemented", "name", Xop_tkn_itm_.Tid__names[this.Tkn_tid()]);}
public boolean Tkn_immutable() {return immutable;} private boolean immutable;
public int Tkn_sub_idx() {return tkn_sub_idx;} private int tkn_sub_idx = -1;
public int Src_bgn() {return src_bgn;} private int src_bgn = -1;
public int Src_end() {return src_end;} private int src_end = -1;
public void Src_end_(int v) {src_end = v;}
public int Src_bgn_grp(Xop_tkn_grp grp, int sub_idx) {return immutable ? grp.Subs_src_bgn(sub_idx) : src_bgn;}
public int Src_end_grp(Xop_tkn_grp grp, int sub_idx) {return immutable ? grp.Subs_src_end(sub_idx) : src_end;}
public int Subs_src_bgn(int sub_idx) {if (subs_len == 0) throw Exc_.new_("no subs available", "idx", sub_idx); return subs_pos_ary[ sub_idx * 2];}
public int Subs_src_end(int sub_idx) {if (subs_len == 0) throw Exc_.new_("no subs available", "idx", sub_idx); return subs_pos_ary[(sub_idx * 2) + 1];}
public void Subs_src_pos_(int sub_idx, int bgn, int end) {
int pos_idx = sub_idx * 2;
int subs_pos_ary_len = subs_pos_ary.length;
if (pos_idx + 1 > subs_pos_ary_len) {
int[] new_subs_pos_ary = new int[(pos_idx + 1) * 2];
Array_.CopyTo(subs_pos_ary, 0, new_subs_pos_ary, 0, subs_pos_ary.length);
subs_pos_ary = new_subs_pos_ary;
}
subs_pos_ary[pos_idx] = bgn;
subs_pos_ary[pos_idx + 1] = end;
}
public boolean Ignore() {return ignore;} private boolean ignore;
public Xop_tkn_itm Ignore_y_() {
ignore = true;
return this;
}
public int Subs_len() {return subs_len;} private int subs_len;
public Xop_tkn_itm[] Subs() {return subs;}
public Xop_tkn_itm Subs_get(int i) {return subs[i];}
public Xop_tkn_itm Subs_get_or_null(int i) {return i < subs_len ? subs[i] : null;}
public void Subs_add(Xop_tkn_itm sub) {
int new_len = subs_len + 1;
if (new_len > subs_max) { // ary too small >>> expand
subs_max = new_len * 2;
Xop_tkn_itm[] new_subs = new Xop_tkn_itm[subs_max];
Array_.CopyTo(subs, 0, new_subs, 0, subs_len);
subs = new_subs;
}
subs[subs_len] = sub;
sub.Tkn_grp_(this, subs_len);
subs_len = new_len;
} private Xop_tkn_itm[] subs = Xop_tkn_itm_.Ary_empty; int subs_max; int[] subs_pos_ary = Int_.Ary_empty;
public void Subs_add_grp(Xop_tkn_itm sub, Xop_tkn_grp old_grp, int old_sub_idx) {
this.Subs_add(sub);
if (sub.Tkn_immutable())
this.Subs_src_pos_(subs_len - 1, sub.Src_bgn_grp(old_grp, old_sub_idx), sub.Src_end_grp(old_grp, old_sub_idx));
}
public void Subs_del_after(int tkn_sub_idx) {
if (tkn_sub_idx >= subs_len) return; // ignore delete after len; PRUNE: breaks 3 tests;
for (int i = tkn_sub_idx; i < subs_len; i++)
subs[i] = null;
subs_len = tkn_sub_idx;
}
public void Subs_del_between(Xop_ctx ctx, int idx_bgn, int idx_end) {
if (idx_bgn >= subs_len || idx_bgn >= idx_end) return; // ignore invalid bounds; PRUNE: breaks 2 tests
int idx_dif = idx_end - idx_bgn;
for (int trg_idx = idx_bgn; trg_idx < subs_len; trg_idx++) {
int src_idx = trg_idx + idx_dif;
if (src_idx < subs_len) { // trg exists >>> move tkn from src to trg
Xop_tkn_itm src_tkn = subs[src_idx];
subs[trg_idx] = src_tkn;
src_tkn.Tkn_grp_(this, trg_idx);
subs[src_idx] = null;
}
else
subs[trg_idx] = null;
}
subs_len -= idx_dif;
}
public void Subs_clear() {
subs_len = subs_max = 0;
subs = Xop_tkn_itm_.Ary_empty;
subs_pos_ary = Int_.Ary_empty;
}
public void Subs_move(Xop_tkn_itm tkn) {
int nxt_idx = tkn_sub_idx + 1, len = tkn.Subs_len();
for (int i = nxt_idx; i < len; i++) {
Xop_tkn_itm sub = tkn.Subs_get(i);
Subs_add_grp(sub, tkn, i);
}
tkn.Subs_del_after(nxt_idx);
}
public void Subs_move(Xop_tkn_itm owner, int sub_idx, int subs_len) {
for (int i = sub_idx; i < subs_len; i++) {
Xop_tkn_itm sub = owner.Subs_get(i);
this.Subs_add(sub);
}
owner.Subs_del_after(sub_idx);
}
public Xop_tkn_itm Immutable_clone(Xop_ctx ctx, Xop_tkn_itm tkn, int sub_idx) {
int pos_idx = sub_idx * 2;
Xop_tkn_itm rv = tkn.Tkn_clone(ctx, subs_pos_ary[pos_idx], subs_pos_ary[pos_idx + 1]);
subs[sub_idx] = rv;
rv.Tkn_grp_(this, sub_idx);
return rv;
}
public void Src_end_grp_(Xop_ctx ctx, Xop_tkn_grp grp, int sub_idx, int src_end) {
Xop_tkn_itm tkn = this;
if (immutable) tkn = grp.Immutable_clone(ctx, this, sub_idx);
tkn.Src_end_(src_end);
subs_pos_ary[(sub_idx * 2) + 1] = src_end;
}
public void Ignore_y_grp_(Xop_ctx ctx, Xop_tkn_grp grp, int sub_idx) {
Xop_tkn_itm tkn = this;
if (immutable) tkn = grp.Immutable_clone(ctx, this, sub_idx);
tkn.Ignore_y_();
}
public void Subs_grp_(Xop_ctx ctx, Xop_tkn_itm tkn, Xop_tkn_grp grp, int sub_idx) {
// if (tkn.Tkn_immutable()) tkn = Subs_immutable_clone(ctx, tkn);
// tkn.Tkn_grp_(grp, sub_idx);
}
@gplx.Virtual public void Reset() {
src_bgn = src_end = tkn_sub_idx = -1; ignore = false; tmpl_static = false;
if (subs.length > Tkn_subs_max) {
subs = new Xop_tkn_itm[Tkn_subs_max];
subs_max = Tkn_subs_max;
subs_pos_ary = new int[(Tkn_subs_max + 1) * 2];
}
else {
for (int i = 0; i < subs_len; i++)
subs[i] = null;
}
subs_len = 0;
}
public void Clear() {
src_bgn = src_end = tkn_sub_idx = -1; ignore = false; tmpl_static = false;
Subs_clear();
}
@gplx.Virtual public void Tmpl_fmt(Xop_ctx ctx, byte[] src, Xot_fmtr fmtr) {fmtr.Reg_ary(ctx, src, tmpl_static, src_bgn, src_end, subs_len, subs);}
@gplx.Virtual public void Tmpl_compile(Xop_ctx ctx, byte[] src, Xot_compile_data prep_data) {
if (!ignore) tmpl_static = true;
for (int i = 0; i < subs_len; i++)
subs[i].Tmpl_compile(ctx, src, prep_data);
} boolean tmpl_static = false;
@gplx.Virtual public boolean Tmpl_evaluate(Xop_ctx ctx, byte[] src, Xot_invk caller, Bry_bfr bfr) {
if (tmpl_static) bfr.Add_mid(src, src_bgn, src_end);
for (int i = 0; i < subs_len; i++)
subs[i].Tmpl_evaluate(ctx, src, caller, bfr);
return true;
}
static final String GRP_KEY = "xowa.tkn_base";
public static final int Tkn_subs_max = 16;
}

View File

@@ -0,0 +1,171 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
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; import gplx.*;
import gplx.xowa.parsers.apos.*; import gplx.xowa.parsers.amps.*; import gplx.xowa.parsers.lnkes.*; import gplx.xowa.parsers.hdrs.*; import gplx.xowa.parsers.lists.*; import gplx.xowa.xtns.cite.*; import gplx.xowa.parsers.tblws.*; import gplx.xowa.parsers.paras.*;
public class Xop_tkn_mkr {
Xop_space_tkn space_tkn_immutable = new Xop_space_tkn(true, -1, -1);
public Xop_root_tkn Root(byte[] raw) {return new Xop_root_tkn().Root_src_(raw);}
public Xop_txt_tkn Txt(int bgn, int end) {return new Xop_txt_tkn(bgn, end);}
// public Xop_space_tkn Space(Xop_tkn_grp grp, int bgn, int end) {grp.Subs_src_pos_(grp.Subs_len(), bgn, end); return space_tkn_immutable;}
public Xop_space_tkn Space(Xop_tkn_grp grp, int bgn, int end) {Xop_space_tkn rv = new Xop_space_tkn(false, bgn, end); grp.Subs_src_pos_(grp.Subs_len(), bgn, end); return rv;}
public Xop_space_tkn Space_mutable(int bgn, int end) {return new Xop_space_tkn(false, bgn, end);}
public Xop_apos_tkn Apos(int bgn, int end
, int aposLen, int typ, int cmd, int lit_apos) {return new Xop_apos_tkn(bgn, end, aposLen, typ, cmd, lit_apos);}
public Xop_tkn_itm Amp_txt(int bgn, int end, Xop_amp_trie_itm itm) {return new Xop_amp_tkn_txt(bgn, end, itm);}
public Xop_tkn_itm Amp_num(int bgn, int end, int val_int, byte[] val_bry) {return new Xop_amp_tkn_num(bgn, end, val_int, val_bry);}
public Xop_tkn_itm Amp_num(int bgn, int end, int val_int) {return new Xop_amp_tkn_num(bgn, end, val_int, gplx.intl.Utf16_.Encode_int_to_bry(val_int));}
public Xop_nl_tkn NewLine(int bgn, int end, byte nl_typ, int nl_len) {return new Xop_nl_tkn(bgn, end, nl_typ, nl_len);}
public Xop_lnki_tkn Lnki(int bgn, int end) {return (Xop_lnki_tkn)new Xop_lnki_tkn().Tkn_ini_pos(false, bgn, end);}
public Xop_list_tkn List_bgn(int bgn, int end, byte listType, int symLen) {return Xop_list_tkn.bgn_(bgn, end, listType, symLen);}
public Xop_list_tkn List_end(int pos, byte listType) {return Xop_list_tkn.end_(pos, listType);}
public Xop_tkn_itm Pipe(int bgn, int end) {return new Xop_pipe_tkn(bgn, end);}
public Xop_tkn_itm Colon(int bgn, int end) {return new Xop_colon_tkn(bgn, end);}
public Xop_eq_tkn Eq(int bgn, int end) {return new Xop_eq_tkn(bgn, end, end - bgn);}
public Xop_eq_tkn Eq(int bgn, int end, int eq_len) {return new Xop_eq_tkn(bgn, end, eq_len);}
public Xot_invk_tkn Tmpl_invk(int bgn, int end) {return new Xot_invk_tkn(bgn, end);}
public Arg_nde_tkn ArgNde(int arg_idx, int bgn) {return new Arg_nde_tkn(arg_idx, bgn);}
public Arg_itm_tkn ArgItm(int bgn, int end) {return new Arg_itm_tkn_base(bgn, end);}
public Xop_xnde_tkn Xnde(int bgn, int end) {return (Xop_xnde_tkn)Xop_xnde_tkn.new_().Tkn_ini_pos(false, bgn, end);}
public Xop_hdr_tkn Hdr(int bgn, int end, int hdr_len) {return new Xop_hdr_tkn(bgn, end, hdr_len);}
public Xop_hr_tkn Hr(int bgn, int end, int hr_len) {return new Xop_hr_tkn(bgn, end, hr_len);}
public Xop_tab_tkn Tab(int bgn, int end) {return new Xop_tab_tkn(bgn, end);}
public Xop_curly_bgn_tkn Tmpl_curly_bgn(int bgn, int end) {return new Xop_curly_bgn_tkn(bgn, end);}
public Xop_tkn_itm Brack_bgn(int bgn, int end) {return new Xop_brack_bgn_tkn(bgn, end);}
public Xop_tkn_itm Brack_end(int bgn, int end) {return new Xop_brack_end_tkn(bgn, end);}
public Xop_lnke_tkn Lnke(int bgn, int end, byte[] protocol, byte proto_tid, byte lnke_typ, int lnk_bgn, int lnk_end) {
return new Xop_lnke_tkn(bgn, end, protocol, proto_tid, lnke_typ, lnk_bgn, lnk_end);
}
public Xop_tblw_tb_tkn Tblw_tb(int bgn, int end, boolean tblw_xml, boolean auto_created) {return new Xop_tblw_tb_tkn(bgn, end, tblw_xml, auto_created);}
public Xop_tblw_tr_tkn Tblw_tr(int bgn, int end, boolean tblw_xml, boolean auto_created) {return new Xop_tblw_tr_tkn(bgn, end, tblw_xml, auto_created);}
public Xop_tblw_td_tkn Tblw_td(int bgn, int end, boolean tblw_xml) {return new Xop_tblw_td_tkn(bgn, end, tblw_xml);}
public Xop_tblw_th_tkn Tblw_th(int bgn, int end, boolean tblw_xml) {return new Xop_tblw_th_tkn(bgn, end, tblw_xml);}
public Xop_tblw_tc_tkn Tblw_tc(int bgn, int end, boolean tblw_xml) {return new Xop_tblw_tc_tkn(bgn, end, tblw_xml);}
public Xot_prm_tkn Tmpl_prm(int bgn, int end) {return new Xot_prm_tkn(bgn, end);}
public Xop_para_tkn Para(int pos) {return new Xop_para_tkn(pos);}
public Xop_pre_tkn Para_pre_bgn(int pos) {return new Xop_pre_tkn(pos, pos, Xop_pre_tkn.Pre_tid_bgn, null);}
public Xop_pre_tkn Para_pre_end(int pos, Xop_tkn_itm bgn) {return new Xop_pre_tkn(pos, pos, Xop_pre_tkn.Pre_tid_end, bgn);}
public Xop_ignore_tkn Ignore(int bgn, int end, byte ignore_type) {return new Xop_ignore_tkn(bgn, end, ignore_type);}
public Xop_bry_tkn Bry_raw(int bgn, int end, byte[] bry) {return new Xop_bry_tkn(bgn, end, bry);}
public Xop_bry_tkn Bry_mid(byte[] src, int bgn, int end) {return new Xop_bry_tkn(bgn, end, Bry_.Mid(src, bgn, end));}
public Xop_under_tkn Under(int bgn, int end, int v) {return new Xop_under_tkn(bgn, end, v);}
public gplx.xowa.xtns.xowa_cmds.Xop_xowa_cmd Xnde_xowa_cmd() {return new gplx.xowa.xtns.xowa_cmds.Xop_xowa_cmd();}
public gplx.xowa.xtns.poems.Poem_nde Xnde_poem() {return new gplx.xowa.xtns.poems.Poem_nde();}
public Ref_nde Xnde_ref() {return new Ref_nde();}
public References_nde Xnde_references() {return new References_nde();}
public gplx.xowa.xtns.math.Math_nde Xnde_math() {return new gplx.xowa.xtns.math.Math_nde();}
public gplx.xowa.xtns.gallery.Gallery_xnde Xnde_gallery() {return new gplx.xowa.xtns.gallery.Gallery_xnde();}
public gplx.xowa.xtns.imaps.Imap_xnde Xnde_imageMap() {return new gplx.xowa.xtns.imaps.Imap_xnde();}
public gplx.xowa.xtns.hieros.Hiero_xnde Xnde_hiero() {return new gplx.xowa.xtns.hieros.Hiero_xnde();}
public gplx.xowa.xtns.proofreadPage.Pp_pages_nde Xnde_pages() {return new gplx.xowa.xtns.proofreadPage.Pp_pages_nde();}
public gplx.xowa.xtns.proofreadPage.Pp_pagelist_nde Xnde_pagelist() {return new gplx.xowa.xtns.proofreadPage.Pp_pagelist_nde();}
public gplx.xowa.xtns.proofreadPage.Pp_pagequality_nde Xnde_pagequality() {return new gplx.xowa.xtns.proofreadPage.Pp_pagequality_nde();}
public gplx.xowa.xtns.lst.Lst_section_nde Xnde_section() {return new gplx.xowa.xtns.lst.Lst_section_nde();}
public gplx.xowa.xtns.categoryList.Xtn_categorylist_nde Xnde_categoryList() {return new gplx.xowa.xtns.categoryList.Xtn_categorylist_nde();}
public gplx.xowa.xtns.dynamicPageList.Dpl_xnde Xnde_dynamicPageList() {return new gplx.xowa.xtns.dynamicPageList.Dpl_xnde();}
public gplx.xowa.xtns.syntaxHighlight.Xtn_syntaxHighlight_nde Xnde_syntaxHighlight() {return new gplx.xowa.xtns.syntaxHighlight.Xtn_syntaxHighlight_nde();}
public gplx.xowa.xtns.templateData.Xtn_templateData_nde Xnde_templateData() {return new gplx.xowa.xtns.templateData.Xtn_templateData_nde();}
public gplx.xowa.xtns.rss.Rss_xnde Xnde_rss() {return new gplx.xowa.xtns.rss.Rss_xnde();}
public gplx.xowa.xtns.quiz.Quiz_xnde Xnde_quiz() {return new gplx.xowa.xtns.quiz.Quiz_xnde();}
public gplx.xowa.xtns.indicators.Indicator_xnde Xnde_indicator() {return new gplx.xowa.xtns.indicators.Indicator_xnde();}
public gplx.xowa.xtns.xowa_cmds.Xox_xowa_html_cmd Xnde_xowa_html() {return new gplx.xowa.xtns.xowa_cmds.Xox_xowa_html_cmd();}
public gplx.xowa.xtns.listings.Listing_xnde Xnde_listing(int tag_id) {return new gplx.xowa.xtns.listings.Listing_xnde(tag_id);}
public gplx.xowa.xtns.scores.Score_xnde Xnde_score() {return new gplx.xowa.xtns.scores.Score_xnde();}
public gplx.xowa.xtns.inputBox.Xtn_inputbox_nde Xnde_inputbox() {return new gplx.xowa.xtns.inputBox.Xtn_inputbox_nde();}
public gplx.xowa.xtns.translates.Xop_translate_xnde Xnde_translate() {return new gplx.xowa.xtns.translates.Xop_translate_xnde();}
public gplx.xowa.xtns.translates.Xop_languages_xnde Xnde_languages() {return new gplx.xowa.xtns.translates.Xop_languages_xnde();}
public gplx.xowa.xtns.translates.Xop_tvar_tkn Tvar(int tkn_bgn, int tkn_end, int key_bgn, int key_end, int txt_bgn, int txt_end, byte[] wikitext)
{return new gplx.xowa.xtns.translates.Xop_tvar_tkn(tkn_bgn, tkn_end, key_bgn, key_end, txt_bgn, txt_end, wikitext);}
public gplx.xowa.langs.vnts.Xop_vnt_tkn Vnt(int bgn_lhs, int bgn_rhs) {return new gplx.xowa.langs.vnts.Xop_vnt_tkn(bgn_lhs, bgn_rhs);}
public gplx.xowa.langs.vnts.Xop_vnt_eqgt_tkn Vnt_eqgt(int bgn, int end) {return new gplx.xowa.langs.vnts.Xop_vnt_eqgt_tkn(bgn, end);}
// public void Clear() {
// space_tkns_len = txt_tkns_len = 0;
// }
// public Xop_txt_tkn Txt(int bgn, int end) {
// Xop_txt_tkn rv = null;
// if (txt_tkns_len < txt_tkns_max) {
// rv = txt_tkns[txt_tkns_len];
// if (rv == null) {
// rv = new Xop_txt_tkn(bgn, end);
// txt_tkns[txt_tkns_len] = rv;
// }
// else {
// rv.Reset();
// rv.Src_rng_(bgn, end);
// }
// txt_tkns_len++;
// }
// else {
// rv = new Xop_txt_tkn(bgn, end);
// Txt_tkns_add(rv);
// }
// return rv;
//// return new Xop_txt_tkn(bgn, end);
// }
// public Xop_space_tkn Space(int bgn, int end) {
// Xop_space_tkn rv = null;
// if (space_tkns_len < space_tkns_max) {
// rv = space_tkns[space_tkns_len];
// if (rv == null) {
// rv = new Xop_space_tkn(bgn, end);
// space_tkns[space_tkns_len] = rv;
// }
// else {
// rv.Reset();
// rv.Src_rng_(bgn, end);
// }
// space_tkns_len++;
// }
// else {
// rv = new Xop_space_tkn(bgn, end);
// Space_tkns_add(rv);
// }
// return rv;
//// return new Xop_space_tkn(bgn, end);
// }
// private void Txt_tkns_add(Xop_txt_tkn sub) {
// int new_len = txt_tkns_len + 1;
// if (new_len > txt_tkns_max) {
// txt_tkns_max = new_len * 2;
// txt_tkns = Resize(txt_tkns, txt_tkns_len, txt_tkns_max);
// }
// txt_tkns[txt_tkns_len] = sub;
// txt_tkns_len = new_len;
// } private Xop_txt_tkn[] txt_tkns = new Xop_txt_tkn[0]; int txt_tkns_len, txt_tkns_max;
// Xop_txt_tkn[] Resize(Xop_txt_tkn[] src, int cur_len, int new_len) {
// Xop_txt_tkn[] rv = new Xop_txt_tkn[new_len];
// for (int i = 0; i < cur_len; i++)
// rv[i] = src[i];
// return rv;
// }
// private void Space_tkns_add(Xop_space_tkn sub) {
// int new_len = space_tkns_len + 1;
// if (new_len > space_tkns_max) {
// space_tkns_max = new_len * 2;
// space_tkns = Resize(space_tkns, space_tkns_len, space_tkns_max);
// }
// space_tkns[space_tkns_len] = sub;
// space_tkns_len = new_len;
// } private Xop_space_tkn[] space_tkns = new Xop_space_tkn[0]; int space_tkns_len, space_tkns_max;
// Xop_space_tkn[] Resize(Xop_space_tkn[] src, int cur_len, int new_len) {
// Xop_space_tkn[] rv = new Xop_space_tkn[new_len];
// for (int i = 0; i < cur_len; i++)
// rv[i] = src[i];
// return rv;
// }
}

View File

@@ -0,0 +1,52 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
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; import gplx.*;
public class Xop_tkn_null implements Xop_tkn_itm {
public byte Tkn_tid() {return Xop_tkn_itm_.Tid_null;}
public boolean Tkn_immutable() {return true;}
public Xop_tkn_grp Tkn_grp() {return Xop_tkn_grp_.Null;}
public Xop_tkn_itm Tkn_ini_pos(boolean immutable, int bgn, int end) {return this;}
public Xop_tkn_itm Tkn_grp_(Xop_tkn_grp grp, int sub_idx) {return this;}
public Xop_tkn_itm Tkn_clone(Xop_ctx ctx, int bgn, int end) {return this;}
public int Tkn_sub_idx() {return -1;}
public int Src_bgn() {return -1;}
public int Src_end() {return -1;}
public int Src_bgn_grp(Xop_tkn_grp grp, int sub_idx) {return -1;}
public int Src_end_grp(Xop_tkn_grp grp, int sub_idx) {return -1;}
public int Subs_src_bgn(int sub_idx) {return -1;}
public int Subs_src_end(int sub_idx) {return -1;}
public void Src_end_(int v) {}
public void Src_end_grp_(Xop_ctx ctx, Xop_tkn_grp grp, int sub_idx, int src_end) {}
public boolean Ignore() {return false;} public Xop_tkn_itm Ignore_y_() {return this;}
public int Subs_len() {return 0;}
public Xop_tkn_itm Subs_get(int i) {return null;}
public void Subs_add(Xop_tkn_itm sub) {}
public void Subs_add_grp(Xop_tkn_itm sub, Xop_tkn_grp old_grp, int old_sub_idx) {}
public void Subs_del_after(int pos_bgn) {}
public void Subs_clear() {}
public void Subs_move(Xop_tkn_itm tkn) {}
public Xop_tkn_itm Immutable_clone(Xop_ctx ctx, Xop_tkn_itm tkn, int sub_idx) {return this;}
public void Ignore_y_grp_(Xop_ctx ctx, Xop_tkn_grp grp, int sub_idx) {}
public void Subs_grp_(Xop_ctx ctx, Xop_tkn_itm tkn, Xop_tkn_grp grp, int sub_idx) {}
public void Subs_src_pos_(int sub_idx, int bgn, int end) {}
public void Clear() {}
public void Tmpl_fmt(Xop_ctx ctx, byte[] src, Xot_fmtr fmtr) {}
public void Tmpl_compile(Xop_ctx ctx, byte[] src, Xot_compile_data prep_data) {}
public boolean Tmpl_evaluate(Xop_ctx ctx, byte[] src, Xot_invk caller, Bry_bfr bfr) {return true;}
public static final Xop_tkn_null Null_tkn = new Xop_tkn_null();
}

View File

@@ -0,0 +1,34 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
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; import gplx.*;
public class Xop_txt_tkn extends Xop_tkn_itm_base {
public Xop_txt_tkn(int bgn, int end) {this.Tkn_ini_pos(false, bgn, end);}
@Override public byte Tkn_tid() {return Xop_tkn_itm_.Tid_txt;}
}
class Xop_colon_tkn extends Xop_tkn_itm_base {
public Xop_colon_tkn(int bgn, int end) {this.Tkn_ini_pos(false, bgn, end);}
@Override public byte Tkn_tid() {return Xop_tkn_itm_.Tid_colon;}
}
class Xop_brack_bgn_tkn extends Xop_tkn_itm_base {
public Xop_brack_bgn_tkn(int bgn, int end) {this.Tkn_ini_pos(false, bgn, end);}
@Override public byte Tkn_tid() {return Xop_tkn_itm_.Tid_brack_bgn;}
}
class Xop_brack_end_tkn extends Xop_tkn_itm_base {
public Xop_brack_end_tkn(int bgn, int end) {this.Tkn_ini_pos(false, bgn, end);}
@Override public byte Tkn_tid() {return Xop_tkn_itm_.Tid_brack_end;}
}