Allow #comment lines in macros. Updated the Macros documentation.

This commit is contained in:
Max Siyazov 2021-12-12 18:50:57 +00:00
commit e476e6d60a
2 changed files with 25 additions and 0 deletions

View file

@ -43,6 +43,30 @@ L_STICK@+000+000 0.75s
1.0s
```
### Loops
A simple for-loop can be used to repeat a macro block a specified number of times. The below example loops through an indented macro block 100 times.
```
LOOP 100
B 0.1s
0.1s
```
Nested loops are also supported.
```
LOOP 100
B 0.1s
0.1s
# Nested loop
LOOP 5
A 0.1s
0.1s
```
Note, a macro line starting with `#` is ignored.
## Macro Control Values
| Macro Value | Control Name |

View file

@ -307,6 +307,7 @@ class InputParser():
parsed = macro.split("\n")
parsed = list(filter(lambda s: not s.strip() == "", parsed))
parsed = list(filter(lambda s: not s.strip().startswith("#"), parsed))
parsed = self.parse_loops(parsed)
return parsed