本文整理汇总了C#中CSAngband.Parser类的典型用法代码示例。如果您正苦于以下问题:C# Parser类的具体用法?C# Parser怎么用?C# Parser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Parser类属于CSAngband命名空间,在下文中一共展示了Parser类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: print_error
/* More angband-specific bits of the parser
* These require hooks into other parts of the code, and are a candidate for
* moving elsewhere.
*/
static void print_error(Parser p)
{
throw new NotImplementedException();
//struct parser_state s;
//parser_getstate(p, &s);
//msg("Parse error in %s line %d column %d: %s: %s", fp.name,
// s.line, s.col, s.msg, parser_error_str[s.error]);
//message_flush();
//quit_fmt("Parse error in %s line %d column %d.", fp.name, s.line, s.col);
}
示例2: init_parse_rb
public static Parser init_parse_rb()
{
Parser p = new Parser();
p.priv = null;
p.Register("V sym version", Parser.Ignored);
p.Register("N str name", parse_rb_n);
p.Register("G char glyph", parse_rb_g);
p.Register("M uint pain", parse_rb_m);
p.Register("F ?str flags", parse_rb_f);
p.Register("S ?str spells", parse_rb_s);
p.Register("D str desc", parse_rb_d);
return p;
}
示例3: store_owner_parser_new
static Parser store_owner_parser_new(Store stores)
{
Parser p = new Parser();
owner_parser_state s = new owner_parser_state();
s.stores = stores;
s.cur = null;
p.priv = s;
p.Register("V sym version", Parser.Ignored);
p.Register("N uint index", parse_own_n);
p.Register("S uint maxcost str name", parse_own_s);
return p;
}
示例4: parse_own_s
static Parser.Error parse_own_s(Parser p)
{
owner_parser_state s = p.priv as owner_parser_state;
uint maxcost = p.getuint("maxcost");
string name = p.getstr("name");
Owner o;
if (s.cur == null)
return Parser.Error.MISSING_RECORD_HEADER;
o = new Owner();
o.oidx = (s.cur.owners != null ? s.cur.owners.oidx + 1 : 0);
o.next = s.cur.owners;
o.name = name;
o.max_cost = (int)maxcost;
s.cur.owners = o;
return Parser.Error.NONE;
}
示例5: parse_i
static Parser.Error parse_i(Parser p)
{
Store s = p.priv as Store;
uint slots = p.getuint("slots");
int tval = TVal.find_idx(p.getsym("tval"));
int sval = SVal.lookup_sval(tval, p.getsym("sval"));
Object_Kind kind = Object_Kind.lookup_kind(tval, sval);
if(kind == null)
return Parser.Error.UNRECOGNISED_SVAL;
if(s.table_num + slots > s.table_size)
return Parser.Error.TOO_MANY_ENTRIES;
while(slots-- != 0) {
s.table[s.table_num++] = kind;
}
/* XXX: get rid of this table_size/table_num/indexing thing. It's
* stupid. Dynamically allocate. */
return Parser.Error.NONE;
}
示例6: parse_c_n
/* Parsing functions for pclass.txt */
public static Parser.Error parse_c_n(Parser p)
{
Player_Class h = p.priv as Player_Class;
Player_Class c = new Player_Class();
c.cidx = p.getuint("index");
c.Name = p.getstr("name");
c.next = h;
p.priv = c;
return Parser.Error.NONE;
}
示例7: parse_c_i
public static Parser.Error parse_c_i(Parser p)
{
Player_Class c = p.priv as Player_Class;
if (c == null)
return Parser.Error.MISSING_RECORD_HEADER;
c.c_mhp = (short)p.getint("mhp");
c.c_exp = (short)p.getint("exp");
c.sense_base = (uint)p.getint("sense-base");
c.sense_div = (ushort)p.getint("sense-div");
return Parser.Error.NONE;
}
示例8: parse_c_e
public static Parser.Error parse_c_e(Parser p)
{
Player_Class c = p.priv as Player_Class;
Start_Item si;
int tval, sval;
if (c == null)
return Parser.Error.MISSING_RECORD_HEADER;
tval = TVal.find_idx(p.getsym("tval"));
if (tval < 0)
return Parser.Error.UNRECOGNISED_TVAL;
sval = SVal.lookup_sval(tval, p.getsym("sval"));
if (sval < 0)
return Parser.Error.UNRECOGNISED_SVAL;
si = new Start_Item();
si.kind = Object_Kind.objkind_get(tval, sval);
si.min = (byte)p.getuint("min");
si.max = (byte)p.getuint("max");
if (si.min > 99 || si.max > 99) {
//mem_free(si.kind);
return Parser.Error.INVALID_ITEM_NUMBER;
}
si.next = c.start_items;
c.start_items = si;
return Parser.Error.NONE;
}
示例9: parse_a_f
public static Parser.Error parse_a_f(Parser p)
{
Artifact a = p.priv as Artifact;
Misc.assert(a != null);
if (!p.hasval("flags"))
return Parser.Error.NONE;
string s = p.getstr("flags");
return grab_flag_helper(s, a.flags);
/*t = strtok(s, " |");
while (t) {
if (grab_flag(a.flags, OF_SIZE, k_info_flags, t))
break;
t = strtok(null, " |");
}
mem_free(s);
return t ? Parser.Error.INVALID_FLAG : Parser.Error.NONE;*/
}
示例10: parse_a_e
public static Parser.Error parse_a_e(Parser p)
{
Artifact a = p.priv as Artifact;
Misc.assert(a != null);
a.effect = grab_one_effect(p.getsym("name"));
a.time = p.getrand("time");
if (a.effect == null)
return Parser.Error.GENERIC;
return Parser.Error.NONE;
}
示例11: parse_a_d
public static Parser.Error parse_a_d(Parser p)
{
Artifact a = p.priv as Artifact;
Misc.assert(a != null);
a.Text = a.Text + p.getstr("text");
return Parser.Error.NONE;
}
示例12: parse_a_a
public static Parser.Error parse_a_a(Parser p)
{
Artifact a = p.priv as Artifact;
string tmp = p.getstr("minmax");
int amin, amax;
Misc.assert(a != null);
a.alloc_prob = (byte)p.getint("common");
string[] tokens = tmp.Split(new string[] { " to " }, StringSplitOptions.RemoveEmptyEntries);
if(tokens.Length != 2)
return Parser.Error.GENERIC;
if(!int.TryParse(tokens[0], out amin) || !int.TryParse(tokens[1], out amax))
return Parser.Error.GENERIC;
if (amin > 255 || amax > 255 || amin < 0 || amax < 0)
return Parser.Error.OUT_OF_BOUNDS;
a.alloc_min = (byte)amin;
a.alloc_max = (byte)amax;
return Parser.Error.NONE;
}
示例13: init_parse_z
public static Parser init_parse_z()
{
Maxima z = new Maxima();
Parser p = new Parser();
p.priv = z;
p.Register("V sym version", Parser.Ignored);
p.Register("M sym label int value", parse_z);
return p;
}
示例14: init_parse_v
public static Parser init_parse_v()
{
Parser p = new Parser();
p.priv = null;
p.Register("V sym version", Parser.Ignored);
p.Register("N uint index str name", parse_v_n);
p.Register("X uint type int rating uint height uint width", parse_v_x);
p.Register("D str text", parse_v_d);
return p;
}
示例15: init_parse_s
public static Parser init_parse_s()
{
Parser p = new Parser();
p.priv = null;
p.Register("V sym version", Parser.Ignored);
p.Register("N uint index str name", parse_s_n);
p.Register("I uint tval uint sval uint snum", parse_s_i);
p.Register("D str desc", parse_s_d);
return p;
}