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: Mon Mar 16, 2009 4:41 am   

[3.05] Reformat Script is adding a '{' erroneously under certain conditions
 
Start with this in an alias/trigger:
Code:

#if (1)

{

  //
  //
  }


Do Reformat Script, it adds an '{' and becomes:
Code:

#if (1)

{
 {

  //
  //
  }


Do Reformat Script again, it adds another '{' and becomes:
Code:

#if (1)

{
 {
 {

  //
  //
  }


You can do this over and over again and it will keep adding more and more brackets. It happening is dependent upon the blank line right before the '//' comment characters.
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Mon Mar 16, 2009 6:10 am   
 
Weird but confirmed. Although technically it's an invalid script. Hopefully this can be fixed without too much low-level changes, but I'm sure we both know parser level changes are very tricky.
_________________
Asati di tempari!
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Mon Mar 16, 2009 6:59 am   
 
Fairly sure this has been reported before. It might be on the bug list, but the idea is that you don't use Reformat Script on scripts that have errors :P

Perhaps Reformat Script should do a syntax check first, ala Ctrl+K, and if that comes up with an error, just display it instead of reformatting?
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
ReedN
Wizard


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

PostPosted: Mon Mar 16, 2009 2:26 pm   
 
Why is the first one an invalid script? It just has a few extra blank lines here and there.
Reply with quote
Zugg
MASTER


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

PostPosted: Mon Mar 16, 2009 5:56 pm   
 
Because a blank line is not allowed between the start of a block and the initial {

If you do a Ctrl-K syntax check, you will see the syntax error.

The reformat command will *only* work properly if there are NO ERRORS in the script. The reformat command uses the script parser to do the reformatting, and with a script error, the script parser cannot process your script correctly.
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