[FIXED] Syntax error with scoped statements

You can talk about ManiaScript for ManiaPlanet here

Moderator: English Moderator

Post Reply
zocka
Posts: 205
Joined: 15 Jun 2010, 17:56

[FIXED] Syntax error with scoped statements

Post by zocka » 17 Feb 2018, 13:20

Code: Select all

main() {
	{+++code+++}
	log("test");
}
throws
syntax error, unexpected MANIASCRIPT_BRACKET_CURLY_OP

Putting a statement above (like move the log a line up) works. Without the braces it of course works as well.
(It occured to me with labels but holds true for any code block)
It happens with the scoped statement ("{"+StatementList+"}") as first statement in any kind of statement list, e.g. function bodies or other scoped statements.
That was a lot of statements o_o

greetz
manialink minigame shatter
my manialink: zockaml
my maniaflash: maniaflash?zocka

User avatar
Dommy
Translator
Translator
Posts: 1901
Joined: 25 Aug 2011, 21:45
Location: Poland
Contact:

Re: Syntax error with scoped statements

Post by Dommy » 17 Feb 2018, 14:45

I think I ran into similar issue, which could be solved by formatting the scoped label differently:

Code: Select all

{ +++MyLabel+++ }
or

Code: Select all

{
	+++MyLabel+++
}
Indeed
Ryzen 7 2700X, GTX 1070 Ti, 16 GB RAM, Windows 10 Insider Build
FORUM MODERATOR • CREATOR OF SHOOTMANIA GALAXY & TRACKMANIA² PURSUIT

Contact me via GALAXY & PURSUIT DISCORD

zocka
Posts: 205
Joined: 15 Jun 2010, 17:56

Re: Syntax error with scoped statements

Post by zocka » 17 Feb 2018, 18:48

no, that doesn't work like in this example:

Code: Select all

***init***
***
log("init");
***

Void test() {
	log("testfn");
	{
		{
		^-- unexpected MANIASCRIPT_BRACKET_CURLY_OP
			declare Foo = 3;
		}
		declare Bar = 4;
	}
}

main() {
	test();
	log("test");
}
manialink minigame shatter
my manialink: zockaml
my maniaflash: maniaflash?zocka

User avatar
Miss
Posts: 2120
Joined: 05 Jan 2016, 11:34
Location: The Netherlands
Contact:

Re: Syntax error with scoped statements

Post by Miss » 17 Feb 2018, 20:21

Wow, Maniascript doesn't do regular scopes?
1070 GTX, Ryzen 3700X, 16GB RAM, Windows 10
Forum moderator, opinions are my own. :thx:
Check out Image openplanet, the alternative ManiaPlanet & Turbo scripting platform! (Openplanet subforum)
I also stream on Twitch and tweet on Twitter.

zocka
Posts: 205
Joined: 15 Jun 2010, 17:56

Re: Syntax error with scoped statements

Post by zocka » 17 Feb 2018, 20:24

It does, but just not as first statement in a block.
Last edited by zocka on 17 Feb 2018, 20:25, edited 1 time in total.
manialink minigame shatter
my manialink: zockaml
my maniaflash: maniaflash?zocka

User avatar
Miss
Posts: 2120
Joined: 05 Jan 2016, 11:34
Location: The Netherlands
Contact:

Re: Syntax error with scoped statements

Post by Miss » 17 Feb 2018, 20:25

Wow :P
1070 GTX, Ryzen 3700X, 16GB RAM, Windows 10
Forum moderator, opinions are my own. :thx:
Check out Image openplanet, the alternative ManiaPlanet & Turbo scripting platform! (Openplanet subforum)
I also stream on Twitch and tweet on Twitter.

reaby
Posts: 1026
Joined: 29 Dec 2010, 23:26
Location: Eastern Finland
Contact:

[fixed] Syntax error with scoped statements

Post by reaby » 27 Jan 2020, 14:33

As of maniaplanet 4.1 this seems to be fixed.

Code: Select all

***code***
*** 
{
	log("works!");
}
***

main() {
	{+++code+++}
	log("works");
}

some admin could perhaps add fixed tag to the original topic ?

User avatar
Miss
Posts: 2120
Joined: 05 Jan 2016, 11:34
Location: The Netherlands
Contact:

Re: [FIXED] Syntax error with scoped statements

Post by Miss » 27 Jan 2020, 16:51

Done :thumbsup:

Thanks for checking!
1070 GTX, Ryzen 3700X, 16GB RAM, Windows 10
Forum moderator, opinions are my own. :thx:
Check out Image openplanet, the alternative ManiaPlanet & Turbo scripting platform! (Openplanet subforum)
I also stream on Twitch and tweet on Twitter.

Post Reply

Return to “ManiaScript”

Who is online

Users browsing this forum: No registered users and 1 guest