Angband
Data Structures | Enumerations | Functions
parser.c File Reference

Info file parser. More...

#include "init.h"
#include "game-event.h"
#include "message.h"
#include "mon-util.h"
#include "parser.h"
#include "z-file.h"
#include "z-form.h"
#include "z-util.h"
#include "z-virt.h"

Data Structures

struct  parser_spec
 
struct  parser_value
 
struct  parser_hook
 
struct  parser
 

Enumerations

enum  {
  PARSE_T_NONE = 0, PARSE_T_INT = 2, PARSE_T_SYM = 4, PARSE_T_STR = 6,
  PARSE_T_RAND = 8, PARSE_T_UINT = 10, PARSE_T_CHAR = 12, PARSE_T_OPT = 0x00000001
}
 A parser has a list of hooks (which are run across new lines given to parser_parse()) and a list of the set of named values for the current line. More...
 

Functions

struct parserparser_new (void)
 Allocates a new parser. More...
 
static struct parser_hookfindhook (struct parser *p, const char *dir)
 
static void parser_freeold (struct parser *p)
 
static bool parse_random (const char *str, random_value *bonus)
 
enum parser_error parser_parse (struct parser *p, const char *line)
 Parses the provided line. More...
 
voidparser_priv (struct parser *p)
 Gets parser's private data. More...
 
void parser_setpriv (struct parser *p, void *v)
 Sets parser's private data. More...
 
static int parse_type (const char *s)
 
static void clean_specs (struct parser_hook *h)
 
void parser_destroy (struct parser *p)
 Destroys a parser. More...
 
static errr parse_specs (struct parser_hook *h, char *fmt)
 
errr parser_reg (struct parser *p, const char *fmt, enum parser_error(*func)(struct parser *p))
 Registers a parser hook. More...
 
enum parser_error ignored (struct parser *p)
 A placeholder parse hook indicating a value is ignored. More...
 
bool parser_hasval (struct parser *p, const char *name)
 Returns whether the parser has a value named name. More...
 
static struct parser_valueparser_getval (struct parser *p, const char *name)
 
const char * parser_getsym (struct parser *p, const char *name)
 Returns the symbol named name. More...
 
int parser_getint (struct parser *p, const char *name)
 Returns the integer named name. More...
 
unsigned int parser_getuint (struct parser *p, const char *name)
 Returns the unsigned integer named name. More...
 
const char * parser_getstr (struct parser *p, const char *name)
 Returns the string named name. More...
 
struct random parser_getrand (struct parser *p, const char *name)
 Returns the random value named name. More...
 
wchar_t parser_getchar (struct parser *p, const char *name)
 Returns the character named name. More...
 
int parser_getstate (struct parser *p, struct parser_state *s)
 Fills the provided struct with the parser's state, if any. More...
 
void parser_setstate (struct parser *p, unsigned int col, const char *msg)
 Sets the parser's detailed error description and field number. More...
 

Detailed Description

Info file parser.

Copyright (c) 2011 elly+.nosp@m.angb.nosp@m.and@l.nosp@m.epto.nosp@m.quark.nosp@m..net

This work is free software; you can redistribute it and/or modify it under the terms of either:

a) the GNU General Public License as published by the Free Software Foundation, version 2, or

b) the "Angband licence": This software may be copied and distributed for educational, research, and not for profit purposes provided that this copyright and statement are included in all such copies. Other copyrights may also apply.

Enumeration Type Documentation

anonymous enum

A parser has a list of hooks (which are run across new lines given to parser_parse()) and a list of the set of named values for the current line.

Each hook has a list of specs, which are essentially named formal parameters; when we run a particular hook across a line, each spec in the hook is assigned a value.

Enumerator
PARSE_T_NONE 
PARSE_T_INT 
PARSE_T_SYM 
PARSE_T_STR 
PARSE_T_RAND 
PARSE_T_UINT 
PARSE_T_CHAR 
PARSE_T_OPT 

Function Documentation

static void clean_specs ( struct parser_hook h)
static
static struct parser_hook* findhook ( struct parser p,
const char *  dir 
)
static
enum parser_error ignored ( struct parser p)
static bool parse_random ( const char *  str,
random_value bonus 
)
static
static errr parse_specs ( struct parser_hook h,
char *  fmt 
)
static
static int parse_type ( const char *  s)
static
void parser_destroy ( struct parser p)
static void parser_freeold ( struct parser p)
static
wchar_t parser_getchar ( struct parser p,
const char *  name 
)
int parser_getint ( struct parser p,
const char *  name 
)

Returns the integer named name.

This symbol must exist.

References parser_value::ival, PARSE_T_INT, PARSE_T_OPT, parser_getval(), parser_value::spec, parser_spec::type, and parser_value::u.

Referenced by grab_effect_data(), helper_char1(), helper_int0(), helper_int1(), parse_act_param(), parse_artifact_alloc(), parse_artifact_curse(), parse_artifact_info(), parse_artifact_power(), parse_class_attack(), parse_class_info(), parse_class_param(), parse_class_skill_device(), parse_class_skill_dig(), parse_class_skill_disarm_magic(), parse_class_skill_disarm_phys(), parse_class_skill_melee(), parse_class_skill_save(), parse_class_skill_search(), parse_class_skill_shoot(), parse_class_skill_stealth(), parse_class_skill_throw(), parse_class_spell(), parse_class_stats(), parse_constants_carry_cap(), parse_constants_dun_gen(), parse_constants_level_max(), parse_constants_mon_gen(), parse_constants_mon_play(), parse_constants_obj_make(), parse_constants_player(), parse_constants_store(), parse_constants_world(), parse_curse_combat(), parse_curse_param(), parse_eff_eval(), parse_eff_power(), parse_ego_alloc(), parse_ego_curse(), parse_ego_info(), parse_ego_min(), parse_feat_info(), parse_history_chart(), parse_lore_blow(), parse_lore_counts(), parse_mon_spell_effect(), parse_mon_spell_param(), parse_monster_info(), parse_monster_power(), parse_monster_spell_freq(), parse_names_section(), parse_object_alloc(), parse_object_base_break(), parse_object_base_defaults(), parse_object_combat(), parse_object_curse(), parse_object_param(), parse_object_pile(), parse_object_power(), parse_object_properties(), parse_object_property_mult(), parse_object_property_power(), parse_object_property_type_mult(), parse_p_race_height(), parse_p_race_history(), parse_p_race_info(), parse_p_race_skill_device(), parse_p_race_skill_dig(), parse_p_race_skill_disarm_magic(), parse_p_race_skill_disarm_phys(), parse_p_race_skill_melee(), parse_p_race_skill_save(), parse_p_race_skill_search(), parse_p_race_skill_shoot(), parse_p_race_skill_stealth(), parse_p_race_skill_throw(), parse_p_race_stats(), parse_p_race_weight(), parse_prefs_color(), parse_prefs_feat(), parse_prefs_flavor(), parse_prefs_keymap_input(), parse_prefs_monster(), parse_prefs_monster_base(), parse_prefs_object(), parse_prefs_trap(), parse_prefs_window(), parse_profile_cutoff(), parse_profile_params(), parse_profile_room(), parse_profile_streamer(), parse_profile_tunnel(), parse_room_rating(), parse_trap_param(), parse_trap_param_xtra(), and parse_vault_rating().

struct random parser_getrand ( struct parser p,
const char *  name 
)
int parser_getstate ( struct parser p,
struct parser_state s 
)

Fills the provided struct with the parser's state, if any.

Returns true if the parser is in an error state, and false otherwise.

References parser_state::col, parser::colno, parser::errmsg, parser_state::error, parser::error, parser_state::line, parser::lineno, and parser_state::msg.

Referenced by print_error(), test_syntax0(), test_syntax1(), and test_syntax2().

const char* parser_getstr ( struct parser p,
const char *  name 
)

Returns the string named name.

This symbol must exist.

References PARSE_T_OPT, PARSE_T_STR, parser_getval(), parser_value::spec, parser_value::sval, parser_spec::type, and parser_value::u.

Referenced by helper_char1(), helper_str0(), parse_act_desc(), parse_act_dice(), parse_act_expr(), parse_act_msg(), parse_act_name(), parse_artifact_act(), parse_artifact_alloc(), parse_artifact_brand(), parse_artifact_desc(), parse_artifact_flags(), parse_artifact_msg(), parse_artifact_name(), parse_artifact_slay(), parse_artifact_values(), parse_body_body(), parse_brand_code(), parse_brand_name(), parse_brand_verb(), parse_buy(), parse_buy_flag(), parse_class_desc(), parse_class_dice(), parse_class_expr(), parse_class_flags(), parse_class_name(), parse_class_realm(), parse_class_title(), parse_curse_conflict(), parse_curse_desc(), parse_curse_dice(), parse_curse_expr(), parse_curse_flags(), parse_curse_msg(), parse_curse_name(), parse_curse_values(), parse_eff_desc(), parse_eff_effect_type(), parse_eff_name(), parse_eff_resist(), parse_ego_alloc(), parse_ego_brand(), parse_ego_desc(), parse_ego_dice(), parse_ego_flags(), parse_ego_flags_off(), parse_ego_min_val(), parse_ego_name(), parse_ego_slay(), parse_ego_values(), parse_feat_desc(), parse_feat_flags(), parse_feat_mimic(), parse_feat_name(), parse_flavor_flavor(), parse_graf_name(), parse_graf_pref(), parse_graf_size(), parse_hint(), parse_history_phrase(), parse_lore_drop_artifact(), parse_lore_flags(), parse_lore_friends(), parse_lore_friends_base(), parse_lore_name(), parse_lore_spells(), parse_meth_act_msg(), parse_meth_desc(), parse_meth_message_type(), parse_meth_name(), parse_mon_base_desc(), parse_mon_base_flags(), parse_mon_base_name(), parse_mon_base_spells(), parse_mon_spell_blind_message(), parse_mon_spell_dice(), parse_mon_spell_expr(), parse_mon_spell_lore_desc(), parse_mon_spell_message(), parse_mon_spell_miss_message(), parse_mon_spell_name(), parse_mon_spell_save_message(), parse_monster_desc(), parse_monster_drop_artifact(), parse_monster_flags(), parse_monster_flags_off(), parse_monster_friends(), parse_monster_friends_base(), parse_monster_name(), parse_monster_plural(), parse_monster_spells(), parse_names_word(), parse_object_alloc(), parse_object_base_flags(), parse_object_base_name(), parse_object_brand(), parse_object_desc(), parse_object_dice(), parse_object_expr(), parse_object_flags(), parse_object_msg(), parse_object_name(), parse_object_power_apply_to(), parse_object_power_dice(), parse_object_power_expr(), parse_object_power_iterate(), parse_object_power_name(), parse_object_power_operation(), parse_object_property_adjective(), parse_object_property_code(), parse_object_property_desc(), parse_object_property_id_type(), parse_object_property_msg(), parse_object_property_name(), parse_object_property_neg_adj(), parse_object_property_subtype(), parse_object_property_type(), parse_object_slay(), parse_object_values(), parse_owner(), parse_p_race_name(), parse_p_race_obj_flags(), parse_p_race_play_flags(), parse_p_race_values(), parse_pain_message(), parse_pit_flags_ban(), parse_pit_flags_req(), parse_pit_name(), parse_pit_spell_ban(), parse_pit_spell_req(), parse_player_timed_begin_message(), parse_player_timed_decrease_message(), parse_player_timed_desc(), parse_player_timed_end_message(), parse_player_timed_fail(), parse_player_timed_increase_message(), parse_player_timed_name(), parse_prefs_expr(), parse_prefs_inscribe(), parse_prefs_keymap_action(), parse_prefs_keymap_input(), parse_prefs_load(), parse_prefs_sound(), parse_profile_name(), parse_projection_blind_desc(), parse_projection_code(), parse_projection_desc(), parse_projection_name(), parse_projection_player_desc(), parse_projection_type(), parse_quest_name(), parse_quest_race(), parse_realm_book_noun(), parse_realm_name(), parse_realm_spell_noun(), parse_realm_verb(), parse_room_d(), parse_room_name(), parse_slay_code(), parse_slay_melee_verb(), parse_slay_name(), parse_slay_range_verb(), parse_store(), parse_trap_desc(), parse_trap_dice(), parse_trap_dice_xtra(), parse_trap_expr(), parse_trap_expr_xtra(), parse_trap_flags(), parse_trap_msg(), parse_trap_msg_bad(), parse_trap_msg_good(), parse_trap_msg_xtra(), parse_trap_name(), parse_trap_save_flags(), parse_trap_visibility(), parse_vault_d(), parse_vault_name(), and parse_vault_type().

const char* parser_getsym ( struct parser p,
const char *  name 
)

Returns the symbol named name.

This symbol must exist.

