Update BNF documentation to reflect trailing newline in DS format - #120
Conversation
Co-authored-by: hzhangxyz <11623447+hzhangxyz@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR updates documentation to accurately reflect that the DS format output from the parse() function includes a trailing newline character. The changes correct examples and syntax comparison tables in both the main BNF package README and the support packages documentation to match the actual implementation behavior.
Key Changes
- Updated all DS format string examples to include trailing
\ncharacter - Modified syntax comparison tables to show the trailing newline in all DS format entries
- Changes applied consistently across both Python and JavaScript code examples
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
bnf/README.md |
Updated Python/JavaScript examples and syntax comparison table to include trailing newlines in DS format strings |
docs/support-packages/bnf.md |
Updated Python/JavaScript examples and syntax comparison table to include trailing newlines in DS format strings |
The changes in this PR are accurate and complete. After reviewing the implementation in bnf/apyds_bnf/__init__.py and the test suite in bnf/tests/test_parse_unparse.py, I can confirm that:
- The
ParseVisitor.visitRule()method explicitly adds trailing newlines for both axioms and multi-premise rules - All test cases use DS format strings with trailing newlines
- The documentation updates correctly reflect this behavior across all examples and tables
- The changes are consistently applied in both documentation files
The PR successfully addresses the issue described in the original Chinese issue report, ensuring that the documentation matches the actual implementation behavior.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The DS format output from
parse()includes a trailing newline character, but the documentation examples showed it without one.Changes
ds_inputstrings in Python and JavaScript examples to include trailing\n\nto all DS format examples in bothbnf/README.mdanddocs/support-packages/bnf.mdExample
Before:
After:
This matches the actual implementation behavior where both axioms and multi-premise rules append a trailing newline.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.