bug with wmlindent

Having trouble with the game? Report issues and get help here. Read this first!

Moderator: Forum Moderators

Forum rules
Before reporting issues in this section, you must read the following topic:
Post Reply
User avatar
iceiceice
Posts: 1056
Joined: August 23rd, 2013, 2:10 am

bug with wmlindent

Post by iceiceice »

Hi,

I tried to report this to http://bugs.wesnoth.org/, but it seems my gna registration email has been lost forever so perhaps that is an entirely separate bug ><

Edit: I registered a different account. Reported bug here.

I ran some of my (working, balanced) code on wmlindent and found a "end of file with nonzero indent" error, but when I cut it in half, both sides indented just fine. I removed as many balanced segments as I could until I got to a line-minimal counter example, then started removing characters. What I have here is not character minimal, but its about as small as is still intelligible.

I obtain the error from both 1.10 and 1.11 wmlindent versions, from wesnoth-1.10-tools, wesnoth-1.11-tools debian packages, the latter on rhonda.

Code: Select all

#define NO_STRING_HEADER
"#"
#enddef
[multiplayer]
    [event]
          {IF_VAR side_number equals 3 (
          )}
    [/event]
[/multiplayer]
The HEADER symbol originally corresponded to a pango formatting tag I was using.
Spoiler:
From here:
  • Running either wmlindent on the above code gives:

    Code: Select all

     wmlindent: "/home/chris/.local/share/wesnoth/1.10/data/add-ons/Rushed_By_Yetis/resources/graveyard/RBY_Interactive.cfg". line 9: end of file with indent nonzero.
  • Removing "{IF_VAR ... )}" alleviates the error.
  • Removing the # in line 2 alleviates the error.
  • Removing both quotes (leaving just #) in line 2 alleviates the error.
  • Getting closer to character minimal:

    Code: Select all

    "#"
    [multiplayer]
        [event]
              {(
              )}
        [/event]
    [/multiplayer]
    
    Is still bugged.
  • Removing the parenthesis () at this point alleviates the error.
  • Removing the carriage-return between the parenthesis alleviates the error.
  • Removing [event] and [/event] still leaves an error.
This bug mystifies me, because its easy to look at this and say "oh, for some reason wmlindent must want you to escape the # symbol, and then it isn't escaped so it interacts badly with whitespace in these parenthesis" or something, but then there's the fact if you remove [multiplayer] and [/multiplayer] above you don't have an error anymore, but if you remove [event] [/event] you do.

In conclusion, I don't know how wmlindent works, but I don't think it should be doing that.

My OS:

Code: Select all

chris@Basalt /usr/share/games/wesnoth/1.10/data/tools $ cat /etc/*release*
DISTRIB_ID=LinuxMint
DISTRIB_RELEASE=14
DISTRIB_CODENAME=nadia
DISTRIB_DESCRIPTION="Linux Mint 14 Nadia"
NAME="Ubuntu"
VERSION="12.10, Quantal Quetzal"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu quantal (12.10)"
VERSION_ID="12.10"
~iceiceice~
Groggy_Dice
Inactive Developer
Posts: 165
Joined: February 4th, 2011, 6:19 am
Contact:

Re: bug with wmlindent

Post by Groggy_Dice »

In fact, this bug has been dealt with in the dev branch, unfortunately a little too late to make it into the last 1.10 and 1.11 point releases. You can get the latest wmlindent straight from Github: https://raw.github.com/wesnoth/wesnoth- ... /wmlindent

If you'd like to read the commit message, the diff is here: https://github.com/wesnoth/wesnoth-old/ ... 2a2ccdb634
Ports:
Prudence (Josh Roby) | By the Sword (monochromatic) | The Eight of Cembulad (Lintana~ & WYRMY)
Resources:
UMC Timeline (Dec) | List of Unported UMC (Dec) | wmllint++ (Feb)
User avatar
iceiceice
Posts: 1056
Joined: August 23rd, 2013, 2:10 am

Re: bug with wmlindent

Post by iceiceice »

Thanks!
Post Reply