Author: ai0867
Date: Mon Sep 29 16:41:26 2008
New Revision: 29765
URL: http://svn.gna.org/viewcvs/wesnoth?rev=29765&view=rev
Log:
* Improve wmltest and wmlgrammar documentation.
Modified:
trunk/data/tools/wesnoth/wmlgrammar.py
trunk/data/tools/wmltest
Modified: trunk/data/tools/wesnoth/wmlgrammar.py
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/data/tools/wesnoth/wmlgrammar.py?rev=29765&r1=29764&r2=29765&view=diff
==============================================================================
--- trunk/data/tools/wesnoth/wmlgrammar.py (original)
+++ trunk/data/tools/wesnoth/wmlgrammar.py Mon Sep 29 16:41:26 2008
@@ -129,7 +129,7 @@
[],
[ re.compile('\w+'), ]),
'resolution' : (
- [ { 'label' : 'label-theme' }, 'main_map', 'main_map_border', 'menu',
'mini_map', 'panel', 'replay', 'screen', 'status', ], #TODO: unfinished
+ [ { 'label' : 'label-theme' }, 'main_map', 'main_map_border', 'menu',
'mini_map', 'panel', 'replay', 'screen', 'status', ],
[ 'height', 'id', 'width', ]),
'screen' : (
[],
@@ -196,6 +196,10 @@
'upkeep' : 'gold-theme',
}
def grammar(self):
+ """Grammar pre-processor.
+
+ This function is responsible for turning all the 'pointers' into
actual data.
+ It can go into an infinite loop if a tag points to itself in some
manner."""
out = {}
for key in self._grammar.keys():
out.update( { key : self._grammar[key] } )
Modified: trunk/data/tools/wmltest
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/data/tools/wmltest?rev=29765&r1=29764&r2=29765&view=diff
==============================================================================
--- trunk/data/tools/wmltest (original)
+++ trunk/data/tools/wmltest Mon Sep 29 16:41:26 2008
@@ -23,13 +23,14 @@
class Tester:
"""
- The Tester class, this walks the WML tree and checks wheter stuff has
meaning.
+ The Tester class, this walks the WML tree and checks whether stuff has
meaning. (among other things)
"""
def __init__(self, wmltree, verbosity):
self.wmltree = wmltree
self.verbosity = verbosity
self.grammar = wmlgrammar.Grammar().grammar()
def test(self, tag=None, depth=0):
+ """Tests whether things have meaning, walks the wml tree."""
if not tag:
tag = self.wmltree
if self.verbosity > 2:
@@ -89,9 +90,10 @@
p = subprocess.Popen(["wesnoth", "--path"], stdout =
subprocess.PIPE)
path = p.stdout.read().strip()
options.path = os.path.join(path, "data")
+ sys.stderr.write("No Wesnoth path given.\nAutomatically found
'%s'\n" % (options.path, ) )
except OSError:
- sys.stderr.write("Could not determine Wesnoth path.\nAssuming
'.'\n")
options.path = '.'
+ sys.stderr.write("Could not determine Wesnoth path.\nAssuming
'%s'\n" % (options.path, ) )
if len(args) < 1:
args.append('%s/_main.cfg' % options.path)
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits