Add the directive form of a repetition (`!repeat`) v0.8.0
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Mon, 2 Oct 2023 03:33:09 +0000 (23:33 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Mon, 2 Oct 2023 03:33:09 +0000 (23:33 -0400)
commite57a18e1620dc01979402c7dda30c2a44c64792f
treeb0444fc55157cfba62f476962ea952729cf95212
parent00deb9faa00a04ed1379e2a72f90dbb956aa69a8
Add the directive form of a repetition (`!repeat`)

This patch introduces the first directive amongst other ones I'd like to
add later.

`!repeat` is equivalent to what's now called the post-item repetition
form:

    aa (bb cc dd) * 3 ee ff

    aa
    !repeat 3
      bb cc dd
    !end
    ff

`!repeat` (or the shorter `!r` alias) accepts exactly what's accepted
after a `*`: a constant integer, an expression, and (new) a name.

Obviously, the `!` symbol isn't considered a comment anymore.

See `README.adoc` and the new tests to learn more.

This patch also:

* Makes it legal to refer to the special `ICITTE` name within a
  repetition count expression.

  It's less natural for the post-item form, but it works nevertheless.

* Decouples the variables and labels dictionary types as `VariablesT`
  and `LabelsT`. Indeed, a variable value is (for the moment) an `int`
  or `float` instance, while a label value is always an integer (because
  it's an offset snapshot).

Change-Id: I77cd4c9f29639082612534940c48964a61e51392
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
103 files changed:
README.adoc
normand/normand.py
pyproject.toml
tests/fail-rep-blk-empty-expr.nt [new file with mode: 0644]
tests/fail-rep-blk-eval-type-1.nt [new file with mode: 0644]
tests/fail-rep-blk-eval-type-2.nt [new file with mode: 0644]
tests/fail-rep-blk-eval.nt [new file with mode: 0644]
tests/fail-rep-empty-expr.nt [deleted file]
tests/fail-rep-eval-type-1.nt [deleted file]
tests/fail-rep-eval-type-2.nt [deleted file]
tests/fail-rep-eval.nt [deleted file]
tests/fail-rep-icitte.nt [deleted file]
tests/fail-rep-inval-count.nt [deleted file]
tests/fail-rep-neg.nt [deleted file]
tests/fail-rep-post-empty-expr.nt [new file with mode: 0644]
tests/fail-rep-post-eval-type-1.nt [new file with mode: 0644]
tests/fail-rep-post-eval-type-2.nt [new file with mode: 0644]
tests/fail-rep-post-eval.nt [new file with mode: 0644]
tests/fail-rep-post-inval-count.nt [new file with mode: 0644]
tests/fail-rep-post-neg.nt [new file with mode: 0644]
tests/fail-rep-post-unreachable-label-1.nt [new file with mode: 0644]
tests/fail-rep-post-unreachable-label-2.nt [new file with mode: 0644]
tests/fail-rep-post-unreachable-label-3.nt [new file with mode: 0644]
tests/fail-rep-unreachable-label-1.nt [deleted file]
tests/fail-rep-unreachable-label-2.nt [deleted file]
tests/fail-rep-unreachable-label-3.nt [deleted file]
tests/pass-comment-sym-bin-const.nt
tests/pass-comment-sym-group.nt
tests/pass-comment-sym-hex-const.nt
tests/pass-comment-sym-rep-post.nt [new file with mode: 0644]
tests/pass-comment-sym-rep.nt [deleted file]
tests/pass-comment-text-rep-post.nt [new file with mode: 0644]
tests/pass-comment-text-rep.nt [deleted file]
tests/pass-readme-intro-rep.nt
tests/pass-readme-learn-rep-1.nt [deleted file]
tests/pass-readme-learn-rep-2.nt [deleted file]
tests/pass-readme-learn-rep-3-cond-0.nt [deleted file]
tests/pass-readme-learn-rep-3-cond-1.nt [deleted file]
tests/pass-readme-learn-rep-blk-1.nt [new file with mode: 0644]
tests/pass-readme-learn-rep-blk-2.nt [new file with mode: 0644]
tests/pass-readme-learn-rep-blk-3-cond-0.nt [new file with mode: 0644]
tests/pass-readme-learn-rep-blk-3-cond-1.nt [new file with mode: 0644]
tests/pass-readme-learn-rep-post-1.nt [new file with mode: 0644]
tests/pass-readme-learn-rep-post-2.nt [new file with mode: 0644]
tests/pass-rep-all-bytes.nt [deleted file]
tests/pass-rep-blk-all-bytes.nt [new file with mode: 0644]
tests/pass-rep-blk-cond.nt [new file with mode: 0644]
tests/pass-rep-blk-const-bin.nt [new file with mode: 0644]
tests/pass-rep-blk-const-dec.nt [new file with mode: 0644]
tests/pass-rep-blk-const-hex.nt [new file with mode: 0644]
tests/pass-rep-blk-expr-label-inner.nt [new file with mode: 0644]
tests/pass-rep-blk-expr-label.nt [new file with mode: 0644]
tests/pass-rep-blk-expr-var-1.nt [new file with mode: 0644]
tests/pass-rep-blk-expr-var-2.nt [new file with mode: 0644]
tests/pass-rep-blk-group.nt [new file with mode: 0644]
tests/pass-rep-blk-icitte.nt [new file with mode: 0644]
tests/pass-rep-blk-label.nt [new file with mode: 0644]
tests/pass-rep-blk-r.nt [new file with mode: 0644]
tests/pass-rep-blk-rep.nt [new file with mode: 0644]
tests/pass-rep-blk-str-u16be.nt [new file with mode: 0644]
tests/pass-rep-blk-str-u16le.nt [new file with mode: 0644]
tests/pass-rep-blk-str-u32be.nt [new file with mode: 0644]
tests/pass-rep-blk-str-u32le.nt [new file with mode: 0644]
tests/pass-rep-blk-str-u8.nt [new file with mode: 0644]
tests/pass-rep-blk-var.nt [new file with mode: 0644]
tests/pass-rep-blk-zero.nt [new file with mode: 0644]
tests/pass-rep-cond.nt [deleted file]
tests/pass-rep-const-bin.nt [deleted file]
tests/pass-rep-const-dec.nt [deleted file]
tests/pass-rep-const-hex.nt [deleted file]
tests/pass-rep-expr-label-inner.nt [deleted file]
tests/pass-rep-expr-label.nt [deleted file]
tests/pass-rep-expr-var-1.nt [deleted file]
tests/pass-rep-expr-var-2.nt [deleted file]
tests/pass-rep-group.nt [deleted file]
tests/pass-rep-one.nt [deleted file]
tests/pass-rep-post-all-bytes.nt [new file with mode: 0644]
tests/pass-rep-post-cond.nt [new file with mode: 0644]
tests/pass-rep-post-const-bin.nt [new file with mode: 0644]
tests/pass-rep-post-const-dec.nt [new file with mode: 0644]
tests/pass-rep-post-const-hex.nt [new file with mode: 0644]
tests/pass-rep-post-expr-label-inner.nt [new file with mode: 0644]
tests/pass-rep-post-expr-label.nt [new file with mode: 0644]
tests/pass-rep-post-expr-var-1.nt [new file with mode: 0644]
tests/pass-rep-post-expr-var-2.nt [new file with mode: 0644]
tests/pass-rep-post-group.nt [new file with mode: 0644]
tests/pass-rep-post-icitte.nt [new file with mode: 0644]
tests/pass-rep-post-label.nt [new file with mode: 0644]
tests/pass-rep-post-rep.nt [new file with mode: 0644]
tests/pass-rep-post-str-u16be.nt [new file with mode: 0644]
tests/pass-rep-post-str-u16le.nt [new file with mode: 0644]
tests/pass-rep-post-str-u32be.nt [new file with mode: 0644]
tests/pass-rep-post-str-u32le.nt [new file with mode: 0644]
tests/pass-rep-post-str-u8.nt [new file with mode: 0644]
tests/pass-rep-post-var.nt [new file with mode: 0644]
tests/pass-rep-post-zero.nt [new file with mode: 0644]
tests/pass-rep-rep.nt [deleted file]
tests/pass-rep-str-u16be.nt [deleted file]
tests/pass-rep-str-u16le.nt [deleted file]
tests/pass-rep-str-u32be.nt [deleted file]
tests/pass-rep-str-u32le.nt [deleted file]
tests/pass-rep-str-u8.nt [deleted file]
tests/pass-rep-zero.nt [deleted file]
This page took 0.029659 seconds and 4 git commands to generate.