4 releases

0.1.4 Mar 19, 2023
0.1.2 Dec 21, 2022
0.1.1 Oct 17, 2022
0.1.0 Aug 30, 2022

#545 in Template engine

21 downloads per month

MIT license

20KB
494 lines

FLP-TSL

Crates.io Version

Template scripting language for rust game development

Supported version

The first line of a tsl file should be a version notation. E.g. @ 0.1

Check src/parser.rs for the supported range.

Template Variables

Just put ${variable} in anywhere of the script content and it will be replace by actual value of variable.

To escape the ${...}, use \${...} instead.

Grammar

For each line:

Operator Space Content

Operators

  • / -- Comments. Will be ignored during parsing.
  • ! -- Initialization. Contains a full JSON object or a part of JSON object. Will be combined with all adjacent initialization opeartors.
  • < -- Modification. Modifies current stage. Should be a valid JS assignment. (Index style only). e.g. obj[0]["name"] = "abc".
  • > -- Output. The text to be output to the screen.
  • * -- Delay. Delay the script for n milliseconds.
  • # -- Eol. Indicates the end of line.

Examples

See sample folder.

Dependencies

~1.4–2.4MB
~50K SLoC