References PARSE_T_OPT, PARSE_T_SYM, parser_getval(), parser_value::spec, parser_value::sval, parser_spec::type, and parser_value::u.

Referenced by grab_effect_data(), helper_opt0(), helper_sym0(), helper_sym1(), parse_act_expr(), parse_always(), parse_artifact_base_object(), parse_artifact_curse(), parse_artifact_graphics(), parse_body_slot(), parse_brand_resist_flag(), parse_buy_flag(), parse_class_book(), parse_class_equip(), parse_class_expr(), parse_class_spell(), parse_constants_carry_cap(), parse_constants_dun_gen(), parse_constants_level_max(), parse_constants_mon_gen(), parse_constants_mon_play(), parse_constants_obj_make(), parse_constants_player(), parse_constants_store(), parse_constants_world(), parse_curse_expr(), parse_curse_type(), parse_eff_lore_color(), parse_eff_lore_color_immune(), parse_eff_lore_color_resist(), parse_ego_curse(), parse_ego_item(), parse_ego_type(), parse_feat_graphics(), parse_flavor_flavor(), parse_flavor_kind(), parse_graf_directory(), parse_lore_base(), parse_lore_blow(), parse_lore_drop(), parse_lore_mimic(), parse_mon_spell_effect(), parse_mon_spell_expr(), parse_mon_spell_lore_color(), parse_mon_spell_lore_color_immune(), parse_mon_spell_lore_color_resist(), parse_mon_spell_message_type(), parse_monster_base(), parse_monster_blow(), parse_monster_color(), parse_monster_drop(), parse_monster_mimic(), parse_normal(), parse_object_base_defaults(), parse_object_base_graphics(), parse_object_base_name(), parse_object_curse(), parse_object_expr(), parse_object_graphics(), parse_object_power_expr(), parse_object_power_item(), parse_object_power_type(), parse_object_property_type_mult(), parse_object_type(), parse_pit_color(), parse_pit_mon_ban(), parse_pit_mon_base(), parse_player_timed_message_type(), parse_prefs_feat(), parse_prefs_gf(), parse_prefs_inscribe(), parse_prefs_message(), parse_prefs_monster(), parse_prefs_monster_base(), parse_prefs_object(), parse_prefs_sound(), parse_prefs_trap(), parse_profile_room(), parse_projection_color(), parse_projection_message_type(), parse_realm_stat(), parse_room_tval(), parse_slay_base(), parse_slay_race_flag(), parse_trap_expr(), parse_trap_expr_xtra(), parse_trap_graphics(), and parse_trap_name().

unsigned int parser_getuint ( struct parser p,
const char *  name 
)
static struct parser_value* parser_getval ( struct parser p,
const char *  name 
)
static
bool parser_hasval ( struct parser p,
const char *  name 
)
struct parser* parser_new ( void  )
enum parser_error parser_parse ( struct parser p,
const char *  line 
)

Parses the provided line.

This runs the first parser hook registered with p that matches line.

References parser::colno, parser_value::cval, parser::errmsg, parser::error, parser_hook::fhead, parser::fhead, findhook(), parser::ftail, parser_hook::func, h, parser_value::ival, parser::lineno, mem_alloc(), mem_free(), my_strcpy(), parser_spec::name, parser_spec::next, NULL, parse_random(), PARSE_T_CHAR, PARSE_T_INT, PARSE_T_OPT, PARSE_T_RAND, PARSE_T_STR, PARSE_T_SYM, PARSE_T_UINT, parser_freeold(), parser_value::rval, parser_value::spec, string_make(), parser_value::sval, text_mbstowcs(), parser_spec::type, parser_value::u, and parser_value::uval.

