Ghabry / EasyScript

GNU General Public License v3.0
3 stars 0 forks source link

Syntax discussion #1

Open Ghabry opened 6 months ago

Ghabry commented 6 months ago

Blocks (if, choice, etc.)

More syntax fun. Wasted some hours to hack in a feature in chaiscript that invokes a callback when a {} scope closes.

So you can write now:

@if {

}
@else {

}

Instead of:

@if

@else

@endif

So you can write now:

@choice {
    @case("Yes") {

    }
    @case("No").cancel {

    }
}

Instead of:

@choice
    @case("Yes")

    @endcase
    @case("No").cancel

    @endcase
@endchoice

Though both ways are supported.

(Yes this comes pretty close to TPC syntax. As a C-programmer I just prefer {} xD)

monokotech commented 1 month ago

Hello,

I have tested the program briefly and tried to understand it.

I found that the conversion from events in lmu to easyscript probably does not involve the use of chaiscript. Through my exploration of chaiscript, it also seems that it cannot convert easyscript into event data and write it back to the LMU file.


That's interesting! I might understand. I guess it involves adding corresponding command generation functions to chaiscript, and then eval the easyscript to generate LMU events.


I might feel that it's better not to hack into chaiscript to change some syntax. And the chaiscript syntax is already usable.