Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
ReedN
Wizard


Joined: 04 Jan 2006
Posts: 1279
Location: Portland, Oregon

PostPosted: Fri Sep 24, 2010 12:59 am   

[3.29a] Switch else statement reformatting
 
I thought I'd try the reformatting on various switch statements I have since they've historically been problematic with the reformatting, and you were recently working on it. However, feel free to delay work on something like this until you have more time.

Reformat this:
Code:
#switch (%null( %1)) {pa plant|ink|commodity}
        (%1 == all)  {pa plant|ink|commodity|crystal}
        {#forall %1 {#if (1) {#say Syntax}}}


Gives this:
Code:
#switch (%null( %1)) {pa plant|ink|commodity}
        (%1 == all)  {pa plant|ink|commodity|crystal}
        {
  #forall %1 {
    #if (1) {#say Syntax}
    }
  }


While it would appear much better something like this:
Code:
#switch (%null( %1)) {pa plant|ink|commodity}
        (%1 == all)  {pa plant|ink|commodity|crystal}
        {
          #forall %1 {
            #if (1) {#say Syntax}
          }
        }
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Fri Sep 24, 2010 2:07 am   
 
It's because CMUD is expecting you to only indent each level by 2 spaces each. This isn't going to get fixed, sorry.
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4662
Location: Pensacola, FL, USA

PostPosted: Fri Sep 24, 2010 4:27 am   
 
I like to make my parenthetical clauses line up as well.. so I feel your pain.
_________________
Discord: Shalimarwildcat
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Fri Sep 24, 2010 4:08 pm   
 
The "official" syntax for this is:
Code:
#switch
  (%null( %1)) {pa plant|ink|commodity}
  (%1 == all) {pa plant|ink|commodity|crystal}
  {
    #forall %1 {
      #if (1) {#say Syntax}
      }
    }

which has the () all lined up but uses the proper two-space indent value. At least that is what my goal for Reformat would be if I was able to fix this.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net