|
Guinn Wizard
Joined: 03 Mar 2001 Posts: 1127 Location: London
|
Posted: Sat Apr 14, 2007 10:47 am
[1.27] *URGENT* 'Reformat script' results in broken syntax |
I've tagged as urgent because it can corrupt people's code, which I guess means there's a problem with the lexer
A code chunk from a working alias
Code: |
#FORALL {@new} {
#IF (!%ismember( %i, @old)) {
whoJoined = @joined|%i}}
#FORALL {@old} {
#IF (!%ismember( %i, @new)) {
whoLeft = @left|%i}} |
works and compiles fine
Once you've run 'Reformat script' on it though it changes to
Code: |
#FORALL {@new} {#IF (!%ismember( %i, @old)) {whoJoined = @joined|%i#FORALLALL {@old} {#IF (!%ismember( %i, @new{) {
whoLeft = @left|%i}} |
which gives
Code: |
Error compiling script:
invalid command: FORALLALL |
|
|
_________________ CMUD Pro, Windows Vista x64
Core2 Q6600, 4GB RAM, GeForce 8800GT
Because you need it for text... ;) |
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Sat Apr 14, 2007 2:36 pm |
Confirmed.
|
|
_________________ Asati di tempari! |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Sat Apr 14, 2007 4:57 pm |
I'll take a look at that and see what the problem is. The reformatter depends heavily on the new lexer/parser, so it might be some syntax that isn't getting parsed exactly right. For example, you might want to add braces around your string assignment:
whoJoined = {@joined|%i}
to see if that helps. I'll look at it Monday when I'm back at my work computer. |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Sat Apr 14, 2007 5:28 pm |
Oh, and I should remind people that the new script editor has a full Undo/Redo stack. So if the Reformat messes up your script, you can easily press Ctrl-Z (or right-click and select Undo) to return it to it's previous form. As long as you stay within the same type of setting (like within aliases, or within triggers), the undo/redo stack isn't cleared. This can be a bit weird, since switching to a different setting and then selecting Undo will load the setting value that you just switched from. But if you keep performing Undo, you will still get back to the changes made to the first setting. It's a bit confusing to explain, but basically, as long as you don't switch to a different setting type (which recreates a new editor panel), then you can keep Undo-ing and Redo-ing.
The keyboard shortcut for Undo is Ctrl-Z. The keyboard shortcut for Redo is Ctrl-Y. I noticed a bug that prevents these keys from working when the editor is completely blank, but otherwise it should work well. |
|
|
|
Guinn Wizard
Joined: 03 Mar 2001 Posts: 1127 Location: London
|
Posted: Sat Apr 14, 2007 5:53 pm |
If the script is simplified it still errors when reformatting
Code: |
#FORALL {1|2} {
#IF (1) {
#SAY blah %i}
}
#FORALL {3|4} {
#IF (1) {
#SAY blah %i}
} |
If the #IFs are removed it works
Code: |
#FORALL {1|2} {
#SAY blah %i
}
#FORALL {3|4} {
#SAY blah %i
} |
|
|
_________________ CMUD Pro, Windows Vista x64
Core2 Q6600, 4GB RAM, GeForce 8800GT
Because you need it for text... ;) |
|
|
|
Larkin Wizard
Joined: 25 Mar 2003 Posts: 1113 Location: USA
|
Posted: Sun Apr 15, 2007 1:29 pm |
Guinn wrote: |
If the script is simplified it still errors when reformatting
Code: |
#FORALL {1|2} {
#IF (1) {
#SAY blah %i}
}
#FORALL {3|4} {
#IF (1) {
#SAY blah %i}
} |
|
This script works as-is? The braces don't seem properly aligned to me, but I know CMUD is probably able to handle different sorts of layouts. If you change the positioning of the braces, does the reformat work for this script? |
|
|
|
Guinn Wizard
Joined: 03 Mar 2001 Posts: 1127 Location: London
|
Posted: Sun Apr 15, 2007 1:38 pm |
Works as is. The alignment is odd now you mention it, I snipped the example out of a full script. When the braces are placed properly
Code: |
#FORALL {1|2} {
#IF (1) {
#SAY blah %i
}
}
#FORALL {3|4} {
#IF (1) {
#SAY blah %i
}
} |
then the reformat still garbles it |
|
_________________ CMUD Pro, Windows Vista x64
Core2 Q6600, 4GB RAM, GeForce 8800GT
Because you need it for text... ;) |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Wed Apr 18, 2007 12:42 am |
Fixed for v1.28
|
|
|
|
|
|