[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 »

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 »

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 »

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: 2155
Joined: 05 Jan 2016, 11:34
Location: The Netherlands
Contact:

Re: Syntax error with scoped statements

Post by Miss »

Wow, Maniascript doesn't do regular scopes?
3080 RTX, Ryzen 3700X, 32GB RAM, Windows 11
Forum moderator, opinions are my own. :thx:
Check out Image openplanet, the alternative ManiaPlanet & Turbo scripting platform! (Openplanet subforum)
I also stream and tweet.
zocka
Posts: 205
Joined: 15 Jun 2010, 17:56

Re: Syntax error with scoped statements

Post by zocka »

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: 2155
Joined: 05 Jan 2016, 11:34
Location: The Netherlands
Contact:

Re: Syntax error with scoped statements

Post by Miss »

Wow :P
3080 RTX, Ryzen 3700X, 32GB RAM, Windows 11
Forum moderator, opinions are my own. :thx:
Check out Image openplanet, the alternative ManiaPlanet & Turbo scripting platform! (Openplanet subforum)
I also stream and tweet.
reaby
Posts: 1032
Joined: 29 Dec 2010, 23:26
Location: Eastern Finland
Contact:

[fixed] Syntax error with scoped statements

Post by reaby »

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: 2155
Joined: 05 Jan 2016, 11:34
Location: The Netherlands
Contact:

Re: [FIXED] Syntax error with scoped statements

Post by Miss »

Done :thumbsup:

Thanks for checking!
3080 RTX, Ryzen 3700X, 32GB RAM, Windows 11
Forum moderator, opinions are my own. :thx:
Check out Image openplanet, the alternative ManiaPlanet & Turbo scripting platform! (Openplanet subforum)
I also stream and tweet.
Post Reply

Return to “ManiaScript”

Who is online

Users browsing this forum: No registered users and 1 guest