FreneticLLC / FreneticScript

The Frenetic Scripting Engine (dll)
MIT License
4 stars 1 forks source link

General script format adjustments #29

Closed mcmonkey4eva closed 6 years ago

mcmonkey4eva commented 6 years ago

A format adjustment suggestion (from Discord) that should be good to implement was:

Make newlines significant.

Current FS implementation defines ; as the separator between commands (and { / } have special separator powers too). The new idea is to allow ; separation but additionally use newlines to validly separate command. This was done in the past but replaced for line length wrangling reasons. The new system will fix the line length issue by way of allowing multi-line statements with explicit markings A sufficient marker would be to put a pipe (|) and a space in front of lines that are attached to the above line.

An example of this format would be:

var x =
| <[y].
| [3].to_integer.
| add[5]>
echo <[x]>

This is equivalent to current code:

var x = <[y].[3].to_integer.add[5]>;
Echo <[x]>;

The parser would be expected to simply bring all the combined lines into a single line before running full parsing. Likely spacing will be cleared entirely in this area for some cases, for reasons of allow weird long blocks (like the tag above). Specific cases would be quoted sections treated as no separating spaces, and tags treated similarly. Other cases will be treated as separate arguments.

mcmonkey4eva commented 6 years ago

Implemented fairly effectively.