2025-07-12 02:02:21 +01:00
|
|
|
# Parsing
|
|
|
|
|
|
|
|
|
|
The parsing functionality is for saving and loading from a custom file format.
|
|
|
|
|
|
|
|
|
|
The BNF for the custom file format is below.
|
|
|
|
|
|
2025-08-09 11:10:34 +01:00
|
|
|
Terminals are surrounded by `**` to the left and right. (rule)+ means "1 or more".
|
2025-07-12 02:02:21 +01:00
|
|
|
|
|
|
|
|
```
|
|
|
|
|
int ::= (0-9)+
|
|
|
|
|
|
|
|
|
|
item ::= **{** int int int int int int int int **}**
|
|
|
|
|
|
2025-08-09 11:29:36 +01:00
|
|
|
layer ::= **[** item **]**
|
2025-08-09 11:10:34 +01:00
|
|
|
|
2025-08-09 11:29:36 +01:00
|
|
|
layer_tree ::= int int **{** (layer)* **}**
|
2025-07-12 02:02:21 +01:00
|
|
|
```
|
|
|
|
|
|
2025-08-09 11:56:18 +01:00
|
|
|
The first two `int`s in the `layer_tree` always follow the order: `canvasWidth canvasHeight`.
|
2025-07-12 03:08:05 +01:00
|
|
|
|
2025-08-09 11:56:18 +01:00
|
|
|
The large number of `int`s in the `item` always follow the order: `x y ex ey r g b a`.
|