You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gnosygnu_xowa/110_gfml/src_400_pragma/gplx/gfml/GfmlVarTkn.java

40 lines
1.7 KiB

9 years ago
/*
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.gfml; import gplx.*;
class GfmlVarTkn implements GfmlTkn {
public int ObjType() {return GfmlObj_.Type_tkn;}
public String Key() {return key;} private String key;
public String Raw() {return GfmlTknAry_.XtoRaw(ary);}
public String Val() {
String s = ctx.Fetch_Val(varKey); if (s == null) return val;
val = s;
return val;
} String val;
public GfmlBldrCmd Cmd_of_Tkn() {return GfmlBldrCmd_.Null;}
public GfmlTkn[] SubTkns() {return ary;} GfmlTkn[] ary;
9 years ago
public GfmlTkn MakeNew(String rawNew, String valNew) {throw Err_.new_invalid_op("makeNew cannot make copy of token with only raw").Args_add("key", key, "rawNew", rawNew, "valNew", valNew);}
9 years ago
public String TknType() {return "evalTkn";}
GfmlVarCtx ctx; String varKey;
@gplx.Internal protected GfmlVarTkn(String key, GfmlTkn[] ary, GfmlVarCtx ctx, String varKey) {
this.key = key; this.ary = ary;
this.ctx = ctx; this.varKey = varKey;
this.val = ctx.Fetch_Val(varKey);
}
}