Referenced by init_graphics_modes(), parse_file(), process_pref_file_command(), process_pref_file_named(), test_alloc0(), test_alloc1(), test_alloc2(), test_attack0(), test_baddir(), test_badmax(), test_badtval0(), test_badtval1(), test_base0(), test_base_object0(), test_blank(), test_blow0(), test_blow1(), test_char0(), test_char1(), test_charges0(), test_chart0(), test_color0(), test_combat0(), test_comment0(), test_comment1(), test_d0(), test_desc0(), test_equip0(), test_flags0(), test_flavor0(), test_graphics0(), test_graphics1(), test_height0(), test_hgt0(), test_history0(), test_i0(), test_info0(), test_int0(), test_int1(), test_kind0(), test_magic0(), test_max_lev0(), test_mimic0(), test_min0(), test_min_lev0(), test_msg0(), test_name0(), test_negative(), test_obj_flags0(), test_opt0(), test_order(), test_owner0(), test_phrase0(), test_pile0(), test_play_flags0(), test_power0(), test_priority0(), test_properties0(), test_pval0(), test_rand0(), test_rand1(), test_rat0(), test_section0(), test_section1(), test_skill_device0(), test_skill_dig0(), test_skill_disarm0(), test_skill_melee0(), test_skill_save0(), test_skill_search0(), test_skill_shoot0(), test_skill_stealth0(), test_skill_throw0(), test_slots0(), test_spaces(), test_spell_freq0(), test_spells0(), test_stats0(), test_store0(), test_str0(), test_sym0(), test_sym1(), test_syntax0(), test_syntax1(), test_syntax2(), test_time0(), test_title0(), test_typ0(), test_type0(), test_uint0(), test_uint1(), test_values0(), test_weight0(), test_wid0(), test_word0(), and test_word1().

void* parser_priv ( struct parser p)

Gets parser's private data.

References parser::priv.

Referenced by finish_parse_act(), finish_parse_artifact(), finish_parse_body(), finish_parse_brand(), finish_parse_class(), finish_parse_constants(), finish_parse_curse(), finish_parse_eff(), finish_parse_ego(), finish_parse_feat(), finish_parse_flavor(), finish_parse_grafmode(), finish_parse_hints(), finish_parse_history(), finish_parse_meth(), finish_parse_mon_base(), finish_parse_mon_spell(), finish_parse_monster(), finish_parse_names(), finish_parse_object(), finish_parse_object_base(), finish_parse_object_power(), finish_parse_object_property(), finish_parse_p_race(), finish_parse_pain(), finish_parse_pit(), finish_parse_prefs(), finish_parse_profile(), finish_parse_projection(), finish_parse_quest(), finish_parse_randart(), finish_parse_realm(), finish_parse_room(), finish_parse_slay(), finish_parse_stores(), finish_parse_trap(), finish_parse_vault(), helper_char0(), helper_char1(), helper_int0(), helper_int1(), helper_opt0(), helper_rand0(), helper_rand1(), helper_str0(), helper_sym0(), helper_sym1(), helper_uint0(), parse_act_aim(), parse_act_desc(), parse_act_dice(), parse_act_effect(), parse_act_expr(), parse_act_msg(), parse_act_name(), parse_act_param(), parse_act_power(), parse_always(), parse_artifact_act(), parse_artifact_alloc(), parse_artifact_base_object(), parse_artifact_brand(), parse_artifact_curse(), parse_artifact_desc(), parse_artifact_flags(), parse_artifact_graphics(), parse_artifact_info(), parse_artifact_msg(), parse_artifact_name(), parse_artifact_power(), parse_artifact_slay(), parse_artifact_time(), parse_artifact_values(), parse_body_body(), parse_body_slot(), parse_brand_code(), parse_brand_multiplier(), parse_brand_name(), parse_brand_power(), parse_brand_resist_flag(), parse_brand_verb(), parse_buy(), parse_buy_flag(), parse_class_attack(), parse_class_book(), parse_class_desc(), parse_class_dice(), parse_class_effect(), parse_class_equip(), parse_class_expr(), parse_class_flags(), parse_class_info(), parse_class_magic(), parse_class_name(), parse_class_param(), parse_class_realm(), parse_class_skill_device(), parse_class_skill_dig(), parse_class_skill_disarm_magic(), parse_class_skill_disarm_phys(), parse_class_skill_melee(), parse_class_skill_save(), parse_class_skill_search(), parse_class_skill_shoot(), parse_class_skill_stealth(), parse_class_skill_throw(), parse_class_spell(), parse_class_stats(), parse_class_title(), parse_constants_carry_cap(), parse_constants_dun_gen(), parse_constants_level_max(), parse_constants_mon_gen(), parse_constants_mon_play(), parse_constants_obj_make(), parse_constants_player(), parse_constants_store(), parse_constants_world(), parse_curse_combat(), parse_curse_conflict(), parse_curse_desc(), parse_curse_dice(), parse_curse_effect(), parse_curse_expr(), parse_curse_flags(), parse_curse_msg(), parse_curse_name(), parse_curse_param(), parse_curse_time(), parse_curse_type(), parse_curse_values(), parse_eff_desc(), parse_eff_effect_type(), parse_eff_eval(), parse_eff_lore_color(), parse_eff_lore_color_immune(), parse_eff_lore_color_resist(), parse_eff_name(), parse_eff_power(), parse_eff_resist(), parse_ego_alloc(), parse_ego_brand(), parse_ego_combat(), parse_ego_curse(), parse_ego_desc(), parse_ego_dice(), parse_ego_effect(), parse_ego_flags(), parse_ego_flags_off(), parse_ego_info(), parse_ego_item(), parse_ego_min(), parse_ego_min_val(), parse_ego_name(), parse_ego_slay(), parse_ego_time(), parse_ego_type(), parse_ego_values(), parse_feat_desc(), parse_feat_flags(), parse_feat_graphics(), parse_feat_info(), parse_feat_mimic(), parse_feat_name(), parse_feat_priority(), parse_flavor_flavor(), parse_graf_directory(), parse_graf_extra(), parse_graf_name(), parse_graf_pref(), parse_graf_size(), parse_hint(), parse_history_chart(), parse_history_phrase(), parse_lore_base(), parse_lore_blow(), parse_lore_counts(), parse_lore_drop(), parse_lore_drop_artifact(), parse_lore_flags(), parse_lore_friends(), parse_lore_friends_base(), parse_lore_mimic(), parse_lore_spells(), parse_meth_act_msg(), parse_meth_cut(), parse_meth_desc(), parse_meth_message_type(), parse_meth_miss(), parse_meth_name(), parse_meth_phys(), parse_meth_stun(), parse_mon_base_desc(), parse_mon_base_flags(), parse_mon_base_glyph(), parse_mon_base_name(), parse_mon_base_pain(), parse_mon_base_spells(), parse_mon_spell_blind_message(), parse_mon_spell_dice(), parse_mon_spell_effect(), parse_mon_spell_expr(), parse_mon_spell_hit(), parse_mon_spell_lore_color(), parse_mon_spell_lore_color_immune(), parse_mon_spell_lore_color_resist(), parse_mon_spell_lore_desc(), parse_mon_spell_message(), parse_mon_spell_message_type(), parse_mon_spell_miss_message(), parse_mon_spell_name(), parse_mon_spell_param(), parse_mon_spell_power(), parse_mon_spell_save_message(), parse_monster_base(), parse_monster_blow(), parse_monster_color(), parse_monster_desc(), parse_monster_drop(), parse_monster_drop_artifact(), parse_monster_flags(), parse_monster_flags_off(), parse_monster_friends(), parse_monster_friends_base(), parse_monster_glyph(), parse_monster_info(), parse_monster_mimic(), parse_monster_name(), parse_monster_plural(), parse_monster_power(), parse_monster_spell_freq(), parse_monster_spell_power(), parse_monster_spells(), parse_names_section(), parse_names_word(), parse_normal(), parse_object_alloc(), parse_object_base_break(), parse_object_base_defaults(), parse_object_base_flags(), parse_object_base_graphics(), parse_object_base_name(), parse_object_brand(), parse_object_charges(), parse_object_combat(), parse_object_curse(), parse_object_desc(), parse_object_dice(), parse_object_effect(), parse_object_expr(), parse_object_flags(), parse_object_graphics(), parse_object_msg(), parse_object_name(), parse_object_param(), parse_object_pile(), parse_object_power(), parse_object_power_apply_to(), parse_object_power_dice(), parse_object_power_expr(), parse_object_power_item(), parse_object_power_iterate(), parse_object_power_name(), parse_object_power_operation(), parse_object_power_type(), parse_object_properties(), parse_object_property_adjective(), parse_object_property_code(), parse_object_property_desc(), parse_object_property_id_type(), parse_object_property_msg(), parse_object_property_mult(), parse_object_property_name(), parse_object_property_neg_adj(), parse_object_property_power(), parse_object_property_subtype(), parse_object_property_type(), parse_object_property_type_mult(), parse_object_pval(), parse_object_slay(), parse_object_time(), parse_object_type(), parse_object_values(), parse_owner(), parse_p_race_height(), parse_p_race_history(), parse_p_race_info(), parse_p_race_name(), parse_p_race_obj_flags(), parse_p_race_play_flags(), parse_p_race_skill_device(), parse_p_race_skill_dig(), parse_p_race_skill_disarm_magic(), parse_p_race_skill_disarm_phys(), parse_p_race_skill_melee(), parse_p_race_skill_save(), parse_p_race_skill_search(), parse_p_race_skill_shoot(), parse_p_race_skill_stealth(), parse_p_race_skill_throw(), parse_p_race_stats(), parse_p_race_values(), parse_p_race_weight(), parse_pain_message(), parse_pain_type(), parse_pit_alloc(), parse_pit_color(), parse_pit_flags_ban(), parse_pit_flags_req(), parse_pit_mon_ban(), parse_pit_mon_base(), parse_pit_name(), parse_pit_obj_rarity(), parse_pit_room(), parse_pit_spell_ban(), parse_pit_spell_req(), parse_player_timed_begin_message(), parse_player_timed_decrease_message(), parse_player_timed_desc(), parse_player_timed_end_message(), parse_player_timed_fail(), parse_player_timed_increase_message(), parse_player_timed_message_type(), parse_prefs_color(), parse_prefs_expr(), parse_prefs_feat(), parse_prefs_flavor(), parse_prefs_gf(), parse_prefs_inscribe(), parse_prefs_keymap_action(), parse_prefs_keymap_input(), parse_prefs_load(), parse_prefs_message(), parse_prefs_monster(), parse_prefs_monster_base(), parse_prefs_object(), parse_prefs_sound(), parse_prefs_trap(), parse_prefs_window(), parse_profile_cutoff(), parse_profile_name(), parse_profile_params(), parse_profile_room(), parse_profile_streamer(), parse_profile_tunnel(), parse_projection_blind_desc(), parse_projection_code(), parse_projection_color(), parse_projection_damage_cap(), parse_projection_denominator(), parse_projection_desc(), parse_projection_divisor(), parse_projection_message_type(), parse_projection_name(), parse_projection_numerator(), parse_projection_obvious(), parse_projection_player_desc(), parse_projection_type(), parse_quest_level(), parse_quest_name(), parse_quest_number(), parse_quest_race(), parse_realm_book_noun(), parse_realm_name(), parse_realm_spell_noun(), parse_realm_stat(), parse_realm_verb(), parse_room_d(), parse_room_doors(), parse_room_height(), parse_room_name(), parse_room_rating(), parse_room_tval(), parse_room_type(), parse_room_width(), parse_slay_base(), parse_slay_code(), parse_slay_melee_verb(), parse_slay_multiplier(), parse_slay_name(), parse_slay_power(), parse_slay_race_flag(), parse_slay_range_verb(), parse_slots(), parse_store(), parse_trap_appear(), parse_trap_desc(), parse_trap_dice(), parse_trap_dice_xtra(), parse_trap_effect(), parse_trap_effect_xtra(), parse_trap_expr(), parse_trap_expr_xtra(), parse_trap_flags(), parse_trap_graphics(), parse_trap_msg(), parse_trap_msg_bad(), parse_trap_msg_good(), parse_trap_msg_xtra(), parse_trap_name(), parse_trap_param(), parse_trap_param_xtra(), parse_trap_save_flags(), parse_trap_visibility(), parse_turnover(), parse_vault_columns(), parse_vault_d(), parse_vault_max_depth(), parse_vault_min_depth(), parse_vault_name(), parse_vault_rating(), parse_vault_rows(), parse_vault_type(), process_pref_file_command(), process_pref_file_named(), test_alloc0(), test_alloc2(), test_attack0(), test_base0(), test_base_object0(), test_blow0(), test_blow1(), test_charges0(), test_chart0(), test_color0(), test_combat0(), test_d0(), test_desc0(), test_equip0(), test_flags0(), test_flavor0(), test_graphics0(), test_graphics1(), test_height0(), test_hgt0(), test_history0(), test_i0(), test_info0(), test_magic0(), test_max_lev0(), test_mimic0(), test_min0(), test_min_lev0(), test_msg0(), test_name0(), test_obj_flags0(), test_owner0(), test_phrase0(), test_pile0(), test_play_flags0(), test_power0(), test_priority0(), test_priv(), test_properties0(), test_pval0(), test_rat0(), test_skill_device0(), test_skill_dig0(), test_skill_disarm0(), test_skill_melee0(), test_skill_save0(), test_skill_search0(), test_skill_shoot0(), test_skill_stealth0(), test_skill_throw0(), test_slots0(), test_spell_freq0(), test_spells0(), test_stats0(), test_store0(), test_time0(), test_title0(), test_typ0(), test_type0(), test_values0(), test_weight0(), and test_wid0().

errr parser_reg ( struct parser p,
const char *  fmt,
enum parser_error(*)(struct parser *p func 
)

Registers a parser hook.

Hooks have the following format: <fmt> ::= <name> [<type> <name>]* [?<type> <name>]* <type> ::= int | str | sym | rand | char The first <name> is called the directive for this hook. Any other hooks with the same directive are superseded by this hook. It is an error for a mandatory field to follow an optional field. It is an error for any field to follow a field of type str, since str fields are not delimited and will consume the entire rest of the line.

References parser_hook::func, h, parser::hooks, mem_alloc(), mem_free(), parser_hook::next, parse_specs(), and string_make().

Referenced by init_parse_act(), init_parse_artifact(), init_parse_body(), init_parse_brand(), init_parse_class(), init_parse_constants(), init_parse_curse(), init_parse_eff(), init_parse_ego(), init_parse_feat(), init_parse_flavor(), init_parse_grafmode(), init_parse_hints(), init_parse_history(), init_parse_lore(), init_parse_meth(), init_parse_mon_base(), init_parse_mon_spell(), init_parse_monster(), init_parse_names(), init_parse_object(), init_parse_object_base(), init_parse_object_power(), init_parse_object_property(), init_parse_p_race(), init_parse_pain(), init_parse_pit(), init_parse_player_timed(), init_parse_prefs(), init_parse_profile(), init_parse_projection(), init_parse_quest(), init_parse_realm(), init_parse_room(), init_parse_slay(), init_parse_stores(), init_parse_trap(), init_parse_vault(), register_sound_pref_parser(), test_char0(), test_char1(), test_int0(), test_int1(), test_opt0(), test_rand0(), test_rand1(), test_reg0(), test_reg1(), test_reg2(), test_reg3(), test_reg4(), test_reg5(), test_reg_int(), test_reg_str(), test_reg_sym(), test_str0(), test_sym0(), test_sym1(), test_syntax0(), test_syntax1(), test_syntax2(), test_uint0(), and test_uint1().

void parser_setpriv ( struct parser p,
void v 
)

Sets parser's private data.

This is commonly used to store context for stateful parsing.

References parser::priv.

Referenced by finish_parse_grafmode(), init_parse_act(), init_parse_artifact(), init_parse_body(), init_parse_brand(), init_parse_class(), init_parse_constants(), init_parse_curse(), init_parse_eff(), init_parse_ego(), init_parse_feat(), init_parse_flavor(), init_parse_grafmode(), init_parse_history(), init_parse_lore(), init_parse_meth(), init_parse_mon_base(), init_parse_mon_spell(), init_parse_monster(), init_parse_names(), init_parse_object(), init_parse_object_base(), init_parse_object_power(), init_parse_object_property(), init_parse_p_race(), init_parse_pain(), init_parse_pit(), init_parse_player_timed(), init_parse_prefs(), init_parse_profile(), init_parse_projection(), init_parse_quest(), init_parse_realm(), init_parse_room(), init_parse_slay(), init_parse_stores(), init_parse_trap(), init_parse_vault(), parse_act_name(), parse_artifact_name(), parse_body_body(), parse_brand_code(), parse_class_name(), parse_curse_name(), parse_eff_name(), parse_ego_name(), parse_feat_name(), parse_flavor_flavor(), parse_graf_name(), parse_hint(), parse_history_chart(), parse_lore_name(), parse_meth_name(), parse_mon_base_name(), parse_mon_spell_name(), parse_monster_name(), parse_object_name(), parse_object_power_name(), parse_object_property_name(), parse_p_race_name(), parse_pain_type(), parse_pit_name(), parse_player_timed_name(), parse_profile_name(), parse_projection_code(), parse_quest_name(), parse_realm_name(), parse_room_name(), parse_slay_code(), parse_store(), parse_trap_name(), parse_vault_name(), test_char0(), test_char1(), test_int0(), test_int1(), test_opt0(), test_priv(), test_rand0(), test_rand1(), test_str0(), test_sym0(), test_sym1(), and test_uint0().

void parser_setstate ( struct parser p,
unsigned int  col,
const char *  msg 
)

Sets the parser's detailed error description and field number.

References parser::colno, parser::errmsg, and my_strcpy().