Skip to content

Lay out and assemble generated files through xr-syntax 0.3.0 - #113

Merged
Jiu-xiao merged 2 commits into
devfrom
feat/xr-syntax-generation-20261012
Oct 13, 2026
Merged

Jiu-xiao merged 2 commits into
devfrom
feat/xr-syntax-generation-20261012

Conversation

@Jiu-xiao

Copy link
Copy Markdown
Member

XRobot uses xr-syntax 0.3.0 for its C++ layout and for writing Modules/CMakeLists.txt. cpp_layout.py is gone.

Changes

  • User/xrobot_main.hpp and the Module header are laid out with xr_syntax.format and assembled by CppFileBuilder.
  • Modules/CMakeLists.txt is written with CMakeFileBuilder. Every command stays on one line whatever the length of the module identity.
  • The pin and the release record example are updated to xr-syntax==0.3.0.

Generated output

  • Byte-identical to xrobot 1.0.1:
    • xrobot setup --frozen and xrobot gen on bsp-dev-c (default config, sentry and all 9 RobotConfig files, with and without --no-line-directives), bsp-dev-mc02 and bsp_stm32f103;
    • an empty module list;
    • a 60-character module identity.

Requires xr-syntax 0.3.0 on PyPI (xrobot-org/xr-syntax#3), so CI installs only after that release. All tests pass locally on Windows with Python 3.13 (475 passed, 48 skipped).

xrobot.cpp_layout is gone: the layout of generated code comes from
xr_syntax.format. That module holds the line-breaking rules of both
generators, each behind its own entry point and on shared primitives. User/
xrobot_main.hpp and the Module header are assembled by CppFileBuilder, which
parses the whole file once at the build boundary; an empty last line is the
newline at the end of the file, not one blank line more.

Pin xr-syntax 0.3.0 and update the release record accordingly.
The module list is written with CMakeFileBuilder, which parses the whole file
once in build(); the file is therefore always one xr-syntax can read back. A
module identity long enough to make the command exceed the column limit still
keeps the command on one line, and an empty module list writes the same two
lines as before.
@Jiu-xiao
Jiu-xiao merged commit cc8ea0c into dev Oct 13, 2026
43 of 50 checks passed
@Jiu-xiao
Jiu-xiao deleted the feat/xr-syntax-generation-20261012 branch October 13, 2026 21:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant