Schema: Add all known ActionWML and ConditionalWML tags (based on wiki)

This also finishes up the StoryWML definition, adds validation for
map and shroud data, and a few other small schema fixes
This commit is contained in:
Celtic Minstrel 2018-03-30 13:51:04 -04:00
parent 3211014428
commit 7ab5fabbf2
6 changed files with 1404 additions and 11 deletions

File diff suppressed because it is too large Load diff

View file

@ -32,8 +32,8 @@
{DEFAULT_KEY hidden bool no}
{SIMPLE_KEY fog bool}
{SIMPLE_KEY shroud bool}
{SIMPLE_KEY fog_data string}
{SIMPLE_KEY shroud_data string}
{SIMPLE_KEY fog_data shroud_data}
{SIMPLE_KEY shroud_data shroud_data}
{SIMPLE_KEY persistent bool}
{SIMPLE_KEY save_id string}
{SIMPLE_KEY previous_save_id string}
@ -78,7 +78,7 @@
[tag]
name="ai"
max=infinite
super="ais/ai"
super="$ai"
[/tag]
{DEFAULT_KEY allow_player bool yes}
@ -300,7 +300,7 @@
{ADDON_DESCRIPTION}
{SIMPLE_KEY next_scenario string}
{SIMPLE_KEY name t_string}
{SIMPLE_KEY map_data string}
{SIMPLE_KEY map_data map_data}
{DEFAULT_KEY turns int -1}
{DEFAULT_KEY turn_at int 1}
{DEFAULT_KEY random_start_time bool,int_list no} # Note: Is it random_start_time or random_starting_time? (There's some uses of the latter)
@ -327,12 +327,12 @@
{SIMPLE_KEY force_lock_settings bool}
[tag]
name="story"
# TODO: Remove this once the actual supported tags are properly documented (basically messages, insert_tag, if/then/else, switch/case)
any_tag=yes
{INSERT_TAG}
# TODO: Is this really recognized at story toplevel? Wiki claims it is.
[tag]
name="image"
max=infinite
{INSERT_TAG}
{SIMPLE_KEY x int}
{SIMPLE_KEY y int}
{SIMPLE_KEY centered bool}
@ -349,6 +349,7 @@
[tag]
name="part"
max=infinite
{INSERT_TAG}
{SIMPLE_KEY background string}
{DEFAULT_KEY scale_background bool yes}
{SIMPLE_KEY story t_string}
@ -362,6 +363,7 @@
[tag]
name="background_layer"
max=infinite
{INSERT_TAG}
{SIMPLE_KEY image string}
{SIMPLE_KEY scale_vertically bool}
{SIMPLE_KEY scale_horizontally bool}
@ -385,11 +387,67 @@
super="scenario/story/part"
[/tag]
[/tag]
# TODO: Switch/case
[tag]
name="switch"
max=infinite
{REQUIRED_KEY variable string}
{INSERT_TAG}
[tag]
name="case"
max=infinite
super="scenario/story/part"
{REQUIRED_KEY value string}
[/tag]
[tag]
name="else"
super="scenario/story/part"
[/tag]
[/tag]
[link]
name="scenario/story/image"
[/link]
[link]
name="$action_wml/deprecated_message"
[/link]
[link]
name="$action_wml/wml_message"
[/link]
[/tag]
[tag]
name="if"
max=infinite
super="$conditional_wml"
[tag]
name="then"
super="scenario/story"
[/tag]
[tag]
name="else"
super="scenario/story"
[/tag]
[/tag]
[tag]
name="switch"
max=infinite
{REQUIRED_KEY variable string}
{INSERT_TAG}
[tag]
name="case"
max=infinite
super="scenario/story"
{REQUIRED_KEY value string}
[/tag]
[tag]
name="else"
super="scenario/story"
[/tag]
[/tag]
[link]
name="$action_wml/deprecated_message"
[/link]
[link]
name="$action_wml/wml_message"
[/link]
[/tag]
[tag]
name="label"
@ -410,6 +468,8 @@
{SIMPLE_KEY y range_list}
{SIMPLE_KEY image string}
{SIMPLE_KEY halo string}
{SIMPLE_KEY team_name string}
{DEFAULT_KEY visible_in_fog bool yes}
[/tag]
[tag]
name="time"

View file

@ -1,7 +1,51 @@
# All keys here are strings, because there could be variable substitutions
[tag]
name="$conditional_wml"
max=0
{INSERT_TAG}
[tag]
name="true,false"
max=infinite
{INSERT_TAG}
[/tag]
{FILTER_TAG "have_unit" unit (
max=infinite
{INSERT_TAG}
{DEFAULT_KEY search_recall_list string no}
{SIMPLE_KEY count string}
)}
{FILTER_TAG "have_location" location (
max=infinite
{INSERT_TAG}
{SIMPLE_KEY count string}
)}
[tag]
name="variable"
max=infinite
{INSERT_TAG}
{SIMPLE_KEY name string}
{SIMPLE_KEY contains string}
{SIMPLE_KEY equals string}
{SIMPLE_KEY not_equals string}
{SIMPLE_KEY numerical_equals string}
{SIMPLE_KEY numerical_not_equals string}
{SIMPLE_KEY greater_than string}
{SIMPLE_KEY greater_than_equal_to string}
{SIMPLE_KEY less_than string}
{SIMPLE_KEY less_than_equal_to string}
{SIMPLE_KEY boolean_equals string}
{SIMPLE_KEY boolean_not_equals string}
[/tag]
[tag]
name="found_item"
max=infinite
{INSERT_TAG}
{REQUIRED_KEY id string}
[/tag]
[tag]
name="and,or,not"
super="$condition_wml"
[/tag]
any_tag=yes
# TODO: Fill in all known ConditionalWML here
[/tag]

View file

@ -1,9 +1,19 @@
{./macros.cfg}
#define INSERT_TAG
[tag]
name="insert_tag"
max=infinite
{SIMPLE_KEY name string}
{SIMPLE_KEY variable string}
[/tag]
#enddef
[wml_schema]
# TODO: Or should we just include {./types}?
{./types/basic.cfg}
{./types/formula.cfg}
{./types/subst.cfg}
[type]
name=int_percent
value="-?\d+%?"
@ -14,7 +24,7 @@
[/type]
[type]
name="version"
value="\d+(\.\d+(\.\d+))"
value="\d+(\.\d+(\.\d+)?)"
[/type]
[type]
name="text_alignment"
@ -101,6 +111,32 @@
[/element]
[/list]
[/type]
[type]
name="map_data"
[list]
split="\n"
[element]
[list]
[element]
value="([a-zA-Z0-9_]+\s+)?[A-Za-z\\|/\^_]+"
[/element]
[/list]
[/element]
[/list]
[/type]
[type]
name=terrain_layer
value="overlay|base|both"
[/type]
[type]
name="shroud_data"
[list]
split="\n"
[element]
value="\|[01]*"
[/element]
[/list]
[/type]
[type]
name=irdya_date
value="\d+ [A-Z][A-Z]"
@ -132,7 +168,11 @@
[/type]
[type]
name="anim_hits"
value="(hit|no|miss|kill|yes)(,(hit|no|miss|kill|yes))*"
[list]
[element]
value="hit|no|miss|kill|yes"
[/element]
[/list]
[/type]
[type]
name="color"
@ -170,6 +210,14 @@
name="effect_set_special_mode"
value="append|replace"
[/type]
[type]
name="set_variables_mode"
value="append|repace|merge|insert"
[/type]
[type]
name="store_unit_mode"
value="append|repace|always_clear"
[/type]
[type]
name="ai_grouping"
value="offensive|defensive|no"
@ -202,6 +250,75 @@
[/type]
[/union]
[/type]
[type]
name="endlevel_result"
value="victory|defeat"
[/type]
[type]
name="object_duration"
value="scenario|forever|turn|turn[ _]end"
[/type]
[type]
name="heal_amount"
[union]
[type]
link=int
[/type]
[type]
value="full"
[/type]
[/union]
[/type]
[type]
name="image_pos"
value="left|right"
[/type]
[type]
name="objective_condition"
value="win|lose"
[/type]
[type]
name="deprecation_level"
value="[1-4]"
[/type]
[type]
name="logger"
value="err(or)?|warn(ing)?|debug|info"
[/type]
[type]
name="stamp"
value="stamp"
[/type]
[type]
name="rounding_method"
[union]
[type]
link=int
[/type]
[type]
value="floor|ceil|trunc"
[/type]
[/union]
[/type]
[type]
name="reachable_range"
value="movement|attack|vision"
[/type]
[type]
name="reachable_moves"
value="current|max"
[/type]
[type]
name="search_recall_list"
[union]
[type]
link=bool
[/type]
[type]
value="only"
[/type]
[/union]
[/type]
[tag]
name="root"
min=1
@ -218,6 +335,7 @@
name="code"
type="string"
[/key]
{DATA_TAG args 0 1}
[/tag]
[/tag]
[/wml_schema]

View file

@ -0,0 +1,25 @@
# Note that basic.cfg must also be included for these to work!
#define SUBST_TYPE BASE
[type]
name=s_{BASE}
[union]
[type]
link={BASE}
[/type]
[type]
# Basically, if there's a non-final $ in it, just give up on trying to validate it
value=".*\$.+"
[/type]
[/union]
[/type]
#enddef
{SUBST_TYPE bool}
{SUBST_TYPE int}
{SUBST_TYPE unsigned}
{SUBST_TYPE real}
{SUBST_TYPE color}
{SUBST_TYPE point}
{SUBST_TYPE t_string}

View file

@ -99,6 +99,10 @@
{FILTER_TAG "filter" unit ()}
{FILTER_TAG "source" location ()}
{FILTER_TAG "target" location ()}
{DEFAULT_KEY bidirectional bool yes}
{DEFAULT_KEY always_visible bool no}
{DEFAULT_KEY allow_vision bool yes}
{DEFAULT_KEY pass_allied_units bool yes}
[/tag]
[/tag]
[tag]