mail[Wesnoth-commits] r24346 - in /trunk/data: campaigns/Son_Of_The_Black_Eye/scenarios/09_Shan_Taum_The_Smug.cfg tools/wmllint


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by esr on March 06, 2008 - 04:32:
Author: esr
Date: Thu Mar  6 04:32:11 2008
New Revision: 24346

URL: http://svn.gna.org/viewcvs/wesnoth?rev=24346&view=rev
Log:
Teach wmllint to detect unbalanced string quotes in macro calls, and
fix the example.

Modified:
    
trunk/data/campaigns/Son_Of_The_Black_Eye/scenarios/09_Shan_Taum_The_Smug.cfg
    trunk/data/tools/wmllint

Modified: 
trunk/data/campaigns/Son_Of_The_Black_Eye/scenarios/09_Shan_Taum_The_Smug.cfg
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/data/campaigns/Son_Of_The_Black_Eye/scenarios/09_Shan_Taum_The_Smug.cfg?rev=24346&r1=24345&r2=24346&view=diff
==============================================================================
--- 
trunk/data/campaigns/Son_Of_The_Black_Eye/scenarios/09_Shan_Taum_The_Smug.cfg 
(original)
+++ 
trunk/data/campaigns/Son_Of_The_Black_Eye/scenarios/09_Shan_Taum_The_Smug.cfg 
Thu Mar  6 04:32:11 2008
@@ -146,7 +146,7 @@
         name=time over
         {OLD_ORCISH_SHAMAN 32 30 Fabstep _"Fabstep"}
         {OLD_ORCISH_SHAMAN 32 30 Klebar _"Klebar"}
-        {OLD_ORCISH_SHAMAN 32 30 Echarp _"Echarp""}
+        {OLD_ORCISH_SHAMAN 32 30 Echarp _"Echarp"}
         # wmllint: recognize Fabstep
         # wmllint: recognize Klebar
         # wmllint: recognize Echarp

Modified: trunk/data/tools/wmllint
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/data/tools/wmllint?rev=24346&r1=24345&r2=24346&view=diff
==============================================================================
--- trunk/data/tools/wmllint (original)
+++ trunk/data/tools/wmllint Thu Mar  6 04:32:11 2008
@@ -1827,18 +1827,24 @@
     # Simple check for unbalanced macro calls
     unclosed = None
     linecount = 1
-    depth = 0
+    startline = None
+    depth = quotecount = 0
     for i in range(len(transformed)):
         if transformed[i] == '\n':
             linecount += 1
         elif transformed[i] == '{':
             if depth == 0:
-                unclosed = linecount
+                unclosed = startline = linecount
+                quotecount = 0
             depth += 1
+        elif transformed[i] == '"':
+            quotecount += 1
         elif transformed[i] == '}':
             depth -= 1
             if depth == 0:
                 unclosed = None
+                if quotecount % 2:
+                    print >>sys.stderr, '"%s", line %d: unbalanced quote.' % 
(filename, startline)
     if unclosed:
         print >>sys.stderr, '"%s", line %d: unbalanced {.' % (filename, 
unclosed)
     # Return None if the transformation functions made no changes.




Related Messages


Powered by MHonArc, Updated Thu Mar 06 06:21:02 2008