Skip to content

Comments

Support comments and blank lines inside ClassBlock#236

Merged
pigpigyyy merged 6 commits intomainfrom
codex/add-blank-line-handling-to-classblock
Feb 20, 2026
Merged

Support comments and blank lines inside ClassBlock#236
pigpigyyy merged 6 commits intomainfrom
codex/add-blank-line-handling-to-classblock

Conversation

@pigpigyyy
Copy link
Member

Motivation

  • Class bodies previously could not contain standalone comments or preserved blank lines, causing formatting and compilation mismatches compared to table blocks; the change aims to make class blocks handle comments and empty lines like TableLit/TableBlock.

Description

  • Extend the ClassBlock AST to accept YueComment_t and EmptyLine_t by updating ast_sel_list for ClassBlock in src/yuescript/yue_ast.h.
  • Allow comment-only and empty-line+comment entries in the parser by updating the class_line rule in src/yuescript/yue_parser.cpp so it can parse (EmptyLine >> YueComment) and YueComment alternatives.
  • Update formatting logic in ClassBlock_t::to_string in src/yuescript/yue_ast.cpp to print comment nodes with indentation and preserve empty lines, matching table block behavior.
  • Accept YueComment_t and EmptyLine_t during class-body compilation traversal in src/yuescript/yue_compiler.cpp to avoid AST node mismatch errors.

Testing

  • Ran make gen which builds the compiler and generates spec outputs; the build and generation completed successfully with make gen returning without error.

Codex Task

@pigpigyyy pigpigyyy merged commit abe6859 into main Feb 20, 2026
3 checks passed
@pigpigyyy pigpigyyy deleted the codex/add-blank-line-handling-to-classblock branch February 20, 2026 06:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant