gbdev/rgbds

RGBFMT tool to fix code formatting

Open

#1796 aperta il 13 ago 2025

Vedi su GitHub
 (4 commenti) (0 reazioni) (0 assegnatari)C++ (187 fork)auto 404
enhancementgood first issuenew tool

Metriche repository

Star
 (1623 star)
Metriche merge PR
 (Metriche PR in attesa)

Descrizione

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)

Guida contributor