Enable wmllint to detect places where interpreting description= as...

...user_description= is interpreted now would cause SUFs to break.  

Fix two wacky macros that caused false positives on this test
in mainline.
This commit is contained in:
Eric S. Raymond 2008-03-13 21:30:54 +00:00
parent 4a7a6ac483
commit 9d430b0ed9
4 changed files with 104 additions and 91 deletions

View file

@ -1,30 +1,32 @@
#textdomain wesnoth-multiplayer
[multiplayer]
#define UNIT_STONE TYPE USER_DESCRIPTION X Y
type={TYPE}
user_description={USER_DESCRIPTION}
x={X}
y={Y}
unrenamable=yes
random_traits=no
[unit]
type={TYPE}
user_description={USER_DESCRIPTION}
x={X}
y={Y}
unrenamable=yes
random_traits=no
[status]
stone=on
[/status]
[status]
stone=on
[/status]
[modifications]
[trait]
id=remove_hp
[effect]
apply_to=hitpoints
increase_total=-100%
[/effect]
[effect]
apply_to=movement
set=0
[/effect]
[/trait]
[/modifications]
[modifications]
[trait]
id=remove_hp
[effect]
apply_to=hitpoints
increase_total=-100%
[/effect]
[effect]
apply_to=movement
set=0
[/effect]
[/trait]
[/modifications]
[/unit]
#enddef
id=multiplayer_Basilisk
@ -68,9 +70,8 @@
no_leader=yes
team_name=statues
[unit]
{UNIT_STONE "Sky Drake" "" 27 14}
{UNIT_STONE "Sky Drake" "" 27 14}
[+unit]
unit_description=_ "The winds of the dark sky blew so cold,
The moon was high, the night was old,
Brave was the drake that dared forsake
@ -93,21 +94,20 @@ His home to steal the Basilisk's gold.
(inscribed by Flametrooper)"
[/unit]
[unit]
{UNIT_STONE "Saurian Flanker" _"Xikkrisx" 40 8}
{UNIT_STONE "Saurian Flanker" _"Xikkrisx" 40 8}
[+unit]
facing=sw
unit_description=_ "Xikkrisx of Syrsszk was a powerful Saurian warrior, sent to this region by the Elders of the Rysssrylosszkk Clan (translation: ''The Hunts-Foes-In-Boiling-Rivers Clan''). The Elders were preparing to make war on a human outpost, and were in great need of the powerful magics of Oxsrrsk, a Saurian Mystic who had last been seen heading in the direction of Ruaskkolin Lake. Xikkrisx found the petrified body of Oxsrrsk, along with a carefully bound scroll that had apparently been dropped into a small crevice in the cave floor. He opened the scroll and read a brief passage from the middle of the text: ''After he was bound and cast from the Upper World, Chak'kso's enraged spirit sought release, and was able to exert a corrupting influence on certain regions of the Upper World, channeled through ''pathways of stone'' that extend from the surface into the depths of the Under Reaches. This rage altered the eggs of great lizards, shaping their bodies and spirits into implements of Chak'kso's hatred.'' Confused, Xikkrisx fixed his attention on the task at hand. Thinking that perhaps the Elders could find some way to restore Oxsrrsk, he began the long and strenuous task of hauling the statue back to the domain of the Rysssrylosszkk Clan. Exhausted, and not having traveled far from the lake, Xikkrisx set the statue down inside of a small cave, and lay down to rest. He was awoken by a bone-chilling roar."
[/unit]
[unit]
{UNIT_STONE "Saurian Oracle" _"Oxsrrsk" 39 8}
{UNIT_STONE "Saurian Oracle" _"Oxsrrsk" 39 8}
[+unit]
facing=sw
unit_description=_ "Oxsrrsk was a powerful Saurian Oracle, who had, in a raid against the rival Xraxss Clan, acquired (from the vaults of the now-dead Oracle Hesx-Rzzak) a most fascinating scroll. The scroll was entitled ''Ney'yks of the Granite Gaze,'' and told of a creature known as the ''Chak'kso Ney'yks,'' a name which, in an ancient saurian tongue, meant ''Eldest Child of Chak'kso.'' Chak'kso was believed to have been a powerful demigod of the Under Reaches, described as a ''great demon of the earth'' in the Elvish Histories. According to these histories, Chak'kso had once sought to transform all life on the planet to stone; so great was his hatred for creatures of flesh. He was ultimately defeated and bound by powerful magics, but in the centuries following his banishment (to a realm far below the surface of the world) a new breed of creature began appearing in the Histories, a breed with the ability to turn any being of flesh into stone. There was a period when these Basilisks (as they came to be known) wreaked havoc on the world of the living, turning thousands to stone. One by one, and at great cost, the Basilisks were defeated. All, it would seem, but one; the Basilisk known as ''The Ney'yks,'' or ''The Eldest Child,'' in the modern tongue. Supremely convinced of his ability to locate and bind this powerful creature into his service, Oxsrrsk set out on his journey..."
[/unit]
[unit]
{UNIT_STONE "Elvish Marksman" "" 2 11}
{UNIT_STONE "Elvish Marksman" "" 2 11}
[+unit]
unit_description=_ "Slim of Stature, dexterous Hands
- - Seven Stones and Eleven
Left his Foes so slim a Chance
@ -118,37 +118,35 @@ Marksman known as Dragonbane
(inscribed by Gauteamus)"
[/unit]
[unit]
{UNIT_STONE "Direwolf Rider" (_"Blum Duk") 10 17}
{UNIT_STONE "Direwolf Rider" (_"Blum Duk") 10 17}
[+unit]
unit_description=_ "Blum Duk was renowned among his goblin clan for having tamed one of the Dire Wolves of the mountains, and he had the courage to match. His leadership and skills alone were what kept the area's goblins alive despite human and elvish menaces. Rumor had it that his wolf had slain fifty men and a hundred Elves.
Thus, when he heard of the awful monster that was inhabiting the area, it was only natural that he ride out alone to face it. All the other goblins expected him to slay the creature easily and drag back its carcass to feast on.
He was in for quite a shock. As soon as he saw the Basilisk, Blum Duk cowered in fright. He tried to wheel his wolf around to run away, but it wouldn't move. As the creature stalked towards him, he screamed his last words: Good Gog, dog, are yer legs made of stone?!?
(inscribed by Elvish Pillager)"
[/unit]
[unit]
{UNIT_STONE "Armageddon Drake" _"Rah Ihn Mar" 11 14}
{UNIT_STONE "Armageddon Drake" _"Rah Ihn Mar" 11 14}
[+unit]
unit_description=_ "Rah Ihn Mar, Champion of the Burning Hills, made his way to the Ruaskkolin Lake region in pursuit of the Elvish Hero Terowydlithrol, known amoung Elves as ''The Dragonbane.'' It was said that Terowydlithrol had killed a Dragon of Fire that threatened an Elvish village, and initiated a ''counterattack'' in which some 37 Drakes, camping in a nearby ravine and believed to be in allegiance with the Dragon, were slaughtered. Knowing that these Drakes were innocent, Rah Ihn Mar came to Ruaskkolin Lake to hunt down and slay Terowydlithrol, who had been seen entering the region but a day ago. Burning for vengeance, Rah Ihn Mar began the hunt....."
[/unit]
[unit]
{UNIT_STONE "Sea Serpent" "" 22 12}
{UNIT_STONE "Sea Serpent" "" 22 12}
[+unit]
facing=sw
unit_description=_ "He had lived there for ages upon ages, in the depths of the water, preying upon the various fish and frogs and merfolk that entered his domain. It was his lake, no other's, and though it was not large, he was its master. Then, the Basilisk came, and looked into the Serpent's eyes. And the Serpent had not died, but it was no longer alive. Thus the new lord of the lake had arrived.
(inscribed by Turin)"
[/unit]
[unit]
{UNIT_STONE "Grand Knight" "" 25 14}
{UNIT_STONE "Grand Knight" "" 25 14}
[+unit]
facing=sw
unit_description=_ "A brave hero of Wesnoth's Golden Age, this great rider and commander of men came to this evil place while on a raid against the orcs. Caught unaware by the foul creatures, many of his fellows were killed, but he fought valiantly, slaying many a foe. But alas! The foul Basilisk turned him to stone even as he slew the last orc. Now all that is left is a stark reminder of his once great bearing and strength.
(inscribed by Fynmiir)"
[/unit]
[unit]
{UNIT_STONE "Elder Wose" _"Bramwythl" 32 6}
{UNIT_STONE "Elder Wose" _"Bramwythl" 32 6}
[+unit]
unit_description=_ "Bramwythl the Wose was always considered a slow, taciturn fellow, even by other Woses. More than any other Wose, he enjoyed simply standing alone in the sun, arms upraised, admiring the beauty of the empty sky. Once, even, he confided in a fellow that his greatest wish was to be able to bask forever in the sun's glory.
However, not long after, the local wose community heard of the approach of a horrible monster, powerful enough to easily destroy the few woses that lived in the area. They quickly moved off (quickly for Woses, anyway), but Bramwythl was left behind - in their haste, no one had remembered to find him and tell him of the danger.
@ -156,29 +154,28 @@ He was taken quite unawares by the Basilisk, and turned to stone before he even
(inscribed by Elvish Pillager)"
[/unit]
[unit]
{UNIT_STONE "Iron Mauler" _"Talael Ryndoc" 34 11}
{UNIT_STONE "Iron Mauler" _"Talael Ryndoc" 34 11}
[+unit]
facing=sw
unit_description=_ "General Talael Ryndoc came to this place to fight a duel with the Grand Marshal Aethec Corryn, but the two men never found one another. "
[/unit]
[unit]
{UNIT_STONE "Grand Marshal" _"Aethec Corryn" 15 11}
{UNIT_STONE "Grand Marshal" _"Aethec Corryn" 15 11}
[+unit]
facing=sw
unit_description=_ "The last words spoken by Grand Marshal Aethec Corryn: ''Talael Ryndoc! I am through searching for you! I shall make my way back to Haldric's Hall, and inform the court that you were too much of a coward to attend our duel! Your disgrace shall be more agonizing than the death I'd have given you!''
Perhaps he should not have shouted quite so loudly.... "
[/unit]
[unit]
{UNIT_STONE "Naga Myrmidon" _"Rilhon" 20 12}
{UNIT_STONE "Naga Myrmidon" _"Rilhon" 20 12}
[+unit]
unit_description=_ "This brave warrior, known as Rilhon among the Naga, heard tell of a fabulous treasure that had been lost in these watery caves- a spear whose head was said to have been fashioned from the tooth of Chak'kso Ney'yks, an Elder Basilisk slain long ago by the Elvish hero, Eloralduil. According to the legend, the weapon rested somewhere on the bottom of this very lake (Ruaskkolin Lake, named for a well-known Sea Serpent who made it his home). Having prepared himself for battle with the Serpent, Rilhon met with two rather large surprises. The first was the petrified form of Ruaskkolin the Serpent. The second was the very-much-alive Chak'kso Ney'yks, who was, oddly enough, in possession of all of his teeth.
(inscribed by Paterson)"
[/unit]
[unit]
{UNIT_STONE "Mermaid Siren" "" 17 11}
{UNIT_STONE "Mermaid Siren" "" 17 11}
[+unit]
facing=sw
unit_description=_ "Through waves and rocky channels
blue and white

View file

@ -2,33 +2,35 @@
[multiplayer]
#define SULLA_STATUE TYPE X Y FACING USER_DESCRIPTION
type={TYPE}
user_description= "`~`" + {USER_DESCRIPTION}
x={X}
y={Y}
facing={FACING}
unrenamable=yes
random_traits=no
[unit]
type={TYPE}
user_description= "`~`" + {USER_DESCRIPTION}
x={X}
y={Y}
facing={FACING}
unrenamable=yes
random_traits=no
[status]
stone=on
[/status]
[status]
stone=on
[/status]
[modifications]
[trait]
id=remove_hp
name=_ "statue"
description=_ "This is a sculpture made of stone."
[effect]
apply_to=hitpoints
increase_total=-100%
[/effect]
[effect]
apply_to=movement
set=0
[/effect]
[/trait]
[/modifications]
[modifications]
[trait]
id=remove_hp
name=_ "statue"
description=_ "This is a sculpture made of stone."
[effect]
apply_to=hitpoints
increase_total=-100%
[/effect]
[effect]
apply_to=movement
set=0
[/effect]
[/trait]
[/modifications]
[/unit]
#enddef
id=multiplayer_Sullas_Ruins
@ -72,25 +74,25 @@
no_leader=yes
team_name=statues
[unit]
{SULLA_STATUE (Great Mage) 18 15 se (_"Statue of Sulla")}
{SULLA_STATUE (Great Mage) 18 15 se (_"Statue of Sulla")}
[+unit]
gender=female
unit_description=_ "A stone-carved likeness of Sulla the Great, also known as Sulla the Just, Sulla the Tyrant, Empress of the Sinking Tower, Lady of the Walking Glacier, Sulla the Incinerator, Sulla the Proud and Sulla the Righteous."
[/unit]
[unit]
{SULLA_STATUE Yeti 20 11 sw (_"Statue of Lhun-dup")}
{SULLA_STATUE Yeti 20 11 sw (_"Statue of Lhun-dup")}
[+unit]
unit_description=_ "A stone-carved likeness of Lhun-dup, Servant of Sulla."
[/unit]
[unit]
{SULLA_STATUE Yeti 23 15 sw (_"Statue of Ri-nzen")}
{SULLA_STATUE Yeti 23 15 sw (_"Statue of Ri-nzen")}
[+unit]
unit_description=_ "A stone-carved likeness of Ri-nzen, Servant of Sulla."
[/unit]
[unit]
{SULLA_STATUE Yeti 13 16 se (_"Statue of Ten-zin")}
{SULLA_STATUE Yeti 13 16 se (_"Statue of Ten-zin")}
[+unit]
unit_description=_ "A stone-carved likeness of Ten-zin, Servant of Sulla."
[/unit]
[unit]
{SULLA_STATUE Yeti 16 19 se (_"Statue of Lo-bsang")}
{SULLA_STATUE Yeti 16 19 se (_"Statue of Lo-bsang")}
[+unit]
unit_description=_ "A stone-carved likeness of Lo-bsang, Servant of Sulla."
[/unit]
[/side]

View file

@ -20,6 +20,14 @@ def string_strip(value):
value = value[:-1]
return value
def attr_strip(value):
"Strip away an (optional) translation mark and string quotes."
value = value.strip()
if value.startswith('_'):
value = value[1:]
value = value.strip()
return string_strip(value)
def parse_attribute(str):
"Parse a WML key-value pair from a line."
if '=' not in str:

View file

@ -528,8 +528,12 @@ def validate_on_pop(tagstack, closer, filename, lineno):
# to deserialize an empty unit.
if closer == "side" and "type" not in attributes and ("no_leader" not in attributes or attributes["no_leader"] != "yes") and "multiplayer" not in ancestors:
print '"%s", line %d: [side] without type attribute' % (filename, lineno)
#if closer in ('movement_costs', 'defense') and 'grassland' in attributes and 'road' not in attributes:
# print '"%s", line %d: [%s] without road attribute' % (filename, lineno, closer)
# Detect a potential problem with descriotion rewrites in UMC
if "description" in attributes and "user_description" in attributes:
id_v = string_strip(attributes["description"])
ud_v = attr_strip(attributes["user_description"])
if id_v != ud_v:
print '"%s", line %d: id=%s and user_description=%s differ' % (filename, lineno, id_v, ud_v)
def within(tag):
"Did the specified tag lead one of our enclosing contexts?"
@ -1838,9 +1842,11 @@ def translator(filename, mapxforms, textxform, versions):
validate_on_pop(tagstack, tag, filename, lineno)
tagstack.pop()
if tagstack:
for instance in re.finditer(r'([a-z][a-z_]*[a-z])\s*=(\w+|"[^"]*")', trimmed):
for instance in re.finditer(r'([a-z][a-z_]*[a-z])\s*=(.*)', trimmed):
attribute = instance.group(1)
value = instance.group(2)
if '#' in value:
value = value.split("#")[0].strip()
tagstack[-1][1][attribute] = value
if validate:
validate_stack(tagstack, filename, lineno)