Skip to content

RGBFMT tool to fix code formatting #1796

@Rangi42

Description

@Rangi42

Modern programming languages tend to have auto-formatters. It would be worthwhile to have one for RGBASM as well, supporting users' various preferred styles.

Configurable options (not meant as a complete list):

  • Indentation: tabs or N spaces
  • Max line length: backslash line continuations could apply for long lines (0 = no limit)
  • Case: lower or UPPER, separately configurable for:
    • hex digits
    • instructions/registers/conditions
    • directives/keywords
    • plus a way to special-case some (e.g. lowercase everything except MACRO/ENDM and SECTION/ENDSECTION)
  • Instructions: some instructions have alternatives
    • the optional a argument for add, sub, cpl, etc
    • ld [hli/hld] vs ld [hl+/hl-] vs ldi/ldd [hl]
    • ldh [c] vs ld [$ff00+c]
    • nz/nc vs !z/!c
  • Blank lines: configure how many blank lines to put:
    • before global labels
    • before new sections
    • before other directives
  • Anonymous labels: put : on its own line, or on the same line as the subsequent instruction
  • Macros: indent macro invocations or not (or e.g. indent all of them except mycol1macro)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementTypically new features; lesser priority than bugsgood first issueNew to the codebase? You can help no problem!new toolThis involves writing a new program for the RGBDS package

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions