Skip to content

[Feature request] Nested label scopes #916

Description

@Rangi42

(Note this this is independent from the concept of "scopes" for symbols in general, which would allow shadowing of outer symbols and auto-purging when the scope ends; see #342.)

Currently there's only one level of symbol scoping: .local symbols are scoped to their preceding Parent. It might be useful to have more levels, in the manner described by ax6:

..foo to define a label in the second-level nested scope would be some simple syntax that could be used. Like so:

Main:
  dw 1234
: ..label isn't allowed here (nonsensical nested label; no parent)
.foo
  dw 5678
..bar ; defines Main.foo.bar
  dw 9012
.baz ; defines Main.baz (up a level because it only has one dot)
  dw 34567

Naturally, ...label would be a third level, etc. Explicit definitions (.foo.bar, Main.foo.bar:) should also work.

It could autofill each upper level separately: so appending Main..bar there would become Main.baz.bar, appending .baz.qux would become Main.baz.qux (and then appending .baz..spam would become Main.baz.qux.spam).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementTypically new features; lesser priority than bugsrgbasmThis affects RGBASM

